Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using Autodesk.AutoCAD.ApplicationServices;
  2. using Autodesk.AutoCAD.EditorInput;
  3. using Autodesk.AutoCAD.Runtime;
  4. using System;
  5.  
  6. [assembly: ExtensionApplication(typeof(TestAutoCad.Exercice01))]
  7.  
  8. /*
  9.  * Exercice n°1 (Chargement de la DLL)
  10.  * 1) Affiche un message dans la console d’AutoCAD lorsque ta librairie se charge.
  11.  */
  12.  
  13. namespace TestAutoCad
  14. {
  15.     public class Exercice01 : IExtensionApplication
  16.     {
  17.         void IExtensionApplication.Initialize()
  18.         {
  19.             Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
  20.             ed.WriteMessage("Initializing the TestAutoCad DLL");
  21.         }
  22.  
  23.         void IExtensionApplication.Terminate()
  24.         {
  25.             Console.WriteLine("Cleaning up...");
  26.         }
  27.  
  28.         [CommandMethod("EXO_2")]
  29.         public void Exo2()
  30.         {
  31.             Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
  32.             ed.WriteMessage("I am printing in the autocad console!");
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement