TheSwamp

CAD Forums => CAD General => Topic started by: MSTG007 on May 20, 2015, 08:52:37 AM

Title: Reloading Custom Commands error
Post by: MSTG007 on May 20, 2015, 08:52:37 AM
I have a autocad session that when it first opens the dwt all my custom commands work. When I open other drawings the custom commands do not work; but if I got back to the dwt they work. Is there a variable that needs to be set?
Title: Re: Reloading Custom Commands error
Post by: mjfarrell on May 20, 2015, 08:59:08 AM
AutoCAD is normally not supplied with the user-defined startup file acaddoc.lsp; you create (Notepad can be used) and maintain the file yourself.

The acaddoc.lsp file is intended to be associated with each document (or drawing) initialization. This file is useful if you want to load a library of AutoLISP routines to be available every time you start a new drawing (or open an existing drawing).

Each time a drawing opens, AutoCAD searches the library path for an acaddoc.lsp file. If it finds one, it loads the file into memory. The acaddoc.lsp file is always loaded with each drawing regardless of the settings for the ACADLSPASDOC and LISPINIT system variables.

Most users will have a single acaddoc.lsp file for all document-based AutoLISP routines. AutoCAD searches for an acaddoc.lsp file in the order defined by the library path; therefore, with this feature, you can have a different acaddoc.lsp file in each drawing directory, which would load specific AutoLISP routines for certain types of drawings or jobs.

The acaddoc.lsp file can contain AutoLISP code for one or more routines, or just a series of load function calls. The latter method is preferable, because modification is easier. If you save the following code as an acaddoc.lsp file, the files mydocumentapp1.lsp, build.lsp, and counter.lsp are loaded every time a new