Search code examples
.netautocadautocad-pluginautolispobjectarx

What is the order of load AutoCAD plugins?


There are few ways of automatic load applications - plugins when AutoCAD starts. I know those:

  • startup suite - attached by GUI
  • List item %appdata%....\support\zwcad2018.lsp ( I use ZWCAD, maybe in Acad, there is another path. The long time ago when I worked on Acad it was acad.lsp, but that was times before Windows UAC feature).
  • *.mnl loaded while corresponding *.mnu is loaded ( old fashion way, but is ZWCAD possible) what about Acad?
  • On-demand loading: HKEY_CURRENT_USER\Software\ZWSOFT\ZWCAD\2018\en-US\Applications\MyApplicationName
  • zwcaddoc.lsp if the path to my application is in Options/File/Support File Search Path
  • application shortcut using /ld switch
  • acad.rx

What is the order of ways to load applications? And if there are other ways not listed here please let me know. Probably ARX or .Net applications may be loaded also in another way.


Solution

  • The below description of support file load order (for AutoCAD) is an excerpt from my post on the CADTutor forum surrounding the Dangers of the ACADDOC.lsp.


    acad.rx

    This file loads various ObjectARX applications when AutoCAD is started.

    acad20##.lsp

    This file loads the acad20##doc.lsp file in versions which do not load such file automatically. This file should not be modified.

    acad.lsp

    The loading of this file is dependent on the setting of the ACADLSPASDOC System Variable:

    • ACADLSPASDOC = 0 (default)

      Loads acad.lsp into just the first drawing opened in an AutoCAD session, and will not load for each subsequently opened drawing.

    • ACADLSPASDOC = 1

      Loads acad.lsp into every drawing opened.

    This file is reserved for user customisation and is intended to be used for application-specific startup routines, as all functions and variables defined in an acad.lsp file are only available in the first drawing.

    If functions are required in all drawings, rather than altering the value of ACADLSPASDOC, functions & programs should be moved from the acad.lsp file into the acaddoc.lsp file.

    acad20##doc.lsp

    This file is automatically loaded every time a drawing is opened and loads the autoload function definiton and other utility functions required by AutoCAD. This file should not be modified.

    acaddoc.lsp

    As described above, if found, this file is automatically loaded into every drawing opened in the AutoCAD session. This file is useful for loading a library of AutoLISP functions to be available every time a drawing is opened.

    The acaddoc.lsp file is always loaded with each drawing regardless of the settings of the ACADLSPASDOC System Variable.

    Since AutoCAD will search the working directory before the Support Paths and will load the first acaddoc.lsp file found, users can have a different acaddoc.lsp file in each drawing directory, which would load specific AutoLISP routines for certain types of drawings or jobs.

    acad.dvb

    This file will automatically load VBA projects for versions in which VBA is enabled.

    Main CUI/CUIX and related files

    A CUIx file contains multiple XML based files and image files, each of which contains the data for a user interface element that can be customised. CUIx files replace the CUI, MNU, MNS, and MNC files that were used to define menus in previouse releases.

    The Main CUIx file defines the majority of interface elements in AutoCAD.

    Enterprise CUI/CUIX and related files

    The Enterprise CUIx file is typically controlled by a CAD manager and accessed by many users, usually from a shared network location.

    This file is read-only to users to prevent the data in the file from being changed. A CAD manager would create an enterprise CUIx file by modifying a Main CUIx file and then saving the file to a shared network location.

    See here for information on how to create this file.

    acetmain.mnl

    This file loads the Express Tools menugroups.

    Express Tools LISP & MNL files

    The various LISP and Menu files required by the Express Tools programs are loaded here.

    Startup Suite programs

    Programs files residing in the Startup Suite are now loaded, in the order they appear in the AppLoad dialog.

    The Startup Suite is known to be temperamental in some versions of AutoCAD, so I would recommend using the acaddoc.lsp for loading functions and programs required during the drawing session.

    (S::STARTUP)

    This post-initialisation function can be utilised to perform operations after the drawing has initialised in the drawing editor.

    Since the acad.lsp and acaddoc.lsp files are loaded early in the drawing initialisation procedure, commands issued at run-time from these files may be unsuccessful as the command-line may not be initialised in the drawing.

    acad.exe command line switch /b

    The command-line switch /b can be used to run a Script when the AutoCAD application is launched. Any Script operations called in this way will be executed after drawing initialisation has completed.

    Command-line switches can be set from within the properties of the AutoCAD application shortcut icon, within the Target edit box.

    For a more detailed description of command-line switches, see here.