What is loaded at AutoCAD startup, and when?

What is loaded at AutoCAD startup, and when?

Warning, CAD nerd stuff ahead. This is a long and technical post and if you’re using AutoCAD in a largely out-of-the-box state you probably won’t care about any of it.

If your modification of AutoCAD extends beyond the trivial, you may find it useful to know what AutoCAD loads, and in what order things are loaded. It is possible for LISP files in particular to tread on each other’s toes, so knowing what gets loaded when can be useful information for diagnosing such clashes. This post aims to provide that information. It uses AutoCAD 2009 as an example, but the same principles apply to all releases from AutoCAD 2006 onwards.

On startup, the first things AutoCAD loads are its CUI files. It first loads the Enterprise CUI file, then the Main CUI file, then any partial CUI files attached to the Main, then any partial CUI files attached to the Enterprise. I have no idea of the reasoning behind this slightly strange order, but there it is. The order of the partial CUIs loaded in each case is determined by the order in which they appear in the parent CUI files, which is determined by the order in which you attached them. If you don’t like this order, you can attach and reattach them in the CUI interface, or you can do the same thing much quicker with a text editor if you feel confident enough. If there are LISP files associated with these CUI files, they are not loaded yet. You’ll need to wait a few paragraphs for that.

Next, if you have created a file called acad.rx in AutoCAD’s search path, any ARX files listed in that file will be loaded. There are other ways in which developers can load their ARX files at startup, but I won’t go into that here.

Following that, the acad*.lsp files are loaded. First, Autodesk’s acad2009.lsp file is loaded. Next, if you have created a file called acad.lsp, that is loaded. These two files are only loaded at first startup, unless the ACADLSPASDOC system variable is set to 1, in which case the acad.lsp file is reloaded with each new drawing. Next comes Autodesk’s acad2009doc.lsp and any acaddoc.lsp file you may have created, in that order. These two files are loaded at startup and with every new drawing session.

It’s worth pointing out here that the acad200x.lsp and acaddoc200x.lsp files are Autodesk’s and are not intended to be modified by users. You can modify them, and adding things in there works fine, but updates and hotfixes can overwrite these files, leaving you to patch things up again afterwards. The acad.lsp and acaddoc.lsp files are yours, and that is where you are best advised to put your additions.

I hesitate to mention VBA because I have long avoided that development environment and my knowledge in that area is very limited, but if you’re a VBA developer and have created an acad.dvb file in AutoCAD’s search path, it gets loaded at this point.

Once the acad*.* files are loaded, then come any LISP files associated with the CUI files that were loaded at the beginning. For each CUI file, if there is a *.mnl file of the same name, that will be loaded first (*.mnl files are just *.lsp files renamed). After that, any LISP files that are specified in the CUI file will be loaded, in the order in which they appear in the CUI file itself. This order can be modified in the same ways that the partial CUI loading sequence can be modified; “delete” and “load” (detach and attach, really) the files within the CUI interface, or hack the CUI file with a text editor.

The CUI-associated LISP files are loaded as described in the above paragraph for each CUI file in turn, in the same order as the CUI files themselves: Enterprise, then Main, then partials to Main, then partials to Enterprise.

The Appload command provides a Startup Suite facility, where you can specify any number of files to load (*.arx, *.lsp, *.dvb, *.dbx, *.vlx or *.fas). If you have done so, those files are loaded at this point, in the order in which they appear in the Startup Suite list.

That’s all the actual loading done, but we’re not finished yet. At this point AutoCAD’s environment should be all ready to do pretty much anything, including things that modify the drawing database, including invoking commands. This was not true earlier on, so if you want to do things like change the drawing or run commands, this should be done using a startup routine rather than called directly at load time from any of the files loaded above.

If you’ve defined a VBA sub called AcadStartup(), it will be called now. If starting a new drawing, any sub called AcadDocument_Activate() will be called instead. The caveat about my VBA ignorance still applies here.

If a LISP function called (S::STARTUP) has been defined, it will be called next. Where could that be defined? Anywhere in any of the LISP files mentioned above, or in any LISP or other files that are loaded by any of those files, or by any files that are loaded by any of those files, and so on ad infinitum. It could even be defined in one of the ARX files loaded at any point. This would be unusual, but is quite possible.

If there are multiple (S::STARTUP) functions defined in various places, which one wins? Whichever one loaded last. That’s why the load order can be important, but it’s also why you should never have an unconditional (defun S::STARTUP …) definition in your LISP code. Instead, you should append your startup code to any existing (S::STARTUP) function. That way, your startup can cooperate with any others in your environment rather than walking all over it. If there is some interest in that subject, I can cover it in more detail in a future post.

In summary, here is the AutoCAD startup sequence:

A. CUI files loaded:
1. Enterprise
2. Main
3. Partials to Main
4. Partials to Enterprise

B. acad*.* files loaded:
1. Files listed in acad.rx
2. acad2009.lsp
3. acad.lsp
4. acad2009doc.lsp
5. acaddoc.lsp
6. acad.dvb

C. CUI-associated MNL and LSP files loaded:
1. Enterprise named MNL
2. Enterprise loaded LSP and MNL
3. Main named MNL
4. Main loaded LSP and MNL
5. Partials to Main named MNLs
6. Partials to Main loaded LSPs and MNLs
7. Partials to Enterprise named MNLs
8. Partials to Enterprise loaded LSPs and MNLs

D. Startup suite files loaded

E. Startup routines run:
1. AcadStartup() called (AutoCAD startup)
2. AcadDocument_Activate() called (Drawing startup)
3. (S::STARTUP) called


  1. This is a great reference post.

    I’m going to print it and put it in a notebook. I’m also going to make a copy and tape it on the wall near my monitor. I’ll also book mark this site incase of a fire. That reminds me, I should write something about backing up information. I’m sure I have a few versions started somewhere around here.

  2. Thanks for putting this together. Autodesk does also publish a list of the AutoCAD startup sequence. This all came to be rather important with the recent rash of “CAD viruses”, aka ALS_BURSTED.H virus or variously called Virus.ALS.Bursted, ALS/Bursted, and other variants. The virus comes as a tainted ACAD.FAS file, or an ACAD.VLX file, and on some sites discussing the “CAD virus” conjectured that ACAD.FAS and ACAD.VLX probably load up at the same sequence position as ACAD.LSP. One of our offices got infected with the virus, and the solution was to put some code in ACAD200X.LSP (which loads BEFORE acad.lsp/fas/vlx) to thwart the virus. The virus takes advantage of the automatic-loading of reserved AutoCAD file names to execute their infected version of said files. Frankly, I’m surprised there haven’t been more of these types of virus attacks, not dissimilar to MS Office macro viruses that exploit templates and other files that get auto-loaded when Office applications launch.

  3. You can disable any C:XXX function by setting it to nil, e.g.

    (setq C:XXX nil)

    It depends where the functions are defined and where your disabling calls are placed. If you append your own stuff (including command-disabling stuff) to S::STARTUP in acaddoc.lsp, then it should come last and should therefore “win”.

  4. Ivan

    Thanks a lot Steve. It works.

    Do you have a way of protecting the acaddoc.lsp from being deleted? The only way I know is to make it a hidden file but it can always be unhidden in the folders option. My reason is once acaddoc.lsp is deleted the custom commands will be enabled again at the startup. So I’m hoping the file can be immune from being deleted.

  5. It depends who you’re trying to protect the file from, what rights they have and so on, but you should be able to prevent deletion by others by changing the security settings on the file.

    Assuming you’re using XP, right-click on the file, pick Properties and use the Security tab to set permissions in there. See Start > Help and Support > Security and Administration > Access Control for more information. The topics “To take ownership of a file or folder” and/or “Set, view, change, or remove file and folder permissions” should get you started.

    Note that although you can prevent somebody deleting your file, they can still change the AutoCAD search path so AutoCAD doesn’t find it.

  6. Ivan

    thanks steve.

    pls help me with another thing.

    I succeeded disabling custom commands at startup using the acaddoc.lsp and (c:xxx nil). But whenever the vlx and lsp programs are loaded again during autocad session by using appload, the custom commands are working again. Can you share some syntax on how to prevent the same custom programs (vlx, fas, or lsp) from being loaded again? I plan to put it also under the acaddoc.lsp.

    thanks. you’ve been very helpful and really appreciate your kindness.

  7. Grant

    I installed Land Desktop Companion 2009 and made very few changes to my profile and when I try to run any land desktop command I get the following:

    ; error: no function definition: XLOAD

    Command: Unknown command “LDD”. Press F1 for help.

    Can you help please, I have tried everything I know, even a repair and just can’t seem to figure it out.

  8. Sorry, I have no LDD experience whatsoever. I can only suggest creating a new clean profile and switching to it, but even that advice might be dangerous. This is the sort of things that resellers are supposed to be able to help with. Failing that, how about the Autodesk discussion groups?

  9. Chris Cowgill

    Steve, do you know if there is any documentation that tells how to get any acaddoc.lsp file to load from a specific location. I just realized today, that if you open a drawing that has an acaddoc.lsp file in the same folder, AutoCAD will automatically load and run that version. That could create an issue if you open a drawing and am unaware that the file is located in the same directory. plus it also has a potential to create a headache when you have office wide customizations.

  10. Each of these files will be loaded from the first place AutoCAD finds them as it works through its search path. The search path isn’t just what is defined in the Options Files tab, it also includes the current folder (usually the start-in folder defined in the program shortcut) and the current drawing’s folder. The current folder is searched first, then the drawing folder, then the rest of the search path. I know of no way of disabling this.

  11. pvsr

    Sir, Thanks for eloborating the “CAD VIRUS”
    Pl show how to write the code in the ACAD200X.LSP (which loads BEFORE acad.lsp/fas/vlx) to thwart the virus that comes as a tainted ACAD.FAS file, or an ACAD.VLX file.

  12. Randy L Rickman


    I would like to create a prototype/startup drawing with all my variables. layers, dimstyles, etc set for each new drawing. Can you please tell me the best method to accomplish this?

    Thank you so much

  13. Chris Robinson

    There is an AutoCAD command that I cannot seem to remember, but it shows what was loaded, or more importantly – where AutoCAD stopped loading my ACADDOC. I’ve used the command once through technical support, but I wasn’t wise enough to write it down, does anyone know what that command might be?

    My situation is this: my acaddoc loads all of my lisp routines and most of my system variables, but some where along the line in the system variables I’m getting hung up and the acaddoc is not loading any further.

  14. Elie Chedrawi

    I have Autocad 2007, a worm got in so I had to do the following :
    Tools -> Options -> support file search path -> remove the first path…

    The worm is not accessing my drawings anymore but when I try to write commands, AutoCAD won’t recognize them:

    Command: l
    Unknown command “L”. Press F1 for help.

    Please advise ASAP

  15. zxinfinity

    Regenerating model.
    Loading Modeler DLLs.
    AutoCAD menu utilities loaded.
    AutoCAD Architecture menu utilities loaded.Echoing…_HELP
    Command: _ToolPalettes
    Command: _aecprojectpalettestartup
    Command: COMMANDLINE
    Command: properties

    I appended a function to my S::STARTUP and within it I am trying to put a close command in it to close the default startup drawing. When I put the command _CLOSE in place of _HELP, the program hangs, as if I interrupted another routine. Is there a way to prevent this from happening, or to relocate where the _ToolPalettes, etc. commands are executed?


  16. jodanquah

    Im using autocad architecture 2012, but recently its behaving funny, anytime i open a file an unreadable message with combination of letters,numbers and symbols. of course some of the commands seem to do different actions than commanded. and when i close its creates a file name: AutoCad Fast-Load AutoLisp File. Is this a virus or worm and how do i get rid of it. ive already installed the LISP CLEANER even before the occurrence.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.