AutoCAD AutoLISP Functions - Commands
AutoCAD AutoLISP Functions - Commands
AutoCAD AutoLISP Functions - Commands
Function/Command
Application-handling functions
1 (arx)
2 (arxload application [onfailure])
3 (arxunload application [onfailure])
4 (autoarxload filename cmdlist)
5 (autoload filename cmdlist)
6 (initdia [dialogflag])
7 (load filename [onfailure])
8 (showhtmlmodalwindow uri)
9 (startapp appcmd file)
10 (vl-load-all filename)
11 (vl-vbaload "filename")
12 (vl-vbarun "macroname")
(vlax-add-cmd "global-name" 'func-sym [“local-name"
13 cmd-flags])
Arithmetic functions
1 (+ [number number ...])
2 (- [number number ...])
3 (* [number number ...])
4 (/ [number number ...])
5 (~ int)
6 (1+ number)
7 (1- number)
8 (abs number)
9 (atan num1 [num2])
10 (cos ang)
11 (exp number)
12 (expt base power)
13 (fix number)
14 (float number)
15 (gcd int1 int2)
16 (log number)
17 (logand [int int ...])
18 (logior [int int ...])
Error-handling functions
1 (alert string)
2 (*error* string)
3 (exit)
4 (*pop-error-mode*)
5 (*push-error-using-command*)
6 (*push-error-using-stack*)
7 (quit)
8 (vl-catch-all-apply 'function list)
9 (vl-catch-all-error-message error-obj)
10 (vl-catch-all-error-p arg)
Function-handling functions
1 (apply function lst)
2 (defun sym ([arguments] [/variables ...]) expr ... )
3 (defun-q sym ([arguments] [/ variables ...]) expr ...)
4 (defun-q-list-ref 'function)
5 (defun-q-list-set 'sym list)
6 (eval expr)
7 (lambda arguments expr ...)
8 (progn [expr ...])
9 (trace function ...)
10 (untrace function ...)
1 (acad_strlsort lst)
2 (append lst ...)
3 (assoc item alist)
4 (car lst)
5 (cdr lst)
6 (cons new-first-element lst)
7 (foreach name lst [expr ...])
8 (last lst)
9 (length lst)
10 (list [expr ...])
11 (listp item)
12 (mapcar function list1 ... listn)
14 (nth n lst)
15 (reverse lst)
16 (subst newitem olditem lst)
17 (vl-consp list-variable)
18 (vl-every predicate-function list [ more-lists ...])
19 (vl-list* object [more-objects ...])
20 (vl-list->string char-codes-list)
21 (vl-list-length list-or-cons-object)
22 (vl-member-if predicate-function list)
23 (vl-member-if-not predicate-function list)
24 (vl-position symbol list)
25 (vl-remove element-to-remove list)
26 (vl-remove-if predicate-function list)
27 (vl-remove-if-not predicate-function list)
28 (vl-some predicate-function list [more-lists ...])
29 (vl-sort list comparison-function)
30 (vl-sort-i list comparison-function)
31 (vl-string->list string)
String-handling functions
1 (read [string])
2 (strcase string [which])
3 (strcat [string1 [string2 ...])
4 (strlen [string ...])
5 (substr string start [length])
6 (vl-prin1-to-string object)
7 (vl-princ-to-string object)
8 (vl-string->list string)
9 (vl-string-elt string position)
10 (vl-string-left-trim character-set string)
11 (vl-string-mismatch str1 str2 [pos1 pos2 ignore-case-p])
12 (vl-string-position char-code str [ start-pos [from-end-p]])
13 (vl-string-right-trim character-set string)
14 (vl-string-search pattern string [ start-pos])
15 (vl-string-subst new-str pattern string [start-pos])
16 (vl-string-translate source-set dest-set str)
17 (vl-string-trim char-set str)
18 (wcmatch string pattern)
Symbol-handling functions
1 (atom item)
2 (atoms-family format [symlist])
3 (boundp sym)
4 (not item)
5 (null item)
6 (numberp item)
7 (quote expr)
8 (set sym expr)
9 (setq sym1 expr1 [sym2 expr2 ...])
10 (type item)
11 (vl-symbol-name symbol)
12 (vl-symbol-value symbol)
13 (vl-symbolp object)
Description
Application-handling functions
Returns a list of the currently loaded ObjectARX applications
Loads an ObjectARX application
Unloads an ObjectARX application
Predefines command names to load an associated ObjectARX file
Predefines command names to load an associated AutoLISP file
Forces the display of the next command's dialog box
Evaluates the AutoLISP expressions in a file
Displays a modal dialog box with a specified URI (Uniform Resource
Identifier)
Starts a Windows application
Loads a file into all open AutoCAD documents
Loads a VBA project
Runs a VBA macro
Adds commands to the AutoCAD built-in command set
Arithmetic functions
Returns the sum of all numbers
Subtracts the second and following numbers from the first and returns
the difference
Returns the product of all numbers
Divides the first number by the product of the remaining numbers and
returns the quotient
Returns the bitwise NOT (1's complement) of the argument
Returns the argument increased by 1 (incremented)
Returns the argument reduced by 1 (decremented)
Returns the absolute value of the argument
Returns the arctangent of a number in radians
Returns the cosine of an angle expressed in radians
Returns the constant e (a real) raised to a specified power (the natural
antilog)
Returns a number raised to a specified power
Returns the conversion of a real into the nearest smaller integer
Returns the conversion of a number into a real
Returns the greatest common denominator of two integers
Returns the natural log of a number as a real
Returns the result of the logical bitwise AND of a list of integers
Returns the result of the logical bitwise inclusive OR of a list of integers
15 (vports)
File-handling functions
1 (close file-desc)
2 (findfile filename)
3 (findtrustedfile filename)
4 (open filename mode)
5 (read-char [file-desc])
6 (read-line [file-desc])
7 (vl-directory-files [ directory pattern directories])
8 (vl-file-copy "source-filename" "destination-filename" [append])
9 (vl-file-delete "filename")
10 (vl-file-directory-p "filename")
11 (vl-file-rename "old-filename" "new-filename")
12 (vl-file-size "filename")
13 (vl-file-systime "filename")
14 (vl-filename-base "filename")
15 (vl-filename-directory "filename")
16 (vl-filename-extension "filename")
17 (vl-filename-mktemp ["pattern" "directory" "extension"])
18 (write-char num [file-desc])
19 (write-line string [file-desc])
Geometric functions
1 (angle pt1 pt2)
2 (distance pt1 pt2)
3 (inters pt1 pt2 pt3 pt4 [onseg])
4 (osnap pt mode)
6 (textbox elist)
13 (nentsel [msg])
7 (vlax-product-key)
9 (vlax-user-product-key)
Description
Conversion functions
Converts a string representing an angle into a real (floating-point)
value in radians
Converts an angular value in radians into a string
Returns the conversion of the first character of a string into its ASCII
character code (an integer)
Returns the conversion of a string into a real
Returns the conversion of a string into an integer
Returns the conversion of an integer representing an ASCII character
code into a single-character string
Converts a value from one unit of measurement to another
Converts a string that represents a real (floating-point) value into a
real value
Returns the conversion of an integer into a string
Converts a number into a string
Translates a point (or a displacement) from one coordinate system to
another
Device access functions
Reads values from any of the AutoCAD input devices
Retrieves and sets digitizer (tablet) calibrations
Display control functions
Displays the AutoCAD graphics screen
Draws a vector between two points, in the current viewport
Writes text to the status line or to screen menu areas
Draws multiple vectors on the graphics screen
Issues menu commands, or sets and retrieves menu item status
Verifies that a menu group is loaded
Prints an expression to the command line or writes an expression to
an open file
Prints an expression to the command line, or writes an expression to
an open file
Prints an expression to the command line, or writes an expression to
an open file
Displays a string on your screen's prompt area
Redraws the current viewport or a specified object (entity) in the
current viewport
Prints a newline to the Command line
Switches from the graphics screen to the text screen
Switches from the graphics screen to the text screen (like the
AutoCAD Flip Screen function key)
Returns a list of viewport descriptors for the current viewport
configuration
File-handling functions
Closes an open file
Searches the AutoCAD library path for the specified file
Searches the AutoCAD trusted file paths for the specified file
Opens a file for access by the AutoLISP I/O functions
Returns the decimal ASCII code representing the character read from
the keyboard input buffer or from an open file
Reads a string from the keyboard or from an open file
Lists all files in a given directory
Copies or appends the contents of one file to another file
Deletes a file
Determines if a file name refers to a directory
Renames a file
Determines the size of a file, in bytes
Returns last modification time of the specified file
Returns the name of a file, after stripping out the directory path and
extension
Returns the directory path of a file, after stripping out the name and
extension
Returns the extension from a file name, after stripping out the rest of
the name
Calculates a unique file name to be used for a temporary file
Writes one character to the screen or to an open file
Writes a string to the screen or to an open file
Geometric functions
Returns an angle in radians of a line defined by two endpoints
Returns the 3D distance between two points
Finds the intersection of two lines
Returns a 3D point that is the result of applying an Object Snap mode
to a specified point
Returns the UCS 3D point at a specified angle and distance from a
point
Measures a specified text object, and returns the diagonal coordinates
of a box that encloses the text
Query and command functions
Displays the standard AutoCAD Color Selection dialog box
Invokes the Help facility (obsolete)
Executes an AutoCAD command
Executes an AutoCAD command and the supplied input
Retrieves application data from the AppData section of
the acadXXXX.cfg file
Retrieves the localized or English name of an AutoCAD command
Returns the string value assigned to an environment variable
Retrieves the value of an AutoCAD system variable
Invokes the Help facility
2 (xdroom ename)
3 (xdsize lst)
Object-handling functions
1 (dumpallproperties ename [context])
2 (entdel ename)
3 (entget ename [applist])
4 (entlast)
5 (entmake [elist])
6 (entmakex [elist])
7 (entmod elist)
8 (entnext [ename])
9 (entupd ename)
(getpropertyvalue ename propertyname [or collectionName
10 index name])
11 (handent handle)
(ispropertyreadonly ename propertyname [or collectionName
12 index name])
(setpropertyvalue ename propertyname value [or
13 collectionname index name val])
14 (vlax-dump-object obj)
15 (vlax-erased-p obj)
16 (vlax-get-acad-object)
17 (vlax-method-applicable-p obj method)
18 (vlax-object-released-p obj)
19 (vlax-read-enabled-p obj)
20 (vlax-release-object obj)
21 (vlax-typeinfo-available-p obj)
22 (vlax-write-enabled-p obj)
Selection set manipulation functio
1 (ssadd [ename [ss]])
2 (ssdel ename ss)
3 (ssget [mode] [pt1 [pt2]] [pt-list] [filter-list])
4 (ssgetfirst)
5 (sslength ss)
6 (ssmemb ename ss)
7 (ssname ss index)
8 (ssnamex ss index)
9 (sssetfirst gripset [pickset])
7 (namedobjdict)
1 (vlax-curve-getArea curve-obj)
2 (vlax-curve-getClosestPointTo curve-obj givenPnt [extend])
(vlax-curve-getClosestPointToProjection curve-obj givenPnt
3 normal [extend])
17 (vlax-curve-isPeriodic curve-obj)
18 (vlax-curve-isPlanar curve-obj)
Dictionary functions
1 (vlax-ldata-delete dict key)
2 (vlax-ldata-get dict key [ default-data])
3 (vlax-ldata-list dict)
4 (vlax-ldata-put dict key data)
5 (vlax-ldata-test data)
Functions for handling drawing ob
1 (vlax-create-object "prog-id")
2 (vlax-dump-object obj)
3 (vlax-erased-p obj)
4 (vlax-get-acad-object)
5 (vlax-get-object "prog-id")
6 (vlax-get-or-create-object "prog-id")
1 (vl-load-com)
2 (vlr-acdb-reactor data callbacks)
3 (vlr-add obj)
4 (vlr-added-p obj)
5 (vlr-beep-reaction [args])
6 (vlr-command-reactor data callbacks)
7 (vlr-current-reaction-name)
8 (vlr-data obj)
9 (vlr-data-set obj data)
10 (vlr-deepclone-reactor obj data)
11 (vlr-docmanager-reactor obj data)
12 (vlr-dwg-reactor obj data)
20 (vlr-notification reactor)
21 (vlr-object-reactor owners data callbacks)
22 (vlr-owner-add reactor owner)
23 (vlr-owner-remove reactor owner)
24 (vlr-owners reactor)
25 (vlr-pers reactor)
26 (vlr-pers-list [reactor])
27 (vlr-pers-p reactor)
28 (vlr-pers-release reactor)
29 (vlr-reaction-name reactor-type)
30 (vlr-reaction-set reactor event function)
31 (vlr-reactions reactor)
32 (vlr-reactors [reactor-type ...])
33 (vlr-remove reactor)
34 (vlr-remove-all reactor-type)
35 (vlr-set-notification reactor 'range)
4 (vl-doc-ref symbol)
5 (vl-doc-set symbol value)
6 (vl-exit-with-error "msg")
7 (vl-exit-with-value value)
8 (vl-list-exported-functions [“appname”])
9 (vl-list-loaded-vlx)
10 (vl-unload-vlx "appname")
11 (vl-vlx-loaded-p "appname")
Namespace communication func
1 (vl-bb-ref 'variable)
2 (vl-bb-set 'variable value)
3 (vl-load-all "filename")
4 (vl-propagate 'variable)
Description
Collection manipulation functions
Iterates through a collection of objects, evaluating each expression (Visual LISP
Function)
Applies a function to all objects in a collection
Data conversion functions
Creates an ActiveX-compatible 3D point structure
Transforms entity to VLA-object
Creates a safearray
Creates a variant data type
Stores elements in a safearray
Returns the number of dimensions in a safearray object
Returns an element from an array
Returns the lower boundary (starting index) of a dimension of an array
Returns the upper boundary (end index) of a dimension of an array
Adds or updates an element in an array
Returns the data type of a safearray
Returns the elements of a safearray in list form
Returns a suitable representation for a 4 x 4 transformation matrix to be used in
VLA methods
Returns the value of a variant after changing it from one data type to another
Returns the data type of a variant
Returns the value of a variant
Transforms a VLA-object to an AutoLISP entity
Method invocation functions
Calls the specified method of an object
Determines if an object supports a particular method
ActiveX Object-handling functions
Lists an object's methods and properties
Determines whether an object was erased
Retrieves the top-level AutoCAD application object for the current AutoCAD
session
Determines if an object supports a particular method
Determines if an object has been released
Determines whether an object can be read
Releases a graphical object
Determines whether type library information is present for the specified type of
object
Determines whether an AutoCAD drawing object can be modified
Property-handling functions
Low-level property get function. May be used for custom ActiveX object
Determines whether an object has a specified property
Low-level property set function
Reactor functions
Loads AutoLISP reactor support functions and other AutoLISP extensions
Constructs a database (global) reactor object
Enables a disabled reactor object
Tests to determine whether a reactor object is enabled
Produces a beep sound
Constructs an editor reactor that notifies of a command event
Returns the name (symbol) of the current event, if called from within a reactor's
callback
Returns application-specific data associated with a reactor
Overwrites application-specific data associated with a reactor
Constructs an editor reactor object that provides notification of deep clone
events
Constructs a reactor object that provides notification of MDI-related events
Constructs an editor reactor object that provides notification of a drawing event
(for example, opening or closing a drawing file)
Constructs an editor reactor object that notifies of an event related to reading or
writing of a DXF file
Constructs an editor (global) reactor object
Constructs an editor reactor object that notifies of an event related to block
insertion
Constructs a linker (global) reactor object
Constructs an editor reactor object that notifies of a LISP event
Constructs an editor reactor object that does not fall under any of the other
editor reactor types
Constructs an editor reactor object that provides notification of a mouse event
(for example, a double-click)
Determines whether or not a reactor's callback function will execute if its
associated namespace is not active
Constructs an object reactor object
Adds an object to the list of owners of an object reactor
Removes an object from the list of owners of an object reactor
Returns the list of owners of an object reactor
Makes a reactor persistent
Returns a list of persistent reactors in the current drawing
Determines whether or not a reactor is persistent
Makes a reactor transient
Returns a list of all callback conditions for this reactor type
Adds or replaces a callback function in a reactor
Returns a list of pairs ( event-name . callback_function) for the reactor
Returns a list of reactors of the specified types
Disables a reactor
Disables all reactors of the specified type
Defines whether or not a reactor's callback function will execute if its associated
namespace is not active
Constructs an editor reactor object that provides notification of a change to a
system variable
Constructs an editor reactor object that provides notification of a change to the
bitmaps in a toolbar
A pre-defined callback function that prints one or more callback arguments in
the Trace window
Returns a symbol representing the reactor type
Returns a list of all reactor types
Constructs an editor reactor object that provides notification of an undo event
Constructs an editor reactor object that provides notification of an event related
to writing a block
Constructs an editor reactor object that notifies of an event related to moving or
sizing an AutoCAD window
Constructs an editor reactor object that provides notification of an event related
to attaching or modifying XREF
VLX namespace functions
Imports ADS-DEFUN functions into a separate-namespace VLX
9 *push-error-using-command*
10 *push-error-using-stack*
11 > (greater_than)
12 >= (greater_than_or_equal_to)
13 < (less_than)
14 <= (less_than_or_equal_to)
15 ~ (bitwise_not)
16 1- (decrement)
17 1+ (increment)
Description
Returns the sum of all numbers
Subtracts the second and following numbers from the first and returns
the difference
Compares arguments for numerical equality
Divides the first number by the product of the remaining numbers and
returns the quotient
Returns the product of all numbers
A user-definable error-handling function
Error-handling function that ends the previous call to *push-error-
using-command* or *push-error-using-stack*
Error-handling function that indicates the use of the command
function within a custom *error* handler
Error-handling function that indicates the use of variables from the
AutoLISP stack within a custom *error* handler
Returns T if each argument is numerically greater than the argument
to its right; otherwise returns nil
Returns T if each argument is numerically greater than or equal to the
argument to its right; otherwise returns nil
Returns T if each argument is numerically less than the argument to
its right; otherwise nil
Returns T if each argument is numerically less than or equal to the
argument to its right; otherwise returns nil
Returns the bitwise NOT (1's complement) of the argument
Decrements a number by 1
Increments a number by 1
Special remarks if any