Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
AutoLISP
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|LISP computer programming language variant}} {{Infobox programming language | name = AutoLISP | logo = <!-- Filename only. --> | logo caption = | screenshot = AutoLISP Code Example.png | screenshot caption = | paradigms = [[Multi-paradigm programming language|Multi-paradigm]]: [[Functional programming|functional]], [[Procedural programming|procedural]], [[Reflective programming|reflective]], [[Metaprogramming|meta]] | family = [[Lisp (programming language)|Lisp]] | designer = David Betz | developers = [[Autodesk]], Basis Software | released = {{Start date and age|1986|01}} | latest release version = 13 | latest release date = {{Start date and age|1995|02}} | discontinued = Yes | typing = [[dynamic typing|dynamic]] | scope = dynamic | programming language = | platform = [[IA-32]] | operating system = [[Linux]] | license = | file ext = | file format = <!-- or: | file formats = --> | website = <!-- {{URL|www.example.com}} --> | implementations = | dialects = Vital-LISP, Visual LISP | influenced by = [[Lisp (programming language)|Lisp]], XLISP | influenced = }} '''AutoLISP''' is a [[Dialect (computing)|dialect]] of the programming language [[Lisp (programming language)|Lisp]] built specifically for use with the full version of [[AutoCAD]] and its derivatives, which include ''[[AutoCAD Civil 3D]]'', ''[[AutoCAD Map 3D]]'', ''[[AutoCAD Architecture]]'' and ''[[AutoCAD Mechanical]]''.<ref name=caddsoft>{{cite web |url=http://www.caddsoftsolutions.com/AutoLISP.htm |title=AutoLISP |access-date=14 April 2014}}</ref> Neither the [[application programming interface]] (API) nor the [[Interpreter (computing)|interpreter]] to execute AutoLISP code is included in the AutoCAD LT product line (up to Release 2023, AutoCAD LT 2024 includes AutoLISP).<ref name=lt>{{cite web |url=http://www.autodesk.com/products/autodesk-autocad-lt/compare/compare-products |title=AutoCAD LT vs. AutoCAD |access-date=14 April 2014 |archive-url=https://web.archive.org/web/20140415063148/http://www.autodesk.com/products/autodesk-autocad-lt/compare/compare-products |archive-date=15 April 2014 |url-status=dead }}</ref> A subset of AutoLISP functions is included in the browser-based AutoCAD web app. ==Features== AutoLISP is a small, dynamically [[Scope (computer science)|scoped]], dynamically typed Lisp language dialect with [[Garbage collection (computer science)|garbage collection]], immutable list structure, and settable symbols, lacking in such regular Lisp features as [[Macro (computer science)|macro]] system, records definition facilities, arrays, functions with variable number of arguments and let bindings. Aside from the core language, most of the primitive functions are for geometry, accessing AutoCAD's internal [[.dwg|DWG]] database, or manipulation of graphical entities in AutoCAD. The properties of these graphical entities are revealed to AutoLISP as [[association list]]s in which values are paired with AutoCAD ''group codes'' that indicate properties such as definitional points, radii, colors, layers, linetypes, etc. AutoCAD loads AutoLISP code from .LSP files.<ref name=documentation>{{cite web |url=http://docs.autodesk.com/ACDMAC/2013/ENU/PDFs/acdmac_2013_autolisp_developers_guide.pdf |title=AutoLISP Developer's Guide |access-date=14 April 2014}}</ref> AutoLISP code can interact with the user through AutoCAD's graphical editor by use of primitive functions that allow the user to pick points, choose objects on screen, and input numbers and other data. AutoLisp also has a built-in [[graphical user interface]] (GUI) mini- or [[domain-specific language]] (DSL), the [[Dialog Control Language]], for creating modal dialog boxes with automated layout, within AutoCAD.<ref name=documentation /> ==History== AutoLISP was derived from an early version of [[XLISP]], which was created by David Betz.<ref>{{cite web |url=http://ronleigh.com/autolisp/ahistory.htm |title=History of AutoLISP|archive-url=https://web.archive.org/web/20250126052454/http://ronleigh.com/autolisp/ahistory.htm|archive-date=2025-01-26|url-status=dead|access-date=2025-03-17}}</ref> The language was introduced in AutoCAD Version 2.18 in January 1986, and continued to be enhanced in successive releases up to release 13 in February 1995. After that, its development was neglected by [[Autodesk]] in favor of more fashionable development environments like [[Visual Basic for Applications]] (VBA), [[.NET Framework]], and [[ObjectARX]]. However, it has remained AutoCAD's main user customizing language. ''Vital-LISP'', a considerably enhanced version of AutoLISP including an [[integrated development environment]] (IDE), [[debugger]], [[compiler]], and [[ActiveX]] support, was developed and sold by third-party developer Basis Software. Vital LISP was a superset of the existing AutoLISP language that added VBA-like access to the AutoCAD object model, reactors (event handling for AutoCAD objects), general ActiveX support, and some other general Lisp functions. Autodesk purchased this, renamed it ''Visual LISP'', and briefly sold it as an add-on to AutoCAD release 14 released in May 1997. It was incorporated into AutoCAD 2000 released in March 1999, as a replacement for AutoLISP. Since then, [[Autodesk]] has ceased major enhancements to Visual LISP and focused more effort on VBA and [[.NET]], and [[C++]]. {{As of|2014|January|31|df=US}}, Autodesk ended support for VBA versions before 7.1, as part of a long-term process of changing from VBA to .NET for user customizing.<ref name=vba>{{cite web |url=http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770215 |title=Microsoft Visual Basic for Applications Module FAQ |access-date=14 April 2014}}</ref><ref name=vbasupport>{{cite web |url=http://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/VBA-support-in-AutoCAD-2011.html |title=VBA support in AutoCAD 2011 |access-date=14 April 2014 |archive-url=https://web.archive.org/web/20140415063735/http://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/VBA-support-in-AutoCAD-2011.html |archive-date=15 April 2014 |url-status=dead }}</ref> AutoLISP has such a strong following that other [[computer-aided design]] (CAD) application vendors add it to their products. [[Bricscad]], [[IntelliCAD]], DraftSight and others have AutoLISP functionality, so that AutoLISP users can consider using them as an alternative to AutoCAD. Most development involving AutoLISP since AutoCAD 2000 is performed within Visual LISP since the original AutoLISP engine was replaced with the Visual LISP engine. There are thousands of utilities and applications that have been developed using AutoLISP or Visual LISP (distributed as LSP, FAS and VLX files).<ref name=bricscad>{{cite web |url=http://www.bricsys.com/en_INTL/bricscad/comparison/ |access-date=14 April 2014 |title=BricsCAD Compare versions |archive-url=https://web.archive.org/web/20140315233311/http://www.bricsys.com/en_INTL/bricscad/comparison/|archive-date=2014-03-15 |url-status=dead }}</ref><ref name=IntelliCAD>{{cite web |url=http://www.intellicad.org/intellicad-features-and-benefits |title=IntelliCAD CAD Platform – Features and Benefits |access-date=14 April 2014}}</ref> {{Lisp}} ==Examples== A simple [[Hello world program]] in AutoLISP would be: <syntaxhighlight lang="lisp" line> (defun hello ( ) (princ "\nHello World!") (princ) ) </syntaxhighlight> Note the final line inside the function definition: when evaluated with no arguments, the <code>princ</code> function returns a null symbol, which is not displayed by the AutoCAD [[command-line interface]]. As the AutoCAD command line functions as a [[read–eval–print loop]] (REPL), this would normally print "Hello World!" to the command line, followed immediately by the return value of the call to <code>princ</code>. Therefore, without the final call to the <code>princ</code> function, the result of this would be: :<code>Hello World!"\nHello World!"</code> The <code>prin1</code> function may also be used to achieve the same result. A more complex example is: <syntaxhighlight lang="lisp" line> (defun c:pointlabel ( / pnt ) (if (setq pnt (getpoint "\nSpecify point: ")) (progn (entmake (list '(0 . "POINT") (cons 10 (trans pnt 1 0)) ) ) (entmake (list '(0 . "TEXT") (cons 10 (trans (cons (+ (car pnt) 0.6) (cdr pnt)) 1 0)) (cons 40 (getvar 'textsize)) (cons 1 (strcat "X:" (rtos (car pnt)) " Y:" (rtos (cadr pnt)))) ) ) ) ) (princ) ) </syntaxhighlight> The above code defines a new [[Subroutine|function]] which generates an AutoCAD point object at a given point, with a one-line text object displaying the X and Y coordinates beside it. The name of the function includes a special prefix 'c:', which causes AutoCAD to recognize the function as a regular command. The user, upon typing 'pointlabel' at the AutoCAD command line, would be prompted to pick a point, either by typing the X and Y coordinates, or clicking a location in the drawing. The function would then place a marker at that point, and create a one-line text object next to it, containing the X and Y coordinates of the point expressed relative to the active User Coordinate System (UCS). The function requires no [[Parameter (computer programming)|parameters]], and contains one [[local variable]] ('pnt'). The above example could also be written using built-in AutoCAD commands to achieve the same result, however this approach is susceptible to changes to the command prompts between AutoCAD releases. ==References== {{Reflist}} ==External links== *[http://www.faqs.org/faqs/CAD/autolisp-faq/ AutoLISP FAQ] {{AutoCAD related articles}} {{Lisp programming language}} {{Authority control}} [[Category:AutoCAD|Lisp]] [[Category:Dynamically scoped programming languages]] [[Category:Lisp programming language family]] [[Category:Computer-aided design software]] [[Category:Scripting languages]] <!-- Hidden categories below --> [[Category:Articles with example Lisp (programming language) code]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:As of
(
edit
)
Template:Authority control
(
edit
)
Template:AutoCAD related articles
(
edit
)
Template:Cite web
(
edit
)
Template:Infobox programming language
(
edit
)
Template:Lisp
(
edit
)
Template:Lisp programming language
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)