eplisp

What Is AutoLISP? What LISP Files Do in AutoCAD and How

AutoLISP is the programming language used to add new commands to AutoCAD and automate repetitive work.

What is AutoLISP?

What is AutoLISP? In short, it is a programming language from the LISP family that runs inside AutoCAD. It can read objects in a drawing, create new ones, change existing ones and run AutoCAD commands in sequence.

Small programs written in AutoLISP are usually called LISP routines, or just LISPs. From the user's point of view, a LISP routine is a new command added to AutoCAD.

What is a .lsp file?

A .lsp file is a plain text file that contains AutoLISP code. You can open it in Notepad and read it. When AutoCAD loads the file with APPLOAD, it runs the code and makes the defined commands available.

Compiled .fas and .vlx files are AutoLISP programs too, but you cannot read their contents. All eplisp tools are readable .lsp files.

Why people use LISP routines

AutoCAD's built-in commands are general purpose. For repetitive, trade-specific tasks, a LISP routine can turn minutes of manual work into a few clicks.

  • Counting blocks in a drawing to build a bill of materials.
  • Adding up the total length of many lines.
  • Changing layers, colors or text in bulk.
  • Writing results to a CSV file for Excel.

How c:NAME functions become commands

AutoLISP functions are defined with defun. When a function name starts with c:, AutoCAD registers it as a command, and you can run it by typing its name at the command line. The example below defines a command called HELLO.

Functions without the c: prefix do not show up as commands; they can only be called from other LISP code. Command names are not case sensitive.

(defun c:HELLO () (princ "\nHello AutoCAD") (princ))

Does LISP work in AutoCAD LT?

For many years AutoCAD LT had no LISP support. AutoLISP arrived in AutoCAD LT 2024. In AutoCAD LT 2023 and earlier, .lsp files cannot be loaded.

Full AutoCAD and GstarCAD both support LISP.

A short history

AutoLISP was added to AutoCAD in the mid-1980s and quickly became the most common way for users to adapt AutoCAD to their own work. Visual LISP later added a development environment and ActiveX functions.

The language is old but still supported, and many routines written years ago still run unchanged in current AutoCAD releases.