Family | Lisp |
---|---|
Designed by | David Betz |
Developers | Autodesk, Basis Software |
First appeared | January 1986; 34 years ago |
Stable release | |
Platform | IA-32 |
OS | Linux |
Dialects | |
Vital-LISP, Visual LISP | |
Influenced by | |
Lisp, XLISP |
Sep 15, 2017 I have been attempting to update our office’s layer system. This would be difficult to do in AutoCAD without resorting to LISP or some programming to insert layers on mass. Creating lots of text on mass is really easy to do in Excel so that would be the program of choice to do this task. Continue reading 'Excel to AutoCAD layers'.
AutoLISP is a dialect of the programming language Lisp built specifically for use with the full version of AutoCAD and its derivatives, which include AutoCAD Map 3D, AutoCAD Architecture and AutoCAD Mechanical.[1] Neither the application programming interface (API) nor the interpreter to execute AutoLISP code are included in the AutoCAD LT product line.[2]
Features[edit]
AutoLISP is a small, dynamically scoped, dynamically typed Lisp language dialect with garbage collection, immutable list structure, and settable symbols, lacking in such regular Lisp features as macro system, records definition facilities, arrays, functions with variable number of arguments or let bindings. Aside from the core language, most of the primitive functions are for geometry, accessing AutoCAD's internal DWG database, or manipulation of graphical entities in AutoCAD. The properties of these graphical entities are revealed to AutoLISP as association lists 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.[3]
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.[3]
History[edit]
AutoLISP was derived from an early version of XLISP, which was created by David Betz.[4] 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 January 31, 2014, Autodesk no longer supports VBA versions older than 7.1. This is part of a long-term process of changing from VBA to .NET for user customizing.[5][6]
AutoLISP has such a strong following that other computer-aided design (CAD) application vendors add it to their products. Bricscad, IntelliCAD 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).[7][8]
1955 | 1960 | 1965 | 1970 | 1975 | 1980 | 1985 | 1990 | 1995 | 2000 | 2005 | 2010 | 2015 | 2019 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LISP 1, 1.5, LISP 2(abandoned) | |||||||||||||
Maclisp | |||||||||||||
Interlisp | |||||||||||||
Lisp Machine Lisp | |||||||||||||
Scheme | R5RS | R6RS | R7RS small | ||||||||||
NIL | |||||||||||||
Franz Lisp | |||||||||||||
Common Lisp | |||||||||||||
Le Lisp | |||||||||||||
T | |||||||||||||
Emacs Lisp | |||||||||||||
AutoLISP | |||||||||||||
OpenLisp | |||||||||||||
PicoLisp | |||||||||||||
EuLisp | |||||||||||||
ISLISP | |||||||||||||
newLISP | |||||||||||||
Racket | |||||||||||||
GNU Guile | |||||||||||||
Visual LISP | |||||||||||||
Qi, QiII | Shen | ||||||||||||
Clojure | |||||||||||||
Arc | |||||||||||||
LFE | |||||||||||||
Hy |
Examples[edit]
A simple Hello world program in AutoLISP would be:
Note the final line inside the function definition: when evaluated with no arguments, the
princ
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 princ
. Therefore, without the final call to the princ
function, the result of this would be:Hello World!'nHello World!'
The
prin1
function may also be used to achieve the same result.A more complex example might be:
The above code defines a new 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 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[edit]
- ^'AutoLISP'. Retrieved 14 April 2014.
- ^'AutoCAD LT vs. AutoCAD'. Archived from the original on 15 April 2014. Retrieved 14 April 2014.
- ^ ab'AutoLISP Developer's Guide'(PDF). Retrieved 14 April 2014.
- ^'History of AutoLISP'.
- ^'Microsoft Visual Basic for Applications Module FAQ'. Retrieved 14 April 2014.
- ^'VBA support in AutoCAD 2011'. Archived from the original on 15 April 2014. Retrieved 14 April 2014.
- ^'BricsCAD Compare versions'. Archived from the original on 2014-03-15. Retrieved 14 April 2014.
- ^'IntelliCAD CAD Platform – Features and Benefits'. Retrieved 14 April 2014.
External links[edit]
Retrieved from 'https://en.wikipedia.org/w/index.php?title=AutoLISP&oldid=915413231'
Summary
Instructions provided describe how to create a CAD file where ArcGIS features are exported to specific CAD layers using the Export to CAD geoprocessing tool. Using this technique in combination with a seed file with predefined layer symbology provides a simple means of supporting the export of ArcGIS data using a CAD Layering Standard.
Procedure
This procedure uses the Export to CAD geoprocessing tool's extended functionality to control the CAD layer by including a specially named field in the output feature class. When a feature class contains a field that is named, aliased or renamed in a geoprocessing model to the name ('Layer'), valid values in that field are used to control the destination CAD layer name of each exported CAD entity.
It is often useful to populate the feature classes' 'Layer' field with existing layer names that are already included in a CAD seed file. In this way, exported entities can take advantage of predefined layer names and any of their default layer symbology to quickly and easily create well-formatted CAD data.
It is often useful to populate the feature classes' 'Layer' field with existing layer names that are already included in a CAD seed file. In this way, exported entities can take advantage of predefined layer names and any of their default layer symbology to quickly and easily create well-formatted CAD data.
- Add a field called 'Layer' to the feature class.
Alternately, use the User Interface (UI) or the Create Field Alias geoprocessing tool to provide a field alias for an existing column with the alias name of 'Layer'.
Another option is to use the field info parameter of the Make Feature Layer geoprocessing tool to temporarily rename a field to 'Layer', which is used to provide the valid CAD layer name values to the Export to CAD tool. - Confirm that the feature class contains valid CAD layer name values in the 'Layer' field, and/or populate the 'Layer' field with valid CAD layer name values.
- Provide the feature class as input to the Export to CAD tool.
- Optionally, include the corresponding Microstation or AutoCAD seed file that contains the same layer names as those referenced in the 'Layer' field of the input feature class(es). A seed file can contain default layering symbology such as a layer's default color, linestyle, line width, and so forth.
Alternately, specify the CAD layer properties by including the specially named CAD fields in the input feature class(es). By including the specially named CAD fields 'LyrName', 'LyrColor', and so forth, new CAD layers can be created with the specified layer properties. This only works when creating a new CAD file where the referenced layer names do not already exist in the CAD seed file.
Specifying the CAD layer properties is a way to control the output CAD symbology by allowing entities to assume the values of the layer symbol properties without explicitly defining each entity's color, line style or other graphic properties. This works well if all or most of the entities on a CAD layer use the same symbology. - Execute the Export to CAD tool with the valid input parameters.
Article ID: 000007543
Software: ArcGIS-ArcInfo 9.3.1, 9.3, 9.2, 9.1, 9.0