- // Commands.cs 
- // © Andrey Bushman, 2013 
- // Перехват и обрабока вызова раздела справочной системы для команд AutoCAD 
-   
- // Microsoft 
- using System; 
- using System.Resources; 
- using System.IO; 
- using System.Runtime.InteropServices; 
-   
- // Autodesk 
- using cad = Autodesk.AutoCAD.ApplicationServices.Application; 
- using Ed = Autodesk.AutoCAD.EditorInput; 
- using Rtm = Autodesk.AutoCAD.Runtime; 
-   
- [assembly: Rtm.ExtensionApplication(typeof(Bushman.CAD.Tests.Commands))] 
- [assembly: Rtm.CommandClass(typeof(Bushman.CAD.Tests.Commands))] 
-   
- namespace Bushman.CAD.Tests { 
-         public class Commands : Rtm.IExtensionApplication { 
-   
- #if acad_newer_than_2012 
-                 const String acedSetFunHelpOwner = "accore.dll"; 
- #else 
-                 const String acedSetFunHelpOwner = "acad.exe"; 
- #endif 
-                 // © Adam Nagy, 2012 
-                 // Source: http://adndevblog.typepad.com/autocad/2012/05/change-help-file-and-topic-associated-to-a-given-command.html 
-                 // In case of AutoCAD 2013 and above  
-                 // replace "acad.exe" with "accore.dll" 
-                 [DllImport(acedSetFunHelpOwner, CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl, 
-                         EntryPoint = "acedSetFunHelp")] 
-                 private static extern int acedSetFunHelp(String functionName, String helpFile, String helpTopic, 
-                         Int32 cmd); 
-   
-                 [Rtm.CommandMethod("bushman", "test", Rtm.CommandFlags.Modal)] 
-                 public void Test() { 
-                         Ed.Editor ed = cad.DocumentManager.MdiActiveDocument.Editor; 
-                         ed.WriteMessage("\nHello, World!\n"); 
-   
-                         // Чтобы можно было проверить вызов справки для командной строки в AutoCAD 2009 
-                         ed.GetInteger("Type some integer value");  
-                          
-                 } 
-   
-                 public void Initialize() { 
-                         Ed.Editor ed = cad.DocumentManager.MdiActiveDocument.Editor; 
-                         ed.WriteMessage("\nThe {0} loaded...\n", Path.GetFileName(this.GetType().Assembly.Location)); 
-   
-                         // В качестве теста взял один из своих старых файлов справки (DrawingQuickCopyHelp.chm)  
-                         // и закинул его на "рабочий стол" - тренируюсь, так сказать, "на кошках"... 
-   
-                         acedSetFunHelp("C:LINE", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), 
-         "DrawingQuickCopyHelp.chm"), "dwgquickcopy", 0); 
-                         acedSetFunHelp("C:CIRCLE", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), 
-                                 "DrawingQuickCopyHelp.chm"), "settings", 0); 
-   
-                         // Регистрирую свою ".net" команду 
-                         acedSetFunHelp("test", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), 
-                                 "DrawingQuickCopyHelp.chm"), "contacts", 0); 
-   
-                         ed.WriteMessage("\nThe help info registered...\n"); 
-                 } 
-   
-                 public void Terminate() { 
-                         // is empty 
-                 } 
-         } 
- }