AutoCAD supports a variety of programming languages, interfaces and technologies, from the oldest but still very popular AutoLISP to the latest DesignScript and JavaScript. The API (Application Programming Interface) seems a more proper term to use to refer to them for AutoCAD generally provides a bridge/interface between its drawing elements and some programming environments either internal or external.
AutoCAD provides the following APIs (Application Programming Interface) so far.
• AutoLISP
• Visual LISP
• Menu Macros and DIESEL (Direct Interpretively Evaluated String Expression Language)
• ADS (AutoCAD Development System)
• ADSRX (AutoCAD Development System Runtime eXtension)
• ARX (AutoCAD Runtime eXtension)
• ObjectARX (Objectified AutoCAD Runtime eXtension)
• COM (Component Object Model)
• ActiveX Interfaces
o VBA (Visual Basic for Application)
o VB 6
o Delphi
o …
o COM Interop
• .NET
o C#
o VB.NET
o CLI (Common Language Infrastructure)/Managed C++
o F#
o …
• DesignScript
• JavaScript
Menu Macros and DIESEL is used to define callbacks for AutoCAD menus such as buttons, menu items, shortcuts, mouse clicks, and even digital input devices in .MNU files. It’s the main technology to define AutoCAD UIs in the past. Since the CUI comes out, the Menu Macros and DIESEL has been less and less used.
It can be as simple as calling the ZOOM command for the right button click of the mouse.
[Button #2 Right]^C^C’_zoom ;
It can also contain some conditions and branches as follows.
ID_Copy [_Button(“Copy Object”, RCDATA_16_COPYOB, RCDATA_16_COPYOB)]$M=$(if,$(eq,+$(substr,$(getvar,cmdnames),1,4),grip),_copy,^C^C_copy)
Though it is not a real sense API (Application Programming Interface), its syntax system is petty huge and complex. Many online resources and books have addressed the legacy technology in detail, so we will not duplicate the effort here. Instead, let’s present a similar skill matrix using the same criteria for the Menu Macros and DIESEL based on our understanding and experiences.
Skill Matrix of Menu Macros and DIESEL
==================================================================================
Criteria Scale
----------------------------------------------------------------------------------
Affordability 10 (embedded into AutoCAD itself)
Availability 8 (text editors can edit the menu macros directly;
AutoCAD provides comprehensive samples)
Capability
Language Itself 3 (define menus only; DIESEL similar to subset of AutoLISP)
User Interface 2 (to define simple menu UIs and their callbacks)
AutoCAD Friendliness 4 (not so bad)
Efficiency
Running Performance 3 (not good)
Development Effectiveness 3 (not good)
Compatibility/Portability 9 (almost no portable issue)
Learnability 2 (no knowledge share; better start from samples)
Code Reusability 2 (only in AutoCAD menus)
Operability 1 (very poor)
Manageability 3 (.MNU, .MNR, .MNL file formats)
Code Safety 2 (has compiled version)
Maintainability 2 (can be separated in a few partial menus)
Interoperability 3 (can call commands; call AutoLISP functions in .MNL)
Readability 1 (cannot be poorer)
Scalability 2 (menu can be big; cannot fulfill big task itself)
Applicability 2 (can only apply to AutoCAD and its flavors)
==================================================================================
As can be seen, it has very low marks in most of skills because of its sole menu definition usage. Therefore, we can forget about it in non-menu related tasks. Even if for UI related ones in recent AutoCAD versions, using the CUI API or creating the .CUI(x) files manually is obviously a better idea than the legacy .MNU stuffs.
The leading edge AutoCAD .NET Addin Wizard (AcadNetAddinWizard), as its name indicates, focuses on .NET compliant languages (currently C#, VB.NET and CLI/Managed C++).
Recent Comments