AutoLISP

   
 

Instruction on the usage of AutoCAD's acaddoc.lsp

(It works for other versions (2000 and later) of AutoCAD and verticals as well)

From the Help in AutoCAD 2008

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 of ACADLSPASDOC.

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 document is opened.

(load "mydocumentapp1")
(load "build")
(load "counter")

Warning Do not modify the reserved acad2008doc.lsp file. Autodesk provides the acad2008doc.lsp file, which contains AutoLISP-defined functions that are required by AutoCAD. This file is loaded into memory immediately before the acaddoc.lsp file is loaded.
How to create acaddoc.lsp if it does not exist

In the folder where you want to save acaddoc.lsp right click and select New>Text Document. Change the name to acaddoc.lsp. Now you should be able to double click on the file and typically edit it in Notepad.

Or start Notepad, edit, save, ready.

Examples on location for acaddoc.lsp

C:\Program Files\AutoCAD 2008\Support

C:\Documents and Settings\<loginname>\Application Data\Autodesk\AutoCAD 2008\R17.1\enu\Support
or in Windows Vista
C:\Users\<loginname>\AppData\Roaming\Autodesk\AutoCAD 2008\R17.1\enu\Support

If you want to find folders that are searched by AutoCAD run the OPTIONS command and look at the Files tab and at the Support File Search Path.

 
© 2001-2008 JTB World. All rights reserved.