TheSwamp

Code Red => .NET => Topic started by: Andrey Bushman on September 02, 2015, 04:59:48 AM

Title: How does work the undocumented RemovingAutoLISP function of AutoCAD 2009?
Post by: Andrey Bushman on September 02, 2015, 04:59:48 AM
How does work the undocumented RemovingAutoLISP function of AutoCAD 2009? I supposed that this function locks the AutoLISP using.
 
From Dependency Walker:
Code - C++: [Select]
  1. bool RemovingAutoLISP(void)

I have written such code:
Code - C#: [Select]
  1.   public sealed class Commands {
  2. #if AUTOCAD_2009
  3.     private const String removingAutoLISP = "?RemovingAutoLISP@@YA_NXZ";
  4. #endif
  5.  
  6.     [DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
  7.   CharSet = CharSet.Unicode, EntryPoint = removingAutoLISP)]
  8.     private static extern Boolean RemovingAutoLISP();
  9.  
  10.     [CommandMethod("Test01")]
  11.     public void Test01() {
  12.       Document doc = cad.DocumentManager.MdiActiveDocument;
  13.       if (null == doc)
  14.         return;
  15.       Editor ed = doc.Editor;
  16.       Database db = doc.Database;
  17.       try {
  18.         Boolean result = RemovingAutoLISP();
  19.         ed.WriteMessage("The result of RemovingAutoLISP calling: {0}",
  20.           result.ToString());
  21.       }
  22.       catch (System.Exception ex) {
  23.         ed.WriteMessage(ex.Message);
  24.       }
  25.     }
  26.   }
I get the result:
Quote
The result of RemovingAutoLISP calling: True
But when I put the LISP commands into console of AutoCAD (after working of my code) it works still.