About AutoLISP Applications

AutoLISP is based on the LISP programming language, which is simple to learn and very powerful. Because AutoCAD has a built-in LISP interpreter, you can enter AutoLISP code at the Command prompt or load AutoLISP code from external files.

AutoLISP is an application interface for automating of design tasks. When an AutoLISP application is loaded, it functions in its own namespace for each drawing that is open. A namespace is an insulated environment keeping AutoLISP applications that are specific to one drawing from having symbol or variable name and value conflicts with those in another drawing. For example, the following line of code sets a different value to the symbol a when executed in each open drawing.

(setq a (getvar "DWGNAME"))

AutoLISP applications can prompt the user for input, access built-in AutoCAD commands directly, and modify or create objects directly in the drawing database. By creating AutoLISP routines you can add discipline-specific or workflow driven commands to AutoCAD. Some of the standard AutoCAD commands are actually AutoLISP applications.

You may choose to experiment by entering code at the Command prompt, which allows you to see the results immediately. This makes AutoLISP an easy language to experiment with, regardless of your programming experience.

AutoLISP provides three file formats for applications:

Note: Like-named AutoLISP application files are loaded based on their Modified time stamp; the LSP, FAS, or VLX file with the most recent time stamp is loaded unless you specify the full file name (including the file name extension).

Even if you are not interested in writing AutoLISP applications, the program includes many useful routines. AutoLISP applications are also available for download from the Internet or third-party developers. Knowing how to load and use these routines can enhance your productivity.