AutoLISP: The Complete Guide — Chapter 1 / 16

Introduction — What Is AutoLISP?

AutoLISP is the programming language built into AutoCAD since 1986. It allows you to automate tasks, create custom commands, and extend the software's capabilities. Before diving into the syntax and code examples, let's take a moment to understand where this language comes from and why it was chosen.

LISP: A Language Born in 1958

LISP (LISt Processing) was invented by John McCarthy at MIT in 1958. It is the second oldest programming language still in use today, right after FORTRAN (1957).

John McCarthy

Photo: null0, CC BY 2.0

Originally, LISP was designed for artificial intelligence research. Its name — list processing — reflects its ability to manipulate complex, heterogeneous data structures, which fundamentally set it apart from the numerical languages of the time such as FORTRAN or COBOL.

LISP introduced many concepts that are now ubiquitous in modern languages:

  • Garbage collection for automatic memory management
  • First-class functions: functions can be passed as arguments or returned by other functions
  • Recursion as a core programming mechanism
  • Dynamic typing
  • Conditional expressions (the ancestor of if/else)

Why Autodesk Chose LISP

In February 1985, John Walker, co-founder of Autodesk, wrote an internal document explaining the choice of LISP as AutoCAD's extension language. This choice, which debuted in AutoCAD 2.1, was both strategic and pragmatic.

AutoCAD in the 1980s

Here are the main reasons behind this decision:

A Language Built for the Design Process

LISP excelled at manipulating heterogeneous objects organized into variable-size groups — exactly what you find in a CAD drawing where lines, arcs, blocks, attributes, and dimensions coexist. Numerical languages like FORTRAN, designed for scientific computing, were far less suited to this type of work.

Moreover, LISP was naturally suited to the exploratory interaction that characterizes the design process. An engineer doesn't always know in advance which approach will work; they need to try, test, and adjust quickly. LISP's interactive evaluation was a perfect match for this way of working.

A Language Recognized in Artificial Intelligence

In 1985, artificial intelligence was at the forefront of technology news. LISP was the go-to language in this field, with decades of success in complex systems such as the space shuttle navigation program (NAVEX). Autodesk wanted to benefit from this positive association.

However, the Autodesk team also had a concern: that users might perceive LISP as an esoteric language, reserved for specialists. That's why AutoLISP was initially presented under the name "variables and expressions feature," a deliberately more approachable name.

A Language Easy to Learn

Contrary to popular belief, AutoLISP's interactive implementation with its built-in debugging tools made it comparable in difficulty to a BASIC interpreter. Users could test their expressions directly in AutoCAD's command line, without needing a compiler, an external editor, or a complex development environment.

A Bet on the Future

In 1985, companies like Symbolics and Texas Instruments were developing specialized hardware to run LISP at high performance. Autodesk anticipated that CAD applications might one day take advantage of these dedicated machines. Although this prediction didn't come true as expected, the choice of LISP proved remarkably enduring.

From AutoLISP to Visual LISP

Over successive versions of AutoCAD, AutoLISP evolved:

Period Evolution
1986 Introduction of AutoLISP in AutoCAD 2.1
1990s Addition of entity access functions and dialog boxes (DCL)
1997 Emergence of Visual LISP (VLISP) with an integrated development environment (VLIDE)
2000+ Integration of Visual LISP into AutoCAD as the standard environment
2021 Official AutoLISP extension for Visual Studio Code, a modern alternative to VLIDE
2024 AutoLISP support in AutoCAD LT

Visual LISP brought important features such as access to ActiveX/COM objects, a visual debugger, syntax highlighting, and the ability to compile code into protected .fas files. Today, the VLIDE editor is considered obsolete: Autodesk recommends using Visual Studio Code with the official AutoLISP extension, which offers a much more modern development environment (debugging, Git integration, AI support).

AutoLISP Today

Today, AutoLISP remains an essential tool for many AutoCAD users. Even though Autodesk has added other programming interfaces (VBA, .NET/C#, ObjectARX in C++), AutoLISP retains unique advantages:

  • No additional installation: it is built into AutoCAD
  • Direct access from the command line
  • Simple text files (.lsp) that are easy to share and modify
  • Gentle learning curve for non-programmers
  • Active community with decades of code and examples available

AutoLISP is not designed for developing complex applications with elaborate graphical interfaces — for that, .NET or ObjectARX would be preferred. But for automating repetitive tasks, creating custom commands, or manipulating drawings through scripts, it remains the most efficient and accessible choice.

What You Will Learn

In this tutorial, we will explore AutoLISP step by step:

  1. Getting started: testing expressions directly in AutoCAD's command line
  2. The syntax: understanding prefix notation and nesting parentheses
  3. Mathematical operations: calculating with +, -, *, /
  4. Variables and data types: storing and manipulating values
  5. Functions: creating your own commands
  6. Control structures: making decisions in your code
  7. Lists: mastering LISP's fundamental data structure
  8. Interacting with the user: collecting points, distances, and text with the get* functions
  9. Interacting with the drawing: creating and modifying AutoCAD entities
  10. Reading and writing files: exporting and importing data
  11. Error handling: protecting your programs with *error*
  12. Symbols and lambdas: understanding advanced concepts
  13. Extended data and dictionaries: attaching custom data to entities
  14. Reactors: automatically responding to events in AutoCAD
  15. ActiveX interoperability: controlling external applications from AutoLISP

No programming experience is required. All you need is a copy of AutoCAD (or an AutoCAD LT version 2024 or later).

Let's get started!


Helping hand Need an AutoCAD (AutoLISP, ObjectARX, .NET, VBA) development? Contact me for a free quote.