Вы находитесь на странице: 1из 2

Auto-Loading AutoCAD LISP Utilities by Aaron Werning Industri...

http://www.davetyner.com/2011/01/auto-loading-autocad-lisp-utilities/

Auto-Loading AutoCAD LISP Utilities by Aaron Werning

Since AutoCADs loading of functions operates with the premise of last loaded wins (i.e. if you have 2 utilities loading with the exact same function name, the last one to be loaded will be the one AutoCAD will recognize when executing a utility), it is important to understand a few things about how and where AutoCAD looks for files to load. When you open a new or existing drawing, AutoCAD is pre-programmed to look for certain support files in a certain order. Autodesks AutoCAD STARTUP FILE LOADING ORDER: 1) acad2011.lsp (AutoCAD file) 2) acad.lsp (User file only loaded once at AutoCAD 2011 startup, unless ACADLSPASDOC=1) 3) acad2011doc.lsp (AutoCAD file) 4) acaddoc.lsp (User file) 5) custom.mnl (User file) 6) mymenu.mnl (User file) 7) acad.mnl (loaded when acad.cuix is loaded) 8) acetmain.mnl (loaded when acetmain.cuix is loadedExpress Tools) 9) files in the startup suite 10) S::STARTUP Function (may be defined\re-defined in multiple locations) NOTE: Anything labeled as a User File are not files that you will find out of the box. The acad.lsp and the acaddoc.lsp files are legacy files that still have a use. The difference between the two (besides load order) is the fact that acad.lsp is designed to run only on the first drawing opened in an AutoCAD session (unless ACADLSPASDOC=1), whereas the acaddoc.lsp is designed to run on every drawing that is opened up in a single drawing session. You must create these files and place them somewhere in your support directory structure (found in AutoCAD in the ToolsOptions dialog on the Files tab). The support directory structure is hierarchical,

1 of 2

29/6/2011 11:52 AM

Auto-Loading AutoCAD LISP Utilities by Aaron Werning Industri...

http://www.davetyner.com/2011/01/auto-loading-autocad-lisp-utilities/

meaning that if an acaddoc.lsp is found under 2 (or more) of the paths in that list, only the one at the highest path in that list will be used. The custom.mnl and mymenu.mnl files are used only if you have a custom.cuix or mymenu.cuix menu that you have loading. These files would be a good place to put functions that are specific to your user menus so as to keep the entire menus functionality in one place. The Startup Suite is a classic place for the average user to put a library of LISP routines. It is easy to explain how to do it, and it also falls very close to the end of the list so as to ensure that what the user want to use will get loaded near the end. However, if you are a CAD Admin and have set up company wide commands (maybe in the acaddoc.lsp file) that arent working for a specific user, this would be your first place to go to make sure they are not overriding the company command with a personal LISP routine. Lastly, the S::STARTUP is a function that gets run very last after ALL startup files have been loaded. This is an advanced way to make sure a function gets run after the entire drawing has been initialized (you will find that there are certain tasks that cannot be performed while initialization is happening). However, there are things to consider when using this option and it will take a bit of discussion to explainfor next time.

2 of 2

29/6/2011 11:52 AM

Вам также может понравиться