Monday
AutoLISPLoading AutoLISP applications automatically
AutoCAD 2006 and higher versions
It is a little bit laborious for the user to load AutoLISP files automatically each time drawings opening. That’s why I choose this topic of automatically loading AutoLISP files. Before starting, we’d better clarify some of the terminology:
Multi document interface (MDI) : Opening more than one document in the same program interface similar to some office applications like Microsoft Word™ and Excel™ was enables in AutoCAD starting from 2000 version. By this way, there is no need to open a new AutoCAD program in order to start another drawing without closing the first program. This logic of working is called multi document interface.
Application level : In applications with multi document feature, this is the application that works on the top of all, independently from others.
Document level : It is the level of working that is loaded separately for each document in applications that has multi document feature.
AutoLISP does not allow creating a program that can be executed at application level. Thus, when you load an AutoLISP application, program is only available for the drawing which is currently open. When you close the drawing and open a new one, then you have to reload the program. Now, let’s start from the beginning and look at how the AutoLISP files are loaded into the drawings: To load a LISP file, we use ( load … ) function. For example, let’s load ‘tal_utils.lsp‘ file:
Command : ( load “tal_utils.lsp” )
By this way, we load the file into the drawing. However, at this stage, we should pay attention to the directory where the files exist. If our file is not in AutoCAD directory, then its location must be entered into support directory listings of AutoCAD. You can access to this setting from ‘Tools/Options‘ menu (Fig. 1).

Fig. 1 – Settings for AutoCAD support directory.
If you don’t want to add loading directory to these settings, then you have to give full path for file directory. While doing this, you should use ‘/‘ instead of ‘\‘.
Command : ( load “c:/talia/lisp/tal_utils.lsp” )
We learned how to load a simple LISP file. But, it is a very laborious to do this everytime we open a new drawing and there should be an easy way of doing this. So, Autodesk has put some specific mechanisms for automatically loading into AutoCAD. Now, let’s examine these mechanisms all together:
1 – Automatical loading: It is not possible to automatically load LISP files that you have created yourself. However, there are two files, “acadXXXX.lsp” which is loaded every time when AutoCAD is opened and “acadXXXXdoc.lsp“, which is loaded every time a new drawing is opened. So, we can load our own applications inside these files by using (load … ) function. XXXX inside the file names correspond to version of AutoCAD you are using. Thus, file names will be “acad2007.lsp” and “acad2007doc.lsp” correspondingly for AutoCAD 2007. “acad2007.lsp” file is loaded one time when AutoCAD is opened (application level); however “acad2007doc.lsp” file is loaded every time when a new drawings is opened. For this reason, we will make our additions on this file. I strongly suggest that you should take a back-up of these file before starting. Final part of the default contents of the file at the end is as shown in Fig. 2.

Fig. 2 – Default contents of acad2007doc.lsp file.
We will make our additions before ‘;; Silent load.‘ row ( Fig. 3 ).

Fig .3 – Edited acad2007doc.lsp file
Yes, from now on, our programs will be loaded automatically every time a new drawing is opened.
2 – Loading together with Menu: Until AutoCAD 2006, extension of menu files were MNU. Experienced AutoCAD users know how to edit menu files. Starting from AutoCAD 2006, development of command buttons and menus were rearranged according to Windows™ standards and new menu file extension has become CUI (Custom User Interface file). In both cases, user can customize his/her own menus or make additions to standard AutoCAD menus. If your are customizing your own menu, it means that you use a name you want like TALIA.MNU or TALIA.CUI; or if you are making additions to existing AutoCAD menus, then you use ACAD.MNU or ACAD.CUI name. In this article, I assume that we are using our own menus and our menu is correctly loaded into the drawing. Menu files are also document based and once they are loaded, they need to be loaded every time with a new drawing. You must place another file with the same name but MNL extension “talia.mnl” in the same directory with the menu file. AutoCAD will load LISP functions and commands together with the menu automatically. If you insert a line as written in Fig. 3 into these files as I mentioned above, then your lisp files will be loaded automatically.
3 – STARTUP SUITE:

Fig. 4 – Application loading dialog box.
From ‘Tools/Load Application…‘ menu, dialog box shown in Fig. 4 will open up. On the lower right corner of this window, there is a start up suite (Fig. 5).

Fig . 5 – Start up suite contents window.
Every application ( LISP / ARX / DBX / NET ) that we place here is automatically loaded every time with a new drawing.
4 – (autoload … ) function : As a little bit more advanced that automatically loading, there is LISP function that is used to load LISP functions on demand. This function is intended for heavily loaded LISP files not to allocate unnecessary memory space when they are not used. You can use this function inside either acad2007doc.lsp or talia.mnl files as shown below (Fig. 6):

Fig. 6 – Edited version of acad2007doc.lsp file.
By using this definition, when you use TTT and PRF commands for the first time, ‘tal_utils.lsp‘ file will be loaded automatically.
Bu yazinin Turkce’sini okumak icin basiniz.
Viewed 15,262 times so far... This week: 69 Today: 9 Latest: 4 July 2009, 23:27Post Tags:
Related Posts
Popular
- Hip tip: Increasing view resolution with VIEWRES system variable
07/03/2009 04:39 am
7 Comments - Sirince – IZMIR
07/02/2009 11:02 am
1 Comment - Visual LISP: Programming user interfaces with OpenDCL
07/01/2009 10:15 pm
10 Comments - 3D Modeling 7: EXTRUDE
06/30/2009 02:14 pm
10 Comments - Ask DailyAutoCAD: Which Notebook to Buy?
06/30/2009 12:17 pm
1 Comment
Featured Articles
- AutoCAD 2009 Update 3 Released
- Speed Up As AutoCAD 2009 Ribbon Menu Helps You!
- MEP Analysis Extension for AutoCAD MEP extended to March 31, 2009
- Recap of AutoCAD-related technologies on Autodesk Labs
- Technology Preview of MEP Analysis Extension extended to 12/31/08
- Autodesk Labs: Forward and Backward utility for AutoCAD
- Mar 8, 2007 : Daily Autocad » Blog Archive
|

Feb 19, 2007
Reply
You should not edit the “acad200x.lsp” and “acad200xdoc.lsp” files. These files belong to the application and are subject to being overwritten during a repair, reinstall, and or upgrade.
You should create the files “acad.lsp” and “acaddoc.lsp” (which perform the same functions, respectively). These files belong to the user and will never be overwritten by an Autodesk application.
FWIW – the startup suite has a history of either double loading or not loading applications sometimes. Unreliable at best. I would suggest sticking with “acad.lsp” and “acaddoc.lsp”
Feb 21, 2007
Reply
The method I use is as follows:
1) Create a folder on your C: drive. Name it ’scripts’ or ‘lisp_routines’ or whatever. I do not nest it too deeply in my folder hierarchy.
2) Map this folder inside of AutoCAD’s options dialog as shown in the original blog post.
3) Use separate lisp files for every routine when possible.
4) Add in to the acaddoc200x.lsp file the following:
(load (findfile “myroutine.lsp”))
What I have found is that this helps keep your routines separate from AutoCAD’s defaults; it helps to cut down on clutter in your acaddoc200x.lsp; and I feel it better keeps my routines in an organized form. The ‘findfile’ argument will locate a file of that name in the mapped support directories within AutoCAD. Obviously, unique names for your files are strongly encouraged, regardless of directory location.
In the previous comment regarding the acaddoc200x.lsp or acad200x.lsp, I have not yet encountered this problem. Is there some reference you can point me to on this? Thank you.
Feb 22, 2007
Reply
Hey Bryan, here are some KB articles with more detail regarding “acad200x.lsp” vs “acad.lsp” and “acad200xdoc.lsp” vs “acaddoc.lsp”
http://support.autodesk.com/Getdoc.asp?ID=TS21336
http://support.autodesk.com/getdoc.asp?ID=TS28079
http://support.autodesk.com/getdoc.asp?ID=TS43235
Regarding your method, see this page for more info: http://tinyurl.com/3yctm5
Have a good one.
Feb 23, 2007
Reply
Thanks for the comments Mr.McSwain
Your first and last comment (3rd in order) were very helpful. You’re right. It’s more safe and clever to use acad.lsp and acaddoc.lsp files.
I prefer the *.mnl files and (autoload … ) mechanism. So I’m allways sure that my lisp files ready to use for each document.
May 30, 2007
Reply
Good Afternoon, i was wondering if you had anyidea on creating a lisp file for window and door numbering that it will automatically know if one is deleted and so that it will alter the rest to suit i.e doors 1-14 if 12 is deleted it will rename the doors 1-13
Jul 21, 2007
Reply
Would this work in 2004-2006 also?
Jul 23, 2007
Reply
Yes
Sep 22, 2008
Reply
… creating a lisp file for window and door numbering that it will automatically know if one is deleted and so that it will alter the rest to suit i.e doors 1-14 if 12 is deleted it will rename the doors 1-13
on july 23, 2007 you responded to this question with a yes.
is that lisp file available for download?
thanks
Sep 25, 2008
Reply
I use startup suite in Acadlt 2007 which is enabled by Cadbooster. This allows me to use lsps inside a Lite Version. I recently entered a corrupted lsp in the startup and this causes Autocad to crash everytime it loads the suite. How can I erase this order from startup suite without having access to open Autocad?
Sep 29, 2008
Reply
i had copied auto cad file from one organisation and found unable yo open in my personel pc showing error invalid file & cui file are missing . i would like to know how can i open the file.
Oct 1, 2008
Reply
Hello Simon
AutoDESK is not supporting customization for LT. And this is strictly prohibited. Sorry I cannot help you
Feb 7, 2009
Reply
For 2007:
Type appload
Browse to your lisp routine and drag into the Startup Suite, which has an icon of a suitcase. Then it will load whenever you start AutoCAD.
Apr 15, 2009
Reply
Any reason why AutoCad 2006 will not keep my customized ARX in the Startup Suite? The ARX file is removed after a restart of the application