AutoCAD and AutoLISP are Two Separate Programs

Though AutoLISP is an inherent part of AutoCAD, it is in fact an entirely separate program with different executable files, its own set of commands and syntax. AutoLISP expressions, however, can be typed in directly at the AutoCAD Command: prompt, and hence there needs to be a means of differentiating AutoLISP expressions from AutoCAD expressions.

To initiate an AutoLISP expression, it must begin with either an open parenthesis “(” or an exclamation point “!”. When AutoCAD sees an expression that begins with either of these, it knows that what follows is not an AutoCAD expression, but an AutoLISP expression, and it sends the expression to the AutoLISP executables to be evaluated.

  • An open parenthesis “(” starts a AutoLISP expression. The expression must also have a closed parenthesis “)” at the end.
  • An exclamation point “!” asks AutoLISP to give the value of a symbol specified by an AutoLISP expression.

Here are several examples of AutoLISP expressions that could be typed in at the Command line:

(setq A 5)
!A
!a
(getpoint “Enter point:”)
(command “line” PT1 PT2 PT3 “c”)

What makes AutoLISP so useful is its tight integration with AutoCAD and the ability to easily share information between the two programs. We can even run AutoCAD commands directly within AutoLISP, as we shall see by the end of this chapter.

See also  Executing AutoCAD Commands through AutoLISP
The Visual LISP Programming Environment
Visual LISP (VLISP) is an editing and debugging program designed to facilitate the creation of AutoLISP routines. We will be using VLISP as our text editor and will learn many of the tools that speed the formation of a working program including formatting, checking syntax and values, and compiling the finished product.
Back to top button