AutoLISP

   
 

Instruction on the usage of acad.lsp

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

From the Help in AutoCAD 2008

You can create an acad.lsp file if you regularly use specific AutoLISP routines. When you start AutoCAD, it searches the support file search path for an acad.lsp file. If an acad.lsp file is found, it is loaded into memory.

The acad.lsp file is loaded at each drawing session startup when AutoCAD is launched. Because the acad.lsp file is intended to be used for application-specific startup routines, all functions and variables defined in an acad.lsp file are only available in the first drawing. You will probably want to move routines that should be available in all documents from your acad.lsp file into the acaddoc.lsp file.

The recommended functionality of acad.lsp and acaddoc.lsp can be overridden with the ACADLSPASDOC system variable. If the ACADLSPASDOC system variable is set to 0 (the default setting), the acad.lsp file is loaded just once: upon application startup. If ACADLSPASDOC is set to 1, the acad.lsp file is reloaded with each new drawing.

The acad.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 acad.lsp file, the files mysessionapp1.lsp, databasesynch.lsp, and drawingmanager.lsp are loaded every time you start AutoCAD.

(load "mysessionapp1")
(load "databasesynch")
(load "drawingmanager"

Warning Do not modify the reserved acad2008.lsp file. Autodesk provides the acad2008.lsp file, which contains AutoLISP defined functions that are required by AutoCAD. This file is loaded into memory immediately before the acad.lsp file is loaded.

How to create acad.lsp if it does not exist

In the folder where you want to save acad.lsp right click and select New>Text Document. Change the name to acad.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 acad.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.