Auto - Visual Lisp Help PDF
Auto - Visual Lisp Help PDF
==========
Operators
==========
(add)
(subtract)
(*)
(divide)
(equal to)
(not equal to)
(less than)
(less than or equal to)
(greater than)
(greater than or equal to)
(bitwise NOT)
(increment)
(decrement)
============
A Functions
============
abs
acad_colordlg
acad_helpdlg
acad_strlsort
acdimenableupdate
acet-attsync
acet-layerp-mode
acet-layerp-mark
acet-laytrans
acet-ms-to-ps
acet-ps-to-ms
action_tile
add_list
alert
alloc
and
angle
angtof
angtos
append
apply
arx
arxload
arxunload
ascii
assoc
atan
atof
atoi
atom
atoms-family
autoarxload
autoload
============
B Functions
============
Boole
boundp
============
C Functions
============
caddr
cadr
car
cdr
chr
client_data_tile
close
command
cond
cons
cos
cvunit
============
D Functions
============
defun
defun-q
defun-q-list-ref
https://www.theswamp.org/Sources/doc/avlisp/#trans 1/300
5/8/23, 12:24 PM Auto/Visual lisp help
defun-q-list-set
dictadd
dictnext
dictremove
dictrename
dictsearch
dimx_tile
dimy_tile
distance
distof
done_dialog
============
E Functions
============
end_image
end_list
entdel
entget
entlast
entmake
entmakex
entmod
entnext
entsel
entupd
eq
equal
error_function (*error*)
eval
exit
exp
expand
expt
============
F Functions
============
fill_image
findfile
fix
float
foreach
function
============
G Functions
============
gc
gcd
get_attr
get_tile
getangle
getcfg
getcname
getcorner
getdist
getenv
getfiled
getint
getkword
getorient
getpoint
getreal
getstring
getvar
graphscr
grclear
grdraw
grread
grtext
grvecs
============
H Functions
============
handent
help
============
I Functions
============
if
initdia
initget
inters
itoa
============
L Functions
============
https://www.theswamp.org/Sources/doc/avlisp/#trans 2/300
5/8/23, 12:24 PM Auto/Visual lisp help
lambda
last
layoutlist
length
list
listp
load
load_dialog
log
logand
logior
lsh
============
M Functions
============
mapcar
max
mem
member
menucmd
menugroup
min
minusp
mode_tile
============
N Functions
============
namedobjdict
nentsel
nentselp
new_dialog
not
nth
null
numberp
============
O Functions
============
open
or
osnap
============
P Functions
============
polar
prin1
princ
print
progn
prompt
============
Q Functions
============
quit
quote
============
R Functions
============
read
read-char
read-line
redraw
regapp
rem
repeat
reverse
rtos
============
S Functions
============
set
set_tile
setcfg
setenv
setfunhelp
setq
setvar
setview
sin
slide_image
snvalid
sqrt
ssadd
ssdel
ssget
https://www.theswamp.org/Sources/doc/avlisp/#trans 3/300
5/8/23, 12:24 PM Auto/Visual lisp help
ssgetfirst
sslength
ssmemb
ssname
ssnamex
sssetfirst
startapp
start_dialog
start_image
start_list
strcase
strcat
strlen
subst
substr
============
T Functions
============
tablet
tblnext
tblobjname
tblsearch
term_dialog
terpri
textbox
textpage
textscr
trace
trans
type
============
U Functions
============
unload_dialog
untrace
============
V Functions
============
vector_image
ver
vl-acad-defun
vl-acad-undefun
vl-arx-import
vl-bb-ref
vl-bb-set
vl-catch-all-apply
vl-catch-all-error-message
vl-catch-all-error-p
vl-cmdf
vl-consp
vl-copyobjects
vl-directory-files
vl-doc-export
vl-doc-import
vl-doc-ref
vl-doc-set
vl-every
vl-exit-with-error
vl-exit-with-value
vl-file-copy
vl-file-delete
vl-file-directory-p
vl-file-rename
vl-file-size
vl-file-systime
vl-filename-base
vl-filename-directory
vl-filename-extension
vl-filename-mktemp
vl-get-resource
vl-list_star (vl-list*)
vl-list->string
vl-list-exported-functions
vl-list-length
vl-list-loaded-vlx
vl-load-all
vl-load-com
vl-load-reactors
vl-member-if
vl-member-if-not
vl-position
vl-prin1-to-string
vl-princ-to-string
vl-propagate
vl-registry-delete
https://www.theswamp.org/Sources/doc/avlisp/#trans 4/300
5/8/23, 12:24 PM Auto/Visual lisp help
vl-registry-descendents
vl-registry-read
vl-registry-write
vl-remove
vl-remove-if
vl-remove-if-not
vl-some
vl-sort
vl-sort-i
vl-string->list
vl-string-elt
vl-string-left-trim
vl-string-mismatch
vl-string-position
vl-string-right-trim
vl-string-search
vl-string-subst
vl-string-translate
vl-string-trim
vl-symbol-name
vl-symbol-value
vl-symbolp
vl-unload-vlx
vl-vbaload
vl-vbarun
vl-vlx-loaded-p
vlax-3D-point
vlax-add-cmd
vlax-create-object
vlax-curve-getArea
vlax-curve-getClosestPointTo
vlax-curve-getClosestPointToProjection
vlax-curve-getDistAtParam
vlax-curve-getDistAtPoint
vlax-curve-getEndParam
vlax-curve-getEndPoint
vlax-curve-getFirstDeriv
vlax-curve-getParamAtDist
vlax-curve-getParamAtPoint
vlax-curve-getPointAtDist
vlax-curve-getPointAtParam
vlax-curve-getSecondDeriv
vlax-curve-getStartParam
vlax-curve-getStartPoint
vlax-curve-isClosed
vlax-curve-isPeriodic
vlax-curve-isPlanar
vlax-dump-object
vlax-ename->vla-object
vlax-erased-p
vlax-for
vlax-get-acad-object
vlax-get-object
vlax-get-or-create-object
vlax-get-property
vlax-import-type-library
vlax-invoke-method
vlax-ldata-delete
vlax-ldata-get
vlax-ldata-list
vlax-ldata-put
vlax-ldata-test
vlax-make-safearray
vlax-make-variant
vlax-map-collection
vlax-method-applicable-p
vlax-object-released-p
vlax-product-key
vlax-property-available-p
vlax-put-property
vlax-read-enabled-p
vlax-release-object
vlax-remove-cmd
vlax-safearray-fill
vlax-safearray-get-dim
vlax-safearray-get-element
vlax-safearray-get-l-bound
vlax-safearray-get-u-bound
vlax-safearray-put-element
vlax-safearray-type
vlax-safearray->list
vlax-tmatrix
vlax-typeinfo-available-p
vlax-variant-change-type
vlax-variant-type
https://www.theswamp.org/Sources/doc/avlisp/#trans 5/300
5/8/23, 12:24 PM Auto/Visual lisp help
vlax-variant-value
vlax-vla-object->ename
vlax-write-enabled-p
vlisp-compile
vlr-acdb-reactor
vlr-add
vlr-added-p
vlr-beep-reaction
vlr-command-reactor
vlr-current-reaction-name
vlr-data
vlr-data-set
vlr-deepclone-reactor
vlr-docmanager-reactor
vlr-dwg-reactor
vlr-dxf-reactor
vlr-editor-reactor
vlr-insert-reactor
vlr-linker-reactor
vlr-lisp-reactor
vlr-miscellaneous-reactor
vlr-mouse-reactor
vlr-notification
vlr-object-reactor
vlr-owner-add
vlr-owner-remove
vlr-owners
vlr-pers
vlr-pers-list
vlr-pers-p
vlr-pers-release
vlr-reaction-name
vlr-reaction-set
vlr-reactions
vlr-reactors
vlr-remove
vlr-remove-all
vlr-set-notification
vlr-sysvar-reactor
vlr-toolbar-reactor
vlr-trace-reaction
vlr-type
vlr-types
vlr-undo-reactor
vlr-wblock-reactor
vlr-window-reactor
vlr-xref-reactor
vports
============
W Functions
============
wcmatch
while
write-char
write-line
============
X Functions
============
xdroom
xdsize
============
Z Functions
============
zerop
===========================
Externally Defined Commands
===========================
3dsin
3dsout
align
cal
fog
light
lsedit
lslib
lsnew
matlib
mirror3d
render
renderupdate
replay
rmat
rotate3d
rpref
saveimg
https://www.theswamp.org/Sources/doc/avlisp/#trans 6/300
5/8/23, 12:24 PM Auto/Visual lisp help
scene
setuv
showmat
solprof
stats
+ (add)
Arguments
number
A number.
Return Values
The result of the addition. If you supply only one number argument, this
function returns the result of adding it to zero. If you supply no arguments,
the function returns 0.
Examples
(+ 1 2) returns 3
-------------------------------------------------------------------------------
- (subtract)
Subtracts the second and following numbers from the first and returns the
difference
Arguments
number
A number.
Return Values
The result of the subtraction. If you supply more than two number arguments,
this function returns the result of subtracting the sum of the second through
the last numbers from the first number. If you supply only one number argument,
this function subtracts the number from zero, and returns a negative number.
Supplying no arguments returns 0.
Examples
(- 50 40) returns 10
(- 8) returns -8
-------------------------------------------------------------------------------
multiply
https://www.theswamp.org/Sources/doc/avlisp/#trans 7/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
number
A number.
Return Values
The result of the multiplication. If you supply only one number argument, this
function returns the result of multiplying it by one; it returns the number.
Supplying no arguments returns 0.
Examples
(* 2 3) returns 6
(* 3) returns 3
-------------------------------------------------------------------------------
/ (divide)
Divides the first number by the product of the remaining numbers and returns
the quotient
Arguments
number
A number.
Return Values
The result of the division. If you supply more than two number arguments, this
function divides the first number by the product of the second through the last
numbers, and returns the final quotient. If you supply one number argument,
this function returns the result of dividing it by one; it returns the number.
Supplying no arguments returns 0.
Examples
(/ 100 2) returns 50
(/ 100 20 2) returns 2
(/ 4) returns 4
-------------------------------------------------------------------------------
= (equal to)
Arguments
numstr
A number or a string.
https://www.theswamp.org/Sources/doc/avlisp/#trans 8/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
T, if all arguments are numerically equal, nil otherwise. If only one argument
is supplied, = returns T.
Examples
(= 4 4.0) returns T
See Also
-------------------------------------------------------------------------------
Arguments
numstr
A number or a string.
Return Values
T, if no two successive arguments are the same in value, nil otherwise. If only
one argument is supplied, /= returns T.
Note that the behavior of /= does not quite conform to other LISP dialects. The
standard behavior is to return T if no two arguments in the list have the same
value. In AutoLISP, /= returns T if no successive arguments have the same
value; see the examples that follow.
Examples
(/= 10 20) returns T
Note in the last example that although there are two arguments in the list with
the same value, they do not follow one another, and thus /= evaluates to T.
-------------------------------------------------------------------------------
Returns T if each argument is numerically less than the argument to its right,
and returns nil otherwise
Arguments
numstr
A number or a string.
https://www.theswamp.org/Sources/doc/avlisp/#trans 9/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
T, if each argument is numerically less than the argument to its right, and
returns nil otherwise. If only one argument is supplied, < returns T.
Examples
-------------------------------------------------------------------------------
Arguments
numstr
A number or a string.
Return Values
T, if each argument is numerically less than or equal to the argument to its
right, and returns nil otherwise. If only one argument is supplied, <= returns
T.
Examples
(<= 2 9 9) returns T
-------------------------------------------------------------------------------
Arguments
numstr
A number or a string.
Return Values
T, if each argument is numerically greater than the argument to its right, and
nil otherwise. If only one argument is supplied, > returns T.
Examples
(> 120 17) returns T
https://www.theswamp.org/Sources/doc/avlisp/#trans 10/300
5/8/23, 12:24 PM Auto/Visual lisp help
(> 77 4 2) returns T
-------------------------------------------------------------------------------
>=
(greater than or equal to)
Arguments
numstr
A number or a string.
Return Values
T, if each argument is numerically greater than or equal to the argument to its
right, and nil otherwise. If only one argument is supplied, >= returns T.
Examples
(>= 120 17) returns T
(>= 77 4 4) returns T
-------------------------------------------------------------------------------
~ (bitwise NOT)
(~ int)
Arguments
int
An integer.
Return Values
The bitwise NOT (1's complement) of the argument.
Examples
(~ 3) returns -4
(~ -4) returns 3
-------------------------------------------------------------------------------
1+ (increment)
Increments a number by 1
(1+ number)
https://www.theswamp.org/Sources/doc/avlisp/#trans 11/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
number
Any number.
Return Values
Examples
(1+ 5) returns 6
-------------------------------------------------------------------------------
1- (decrement)
Decrements a number by 1
(1- number)
Arguments
number
Any number.
Return Values
Examples
(1- 5) returns 4
abs
(abs number)
Arguments
number
Any number.
Return Values
Examples
-------------------------------------------------------------------------------
acad_colordlg
https://www.theswamp.org/Sources/doc/avlisp/#trans 12/300
5/8/23, 12:24 PM Auto/Visual lisp help
Displays the standard AutoCAD color selection dialog box
Arguments
colornum
An integer in the range 0-256 (inclusive), specifying the AutoCAD color number
to display as the initial default.
flag
If set to nil, disables the ByLayer and ByBlock buttons. Omitting the flag
argument or setting it to a non-nil value enables the ByLayer and ByBlock
buttons.
Return Values
The user-selected color number, or nil, if the user cancels the dialog box.
Examples
Prompt the user to select a color, and default to green if none is selected:
(acad_colordlg 3)
-------------------------------------------------------------------------------
acad_helpdlg
This externally defined function has been replaced by the built-in function
help. It is provided for compatibility with previous releases of AutoCAD.
See Also
-------------------------------------------------------------------------------
acad_strlsort
(acad_strlsort list)
Arguments
list
Return Values
Examples
Command: (setq mos '("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug"
("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")
https://www.theswamp.org/Sources/doc/avlisp/#trans 13/300
5/8/23, 12:24 PM Auto/Visual lisp help
("Apr" "Aug" "Dec" "Feb" "Jan" "Jul" "Jun" "Mar" "May" "Nov" "Oct" "Sep")
-------------------------------------------------------------------------------
acdimenableupdate
(acdimenableupdate nil | T)
Arguments
nil
Associative dimensions will not update (even if the geometry is modified) until
the DIMREGEN command is entered.
Return Values
nil
Examples
Command: (acdimenableupdate T)
-------------------------------------------------------------------------------
acet-attsync
(acet-attsync blockname)
Arguments
blockname
A string naming the block to be updated. The string can contain wildcard
characters.
Return Values
Examples
Update the attributes of all blocks whose names begin with "Prod:"
https://www.theswamp.org/Sources/doc/avlisp/#trans 14/300
5/8/23, 12:24 PM Auto/Visual lisp help
Update the attributes of all blocks whose names begin with "Pix:"
See Also
-------------------------------------------------------------------------------
acet-layerp-mode
(acet-layerp-mode [status])
Arguments
status
Specifying T turns LAYERPMODE on, enabling layer- change tracking. Nil turns
LAYERPMODE off.
Return Values
Examples
Command: (acet-layerp-mode)
nil
Command: (acet-layerp-mode)
nil
See Also
-------------------------------------------------------------------------------
acet-layerp-mark
(acet-layerp-mark [status])
The acet-layerp-mark function allows you to group multiple layer commands into
a single transaction so that they can be undone by issuing LAYERP a single
time. LAYERPMODE must be on in order to set marks.
Arguments
status
Specifying T sets a begin mark. Specifying nil sets an end mark, clearing the
begin mark.
https://www.theswamp.org/Sources/doc/avlisp/#trans 15/300
5/8/23, 12:24 PM Auto/Visual lisp help
If status is omitted, acet-layerp-mark returns the current mark status for
layer settings.
Return Values
Examples
The following code changes layer 0 to blue, and then makes several additional
layer changes between a set of begin and end marks. If you issue LAYERP after
running this code, layer 0 reverts back to blue.
(defun TestLayerP ()
(acet-layerp-mode T)
(acet-layerp-mark T)
(acet-layerp-mark nil)
See Also
-------------------------------------------------------------------------------
acet-laytrans
Arguments
filename
settings
0 No options
https://www.theswamp.org/Sources/doc/avlisp/#trans 16/300
5/8/23, 12:24 PM Auto/Visual lisp help
2 Force entity linetype to BYLAYER
Return Values
Examples
The following command translates the current drawing using layer mappings saved
in LayMap.dwg. No transaction log will be produced, but all other processing
options will be in effect.
-------------------------------------------------------------------------------
acet-ms-to-ps
Converts a real value from model space units to paper space units.
If both the value and viewport arguments are specified, the value is converted
to model space units using the specified viewport. No user input is required.
If only the value argument is specified, the current viewport is assumed and no
user input is required. However, if the current space is model space, there is
no current viewport and the function will fail (returning nil). If paper space
is the current space, the function will either prompt for a viewport if more
than one viewport exists in the current paper space layout, or use the single
existing viewport.
If no arguments are specified, the function prompts for a value and converts it
if possible.
Arguments
value
viewport
Return Values
-------------------------------------------------------------------------------
acet-ps-to-ms
Converts a real value from paper space units to model space units.
If both the value and viewport arguments are specified, the value is converted
to model space units using the specified viewport. No user input is required.
If only the value argument is specified, the current viewport is assumed and no
user input is required. However, if the current space is model space, there is
no current viewport and the function will fail (returning nil). If paper space
is the current space, the function will either prompt for a viewport if more
than one viewport exists in the layout, or use the single existing viewport.
If no arguments are specified, the function prompts for a value and converts it
if possible.
https://www.theswamp.org/Sources/doc/avlisp/#trans 17/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
value
viewport
Return Values
-------------------------------------------------------------------------------
action_tile
Assigns an action to evaluate when the user selects the specified tile in a
dialog box
The action assigned by action_tile supersedes the dialog box's default action
(assigned by new_dialog) or the tile's action attribute, if these are
specified. The expression can refer to the tile's current value as $value, its
name as $key, its application-specific data (as set by client_data_tile) as
$data, its callback reason as $reason, and its image coordinates (if the tile
is an image button) as $x and $y.
Arguments
key
A string that names the tile that triggers the action (specified as its key
attribute). This argument is case-sensitive.
action-expression
Note: You cannot call the AutoLISP command function from the action_tile
function.
Return Values
Examples
If edit1 is a text box, the action expression in the following action_tile call
is evaluated when the user exits the text box:
See Also
The Default and DCL Actions topic in the Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
add_list
(add_list string)
Before using add_list, you must open the list and initialize it with a call to
start_list. Depending on the operation specified in start_list, the string is
either added to the current list or replaces the current list item.
Arguments
string
A string.
https://www.theswamp.org/Sources/doc/avlisp/#trans 18/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
Examples
Assuming the currently active DCL file has a popup_list or list_box with a key
of longlist, the following code fragment initializes the list and adds to it
the text strings in llist.
(start_list "longlist")
(end_list)
After the list has been defined, the following code fragment changes the text
in the second line to "2nd line".
(start_list "longlist" 1 0)
(end_list)
See Also
-------------------------------------------------------------------------------
alert
(alert string)
Arguments
string
Return Values
nil
Examples
Note: Line length and the number of lines in an alert box are platform,
device, and window dependent. AutoCAD truncates any string that is too long to
fit inside an alert box.
-------------------------------------------------------------------------------
alloc
(alloc n-alloc)
Arguments
n-alloc
https://www.theswamp.org/Sources/doc/avlisp/#trans 19/300
5/8/23, 12:24 PM Auto/Visual lisp help
An integer indicating the amount of memory to be allocated. The integer
represents the number of symbols, strings, usubrs, reals, and cons cells.
Return Values
The previous setting of n-alloc.
Examples
_$ (alloc 100)
1000
See Also
-------------------------------------------------------------------------------
and
Arguments
expr
Any expression.
Return Values
Examples
"string"
nil
-------------------------------------------------------------------------------
angle
Arguments
pt1
An endpoint.
pt2
An endpoint.
Return Values
An angle, in radians.
The angle is measured from the X axis of the current construction plane, in
radians, with angles increasing in the counterclockwise direction. If 3D points
are supplied, they are projected onto the current construction plane.
https://www.theswamp.org/Sources/doc/avlisp/#trans 20/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
1.5708
3.14159
See Also
-------------------------------------------------------------------------------
angtof
Arguments
string
units
Specifies the units in which the string is formatted. The value should
correspond to values allowed for the AutoCAD system variable AUNITS. If unit is
omitted, angtof uses the current value of AUNITS. The following units may be
specified:
0 Degrees
1 Degrees/minutes/seconds
2 Grads
3 Radians
4 Surveyor's units
Return Values
The angtof and angtos functions are complementary: if you pass angtof a string
created by angtos, angtof is guaranteed to return a valid value, and vice versa
(assuming the unit values match).
Examples
Command: (angtof "45.0000")
0.785398
1.0177
See Also
-------------------------------------------------------------------------------
angtos
https://www.theswamp.org/Sources/doc/avlisp/#trans 21/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
angle
unit
An integer that specifies the angular units. If unit is omitted, angtos uses
the current value of the AutoCAD system variable AUNITS. The following units
may be specified:
0 Degrees
1 Degrees/minutes/seconds
2 Grads
3 Radians
4 Surveyor's units
precision
The angtos function takes angle and returns it edited into a string according
to the settings of unit, precision, the AutoCAD UNITMODE system variable, and
the DIMZIN dimensioning variable.
The angtos function accepts a negative angle argument, but always reduces it to
a positive value between zero and 2 pi radians before performing the specified
conversion.
The UNITMODE system variable affects the returned string when surveyor's units
are selected (a unit value of 4). If UNITMODE = 0, spaces are included in the
string (for example, "N 45d E"); if UNITMODE = 1, no spaces are included in the
string (for example, "N45dE").
Return Values
Examples
"45.0000"
"315.0000"
Note: Routines that use the angtos function to display arbitrary angles (those
not relative to the value of ANGBASE) should check and consider the value of
ANGBASE.
See Also
The angtof function, and String Conversions in the Visual LISP Developer's
Guide.
-------------------------------------------------------------------------------
append
Takes any number of lists and appends them together as one list
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 22/300
5/8/23, 12:24 PM Auto/Visual lisp help
list
A list.
Return Values
Examples
(A B C D)
-------------------------------------------------------------------------------
apply
Arguments
'function
list
Return Values
Examples
"abc"
-------------------------------------------------------------------------------
arx
(arx)
Return Values
A list of ObjectARX(R) application file names; the path is not included in the
file name.
Examples
Command: (arx)
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 23/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
arxload
Arguments
application
A quoted string or a variable that contains the name of an executable file. You
can omit the .arx extension from the file name.
You must supply the full path name of the ObjectARX executable file, unless the
file is in a directory that is in the AutoCAD Support File Search Path.
onfailure
Return Values
The application name, if successful. If unsuccessful and the onfailure argument
is supplied, arxload returns the value of this argument, otherwise, failure
results in an error message.
Examples
Load the acbrowse.arx file supplied in the AutoCAD install directory:
"c:/program files/AutoCAD/acbrowse.arx"
See Also
-------------------------------------------------------------------------------
arxunload
Arguments
application
A quoted string or a variable that contains the name of a file that was loaded
with the arxload function. You can omit the .arx extension and the path from
the file name.
onfailure
Return Values
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 24/300
5/8/23, 12:24 PM Auto/Visual lisp help
Unload the acbrowse application that was loaded in the arxload function
example:
"acbrowse"
See Also
-------------------------------------------------------------------------------
ascii
Returns the conversion of the first character of a string into its ASCII
character code (an integer)
(ascii string)
Arguments
string
A string.
Return Values
An integer.
Examples
Command: (ascii "A")
65
97
66
-------------------------------------------------------------------------------
assoc
Searches an association list for an element and returns that association list
entry
Arguments
element
alist
Return Values
The alist entry, if successful. If assoc does not find element as a key in
alist, it returns nil.
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 25/300
5/8/23, 12:24 PM Auto/Visual lisp help
(SIZE 4.7263)
nil
-------------------------------------------------------------------------------
atan
Arguments
num1
A number.
num2
A number.
Return Values
Examples
Command: (atan 1)
0.785398
0.785398
0.463648
0.785398
-0.785398
0.588003
2.55359
1.5708
-------------------------------------------------------------------------------
atof
(atof string)
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 26/300
5/8/23, 12:24 PM Auto/Visual lisp help
string
Return Values
A real number.
Examples
97.1
3.0
3.9
-------------------------------------------------------------------------------
atoi
(atoi string)
Arguments
string
Return Values
An integer.
Examples
97
See Also
-------------------------------------------------------------------------------
atom
(atom item)
Arguments
item
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 27/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Command: (setq a '(x y z))
(X Y Z)
Command: (atom a)
nil
Command: (atom b)
nil
-------------------------------------------------------------------------------
atoms-family
Arguments
format
symlist
A list of strings that specify the symbol names you want atoms-family to search
for.
Return Values
Examples
Command: (atoms-family 0)
The following code verifies that the symbols CAR, CDR, and XYZ are defined, and
returns the list as strings:
The return value shows that the symbol XYZ is not defined.
https://www.theswamp.org/Sources/doc/avlisp/#trans 28/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
autoarxload
The first time a user enters a command specified in cmdlist, AutoCAD loads the
ObjectARX application specified in filename, then continues the command.
If you associate a command with filename and that command is not defined in the
specified file, AutoCAD alerts you with an error message when you enter the
command.
Arguments
filename
A string specifying the .arx file to be loaded when one of the commands defined
by the cmdlist argument is entered at the Command prompt. If you omit the path
from filename, AutoCAD looks for the file in the Support File Search Path.
cmdlist
A list of strings.
Return Values
nil
Examples
The following code defines the C:APP1, C:APP2, and C:APP3 functions to load the
bonusapp.arx file:
-------------------------------------------------------------------------------
autoload
The first time a user enters a command specified in cmdlist, AutoCAD loads the
application specified in filename, then continues the command.
Arguments
filename
A string specifying the .lsp file to be loaded when one of the commands defined
by the cmdlist argument is entered at the Command prompt. If you omit the path
from filename, AutoCAD looks for the file in the Support File Search Path.
cmdlist
A list of strings.
Return Values
nil
If you associate a command with filename and that command is not defined in the
specified file, AutoCAD alerts you with an error message when you enter the
command.
Examples
The following causes AutoCAD to load the bonusapp.lsp file the first time the
APP1, APP2, or APP3 commands are entered at the Command prompt:
https://www.theswamp.org/Sources/doc/avlisp/#trans 29/300
5/8/23, 12:24 PM Auto/Visual lisp help
Boole
Arguments
operator
int1, int2...
Integers.
Note that Boole will accept a single integer argument, but the result is
unpredictable.
+---------------------+------+--------------+
| Boolean truth table |
+---------------------+------+--------------+
| Int1 | Int2 | operator bit |
+---------------------+------+--------------+
| 0 | 0 | 8 |
+---------------------+------+--------------+
| 0 | 1 | 4 |
+---------------------+------+--------------+
| 1 | 0 | 2 |
+---------------------+------+--------------+
| 1 | 1 | 1 |
+---------------------+------+--------------+
Each bit of int1 is paired with the corresponding bit of int2, specifying one
horizontal row of the truth table. The resulting bit is either 0 or 1,
depending on the setting of the operator bit that corresponds to this row of
the truth table.
+---------------------------+-----------+--------------------------------------+
| Boole function bit values |
+---------------------------+-----------+--------------------------------------+
|Operator | Operation | Resulting bit is 1 if |
+---------------------------+-----------+--------------------------------------+
| 1 | AND | Both input bits are 1 |
+---------------------------+-----------+--------------------------------------+
| 6 | XOR | Only one of the two input bits is 1 |
+---------------------------+-----------+--------------------------------------+
| 7 | OR | Either or both of the input bits |
| | | are 1 |
+---------------------------+-----------+--------------------------------------+
| 8 | NOR | Both input bits are 0 (1's |
| | | complement) |
+---------------------------+-----------+--------------------------------------+
Return Values
An integer.
Examples
Command: (Boole 1 12 5)
Command: (Boole 6 6 5)
https://www.theswamp.org/Sources/doc/avlisp/#trans 30/300
5/8/23, 12:24 PM Auto/Visual lisp help
3
You can use other values of operator to perform other Boolean operations for
which there are no standard names. For example, if operator is 4, the resulting
bits are set if the corresponding bits are set in int2 but not in int1:
12
-------------------------------------------------------------------------------
boundp
(boundp sym)
Arguments
sym
A symbol.
Return Values
T if sym has a value bound to it. If no value is bound to sym, or if it has
been bound to nil, boundp returns nil. If sym is an undefined symbol, it is
automatically created and is bound to nil.
Examples
nil
nil
See Also
caddr
(caddr list)
Arguments
list
A list.
Return Values
The third element in list; or nil, if the list is empty or contains fewer than
three elements.
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 31/300
5/8/23, 12:24 PM Auto/Visual lisp help
Command: (setq pt3 '(5.25 1.0 3.0))
3.0
nil
See Also
-------------------------------------------------------------------------------
cadr
(cadr list)
Arguments
list
A list.
Return Values
The second element in list, or nil, if the list is empty or contains only one
element.
Examples
(5.25 1.0)
1.0
nil
1.0
See Also
-------------------------------------------------------------------------------
car
(car list)
Arguments
list
A list.
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 32/300
5/8/23, 12:24 PM Auto/Visual lisp help
The first element in list; or nil, if the list is empty.
Examples
Command: (car '(a b c))
(A B)
nil
See Also
-------------------------------------------------------------------------------
cdr
Returns a list containing all but the first element of the specified list
(cdr list)
Arguments
list
A list.
Return Values
A list containing all the elements of list, except the first element (but see
Note below). If the list is empty, cdr returns nil.
Note: When the list argument is a dotted pair, cdr returns the second element
without enclosing it in a list.
Examples
Command: (cdr '(a b c))
(B C)
(C)
nil
"Text"
See Also
-------------------------------------------------------------------------------
chr
(chr integer)
https://www.theswamp.org/Sources/doc/avlisp/#trans 33/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
list
An integer.
Return Values
A string containing the ASCII character code for integer. If the integer is not
in the range of 1-255, the return value is unpredictable.
Examples
"A"
"B"
"a"
-------------------------------------------------------------------------------
client_data_tile
Arguments
key
clientdata
Return Values
nil
-------------------------------------------------------------------------------
close
(close file-desc)
Arguments
file-desc
Return Values
Nil if file-desc is valid, otherwise results in an error message.
After a close, the file descriptor is unchanged but is no longer valid. Data
added to an open file is not actually written until the file is closed.
Examples
The following code counts the number of lines in the file somefile.txt and sets
the variable ct equal to that number:
https://www.theswamp.org/Sources/doc/avlisp/#trans 34/300
5/8/23, 12:24 PM Auto/Visual lisp help
(while (read-line x)
(close x)
-------------------------------------------------------------------------------
command
Arguments
arguments
Note that if you issue command from Visual LISP, focus does not change to the
AutoCAD window. If the command requires user input, you'll see the return value
(nil) in the Console window, but AutoCAD will be waiting for input. You must
manually activate the AutoCAD window and respond to the prompts. Until you do
so, any subsequent commands will fail.
Return Values
nil
Examples
The following example sets two variables pt1 and pt2 equal to two point values
1,1 and 1,5. It then uses the command function to issue the LINE command and
pass the two point values.
(1 5)
To point:
To point:
Command: nil
Also, if you use the command function in an acad.lsp or .mnl file, it should be
called only from within a defun statement. Use the S::STARTUP function to
define commands that need to be issued immediately when you begin a drawing
session.
For AutoCAD commands that require the selection of an object (like the BREAK
and TRIM commands), you can supply a list obtained with entsel instead of a
point to select the object. For examples, see Passing Pick Points to AutoCAD
https://www.theswamp.org/Sources/doc/avlisp/#trans 35/300
5/8/23, 12:24 PM Auto/Visual lisp help
Commands in the Visual LISP Developer's Guide.
Commands executed from the command function are not echoed to the command line
if the CMDECHO system variable (accessible from setvar and getvar) is set to 0.
See Also
The vl-cmdf function in this reference and Command Submission in the Visual
LISP Developer's Guide.
-------------------------------------------------------------------------------
cond
The cond function accepts any number of lists as arguments. It evaluates the
first item in each list (in the order supplied) until one of these items
returns a value other than nil. It then evaluates those expressions that follow
the test that succeeded.
Return Values
The value of the last expression in the sublist. If there is only one
expression in the sublist (that is, if result is missing), the value of the
test expression is returned. If no arguments are supplied, cond returns nil.
Examples
(cond
((minusp a) (- a))
(t a)
(cond
((= s "Y") 1)
((= s "y") 1)
((= s "N") 0)
((= s "n") 0)
(t nil)
-------------------------------------------------------------------------------
cons
Arguments
new-first-element
https://www.theswamp.org/Sources/doc/avlisp/#trans 36/300
5/8/23, 12:24 PM Auto/Visual lisp help
list-or-atom
A list or an atom.
Return Values
Examples
Command: (cons 'a '(b c d))
(A B C D)
((A) B C D)
(A . 2)
See Also
-------------------------------------------------------------------------------
cos
(cos ang)
Arguments
ang
An angle, in radians.
Return Values
Examples
Command: (cos 0.0)
1.0
-1.0
-------------------------------------------------------------------------------
cvunit
Arguments
value
from-unit
https://www.theswamp.org/Sources/doc/avlisp/#trans 37/300
5/8/23, 12:24 PM Auto/Visual lisp help
to-unit
The from-unit and to-unit arguments can name any unit type found in the
acad.unt file.
Return Values
The converted value, if successful, or nil, if either unit name is unknown (not
found in the acad.unt file), or if the two units are incompatible (for example,
trying to convert grams into years).
Examples
Command: (cvunit 1 "minute" "second")
60.0
nil
2.54
4840.0
(12.0 30.0)
Note: If you have several values to convert in the same manner, it is more
efficient to convert the value 1.0 once and then apply the resulting value as a
scale factor in your own function or computation. This works for all predefined
units except temperature, where an offset is involved as well.
See Also
defun
Defines a function
Arguments
sym
arguments
/ variables
The slash preceding the variable names must be separated from the first local
name and from the last argument, if any, by at least one space.
expr
If you do not declare any arguments or local symbols, you must supply an empty
set of parentheses after the function name.
https://www.theswamp.org/Sources/doc/avlisp/#trans 38/300
5/8/23, 12:24 PM Auto/Visual lisp help
If duplicate argument or symbol names are specified, AutoLISP uses the first
occurrence of each name and ignores the following occurrences.
Return Values
The result of the last expression evaluated.
Warning! Never use the name of a built-in function or symbol for the sym
argument to defun. This overwrites the original definition and makes the
built-in function or symbol inaccessible. To get a list of built-in and
previously defined functions, use the atoms-family function.
Examples
(defun myfunc (x y) ...) Function takes two arguments
See Also
The Symbol and Function Handling topic in the Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
defun-q
Arguments
sym
arguments
/ variables
The slash preceding the variable names must be separated from the first local
name and from the last argument, if any, by at least one space.
expr
If you do not declare any arguments or local symbols, you must supply an empty
set of parentheses after the function name.
If duplicate argument or symbol names are specified, AutoLISP uses the first
occurrence of each name and ignores the following occurrences.
Return Values
The result of the last expression evaluated.
Examples
MY-STARTUP
_$ (my-startup 5)
https://www.theswamp.org/Sources/doc/avlisp/#trans 39/300
5/8/23, 12:24 PM Auto/Visual lisp help
(5) (5)
_$ (defun-q-list-ref 'my-startup)
See Also
-------------------------------------------------------------------------------
defun-q-list-ref
(defun-q-list-ref 'function )
Arguments
function
Return Values
The list definition of the function, or nil, if the argument is not a list.
Examples
Define a function using defun-q:
MY-STARTUP
_$ (defun-q-list-ref 'my-startup)
See Also
-------------------------------------------------------------------------------
defun-q-list-set
Arguments
sym
list
Return Values
Examples
_$ (defun-q-list-set 'foo '((x) x))
FOO
https://www.theswamp.org/Sources/doc/avlisp/#trans 40/300
5/8/23, 12:24 PM Auto/Visual lisp help
_$ (foo 3)
S::STARTUP
MY-STARTUP
(defun-q-list-ref 's::startup)
S::STARTUP
The following illustrates how the functions respond individually, and how the
functions work after being combined using defun-q-list-set:
FOO
_$ (foo 1)
(FOO 1) (FOO 1)
BAR
_$ (bar 2)
(BAR 2) (BAR 2)
_$ (defun-q-list-set
'foo
))
FOO
_$ (foo 3)
(FOO 3)
(BAR 3) (BAR 3)
See Also
-------------------------------------------------------------------------------
dictadd
Arguments
ename
https://www.theswamp.org/Sources/doc/avlisp/#trans 41/300
5/8/23, 12:24 PM Auto/Visual lisp help
symbol
The key name of the object being added to the dictionary; symbol must be a
unique name that does not already exist in the dictionary.
newobj
Return Values
The entity name of the object added to the dictionary.
Examples
The examples that follow create objects and add them to the named object
dictionary.
((0 . "XRECORD") (100 . "AcDbXrecord") (1 . "This is my data") (10 1.0 2.0 3.0)
(70 . 33))
See Also
-------------------------------------------------------------------------------
dictnext
Arguments
ename
https://www.theswamp.org/Sources/doc/avlisp/#trans 42/300
5/8/23, 12:24 PM Auto/Visual lisp help
rewind
If this argument is present and is not nil, the dictionary is rewound and the
first entry in it is retrieved.
Return Values
The next entry in the specified dictionary, or nil, when the end of the
dictionary is reached. Entries are returned as lists of dotted pairs of
DXF-type codes and values. Deleted dictionary entries are not returned.
Note: Once you begin stepping through the contents of a dictionary, passing a
different dictionary name to dictnext will cause the place to be lost in the
original dictionary. In other words, only one global iterator is maintained for
use in this function.
Examples
Create a dictionary and an entry as shown in the example for dictadd. Then make
another Xrecord object:
Add this Xrecord object to the dictionary, as the second record in the
dictionary:
dictnext returns the name of the first entity added to the dictionary.
dictnext returns the name of the second entity added to the dictionary.
nil
Rewind to the first entry in the dictionary and return the entity name of that
entry:
Specifying T for the optional rewind argument causes dictnext to return the
first entry in the dictionary.
See Also
-------------------------------------------------------------------------------
dictremove
https://www.theswamp.org/Sources/doc/avlisp/#trans 43/300
5/8/23, 12:24 PM Auto/Visual lisp help
(dictremove ename symbol)
By default, removing an entry from a dictionary does not delete it from the
database. This must be done with a call to entdel. Currently the exceptions to
this rule are groups and mlinestyles. The code that implements these features
requires that the database and these dictionaries be up to date, and therefore
automatically deletes the entity when it is removed (with dictremove) from the
dictionary.
Arguments
ename
symbol
The dictremove function does not allow the removal of an mlinestyle from the
mlinestyle dictionary if it is actively referenced by an mline in the database.
Return Values
The entity name of the removed entry. If ename is invalid or symbol is not
found, dictremove returns nil.
Examples
The following example removes the dictionary created in the dictadd example:
See Also
-------------------------------------------------------------------------------
dictrename
Arguments
ename
oldsym
newsym
Return Values
The newsym value, if the rename is successful. If either the oldname is not
present in the dictionary, or ename is invalid, or newname is invalid, or
newname is already present in the dictionary, dictrename returns nil.
Examples
The following example renames the dictionary created in the dictadd sample:
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 44/300
5/8/23, 12:24 PM Auto/Visual lisp help
The dictadd, dictnext, dictremove, dictsearch, and namedobjdict functions.
-------------------------------------------------------------------------------
dictsearch
Arguments
ename
symbol
A string that specifies the item to be searched for within the dictionary.
setnext
If present and not nil, the dictnext entry counter is adjusted so the following
dictnext call returns the entry after the one returned by this dictsearch call.
Return Values
The entry for the specified item, if successful, or nil, if no entry is found.
Examples
See Also
-------------------------------------------------------------------------------
dimx_tile
(dimx_tile key)
Arguments
key
Return Values
The width of the tile.
The coordinates returned are the maximum allowed within the tile. Because
coordinates are zero based, this function return one less than the total X
dimension (X-1). The dimx_tile and dimy_tile functions are provided for use
with vector_image, fill_image, and slide_image, which require you to specify
absolute tile coordinates.
Examples
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 45/300
5/8/23, 12:24 PM Auto/Visual lisp help
dimy_tile
(dimy_tile key)
Arguments
key
Return Values
The coordinates returned are the maximum allowed within the tile. Because
coordinates are zero based, this function return one less than the total Y
dimension (Y-1). The dimx_tile and dimy_tile functions are provided for use
with vector_image, fill_image, and slide_image, which require you to specify
absolute tile coordinates.
Examples
(setq tile_height (dimy_tile "my_tile"))
-------------------------------------------------------------------------------
distance
Arguments
pt1
A 2D or 3D point list.
pt1
A 2D or 3D point list.
Return Values
The distance.
If one or both of the supplied points is a 2D point, then distance ignores the
Z coordinates of any 3D points supplied and returns the 2D distance between the
points as projected into the current construction plane.
Examples
6.7
2.82843
See Also
-------------------------------------------------------------------------------
distof
https://www.theswamp.org/Sources/doc/avlisp/#trans 46/300
5/8/23, 12:24 PM Auto/Visual lisp help
(distof string [mode])
The distof and rtos functions are complementary. If you pass distof a string
created by rtos, distof is guaranteed to return a valid value, and vice versa
(assuming the mode values are the same).
Arguments
string
A string to be converted. The argument must be a string that distof can parse
correctly according to the units specified by mode. It can be in the same form
that rtos returns, or in a form that AutoCAD allows for keyboard entry.
mode
The units in which the string is currently formatted. The mode corresponds to
the values allowed for the AutoCAD system variable LUNITS. Specify one of the
following numbers for mode:
1 Scientific
2 Decimal
5 Fractional
Return Values
Note: The distof function treats modes 3 and 4 the same. That is, if mode
specifies 3 (engineering) or 4 (architectural) units, and string is in either
of these formats, distof returns the correct real value.
-------------------------------------------------------------------------------
done_dialog
(done_dialog [status])
Arguments
status
You must call done_dialog from within an action expression or callback function
(see action_tile ).
Return Values
A two-dimensional point list that is the (X,Y) location of the dialog box when
the user exited it.
Usage Notes
If you provide a callback for the button whose key is "accept" or "cancel"
(usually the OK and Cancel buttons), the callback must call done_dialog
explicitly. If it doesn't, the user can be trapped in the dialog box. If you
don't provide an explicit callback for these buttons and use the standard exit
buttons, AutoCAD handles them automatically. Also, an explicit AutoLISP action
for the "accept" button must specify a status of 1 (or an application-defined
value); otherwise, start_dialog returns the default value, 0, which makes it
appear as if the dialog box was canceled.
end_image
https://www.theswamp.org/Sources/doc/avlisp/#trans 47/300
5/8/23, 12:24 PM Auto/Visual lisp help
(end_image)
Return Values
nil
See Also
-------------------------------------------------------------------------------
end_list
(end_list)
Return Values
nil
See Also
-------------------------------------------------------------------------------
entdel
(entdel ename)
Arguments
ename
Return Values
The entity name.
Usage Notes
The entdel function operates only on main entities. Attributes and polyline
vertices cannot be deleted independently of their parent entities. You can use
the command function to operate the ATTEDIT or PEDIT commands to modify
subentities.
You cannot delete entities within a block definition. However, you can
completely redefine a block definition, minus the entity you want deleted, with
entmake.
Examples
Get the name of the first entity in the drawing and assign it to variable e1:
https://www.theswamp.org/Sources/doc/avlisp/#trans 48/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
entget
Arguments
ename
Name of the entity being queried. The ename can refer to either a graphical or
nongraphical entity.
applist
Return Values
Note that the DXF group codes used by AutoLISP differ slightly from the group
codes in a DXF file. The AutoLISP DXF group codes are documented in the DXF
Reference .
Examples
Assume that the last object created in the drawing is a line drawn from point
(1,2) to point (6,5). The following example shows code that retrieves the
entity name of the last object with the entlast function, and passes that name
to entget:
See Also
-------------------------------------------------------------------------------
entlast
Returns the name of the last nondeleted main object (entity) in the drawing
(entlast)
The entlast function is frequently used to obtain the name of a new entity that
has just been added with the command function. To be selected, the entity need
not be on the screen or on a thawed layer.
Return Values
An entity name, or nil, if there are no entities in the current drawing.
https://www.theswamp.org/Sources/doc/avlisp/#trans 49/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Set variable e1 to the name of the last entity added to the drawing:
If your application requires the name of the last nondeleted entity (main
entity or subentity), define a function such as the following and call it
instead of entlast.
(defun lastent (/ a b)
(setq a b) subentities
) or subentity
See Also
-------------------------------------------------------------------------------
entmake
(entmake [elist])
The entmake function can define both graphical and nongraphical entities.
Arguments
elist
The entity type (for example, CIRCLE or LINE) must be the first or second field
of the elist. If entity type is the second field, it can be preceded only by
the entity name. The entmake function ignores the entity name when creating the
new entity. If the elist contains an entity handle, entmake ignores that too.
Return Values
If successful, entmake returns the entity's list of definition data. If entmake
is unable to create the entity, it returns nil.
Examples
The following code creates a red circle (color 62), centered at (4,4) with a
radius of 1. The optional layer and linetype fields have been omitted and
therefore assume default values.
Command: (entmake '((0 . "CIRCLE") (62 . 1) (10 4.0 4.0 0.0) (40 . 1.0)))
https://www.theswamp.org/Sources/doc/avlisp/#trans 50/300
5/8/23, 12:24 PM Auto/Visual lisp help
You cannot create viewport objects with entmake.
A group 66 code is honored only for insert objects (meaning attributes follow).
For polyline entities, the group 66 code is forced to a value of 1 (meaning
vertices follow), and for all other entities it takes a default of 0. The only
entity that can follow a polyline entity is a vertex entity.
The group code 2 (block name) of a dimension entity is optional for the entmake
function. If the block name is omitted from the entity definition list, AutoCAD
creates a new one. Otherwise, AutoCAD creates the dimension using the name
provided.
For legacy reasons, entmake ignores DXF group code 100 data for the following
entity types:
* AcDbText
* AcDbAttribute
* AcDbAttributeDefinition
* AcDbBlockBegin
* AcDbBlockEnd
* AcDbSequenceEnd
* AcDbBlockReference
* AcDbMInsertBlock
* AcDb2dVertex
* AcDb3dPolylineVertex
* AcDbPolygonMeshVertex
* AcDbPolyFaceMeshVertex
* AcDbFaceRecord
* AcDb2dPolyline
* AcDb3dPolyline
* AcDbArc
* AcDbCircle
* AcDbLine
* AcDbPoint
* AcDbFace
* AcDbPolyFaceMesh
* AcDbPolygonMesh
* AcDbTrace
* AcDbSolid
* AcDbShape
* AcDbViewport
See Also
-------------------------------------------------------------------------------
entmakex
Makes a new object or entity, gives it a handle and entity name (but, does not
assign an owner), and then returns the new entity name
(entmakex [elist])
The entmakex function can define both graphical and nongraphical entities.
Arguments
elist
Return Values
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 51/300
5/8/23, 12:24 PM Auto/Visual lisp help
_$ (entmakex '((0 . "CIRCLE") (62 . 1) (10 4.0 3.0 0.0) (40 . 1.0)))
Warning! Objects and entities without owners are not written out to DWG or DXF
files. Be sure to set an owner at some point after using entmakex. For example,
you can use dictadd to set a dictionary to own an object.
See Also
-------------------------------------------------------------------------------
entmod
(entmod elist)
The entmod function updates database information for the entity name specified
by the -1 group in elist. The primary mechanism through which AutoLISP updates
the database is by retrieving entities with entget, modifying the list defining
an entity, and updating the entity in the database with entmod. The entmod
function can modify both graphical and nongraphical objects.
Arguments
elist
Return Values
Examples
Set the en1 variable to the name of the first entity in the drawing:
https://www.theswamp.org/Sources/doc/avlisp/#trans 52/300
5/8/23, 12:24 PM Auto/Visual lisp help
There are restrictions on the changes the entmod function can make:
* An entity's type and handle cannot be changed. If you want to do this, use
entdel to delete the entity, then make a new entity with the command or
entmake functions.
* The entmod function cannot change internal fields such as the entity name
in the -2 group of a seqend entity--attempts to change such fields are
ignored.
Before performing an entmod on vertex entities, you should read or write the
polyline entity's header. If the most recently processed polyline entity is
different from the one to which the vertex belongs, width information (the 40
and 41 groups) can be lost.
Warning! You can use entmod to modify entities within a block definition, but
doing so can create a self-referencing block, which will cause AutoCAD to stop.
See Also
-------------------------------------------------------------------------------
entnext
(entnext [ename])
Arguments
ename
Return Values
If entnext is called with no arguments, it returns the entity name of the first
nondeleted entity in the database. If an ename argument is supplied to entnext,
the function returns the entity name of the first nondeleted entity following
ename in the database. If there is no next entity in the database, it returns
nil. The entnext function returns both main entities and subentities.
Examples
(setq e1 (entnext)) ; Sets e1 to the name of the first entity in the drawing
Notes
The entities selected by ssget are main entities, not attributes of blocks or
vertices of polylines. You can access the internal structure of these complex
entities by walking through the subentities with entnext. Once you obtain a
subentity's name, you can operate on it like any other entity. If you obtain
the name of a subentity with entnext, you can find the parent entity by
stepping forward with entnext until a seqend entity is found, then extracting
the -2 group from that entity, which is the main entity's name.
See Also
-------------------------------------------------------------------------------
entsel
https://www.theswamp.org/Sources/doc/avlisp/#trans 53/300
5/8/23, 12:24 PM Auto/Visual lisp help
Prompts the user to select a single object (entity) by specifying a point
(entsel [msg])
Arguments
msg
Return Values
A list whose first element is the entity name of the chosen object and whose
second element is the coordinates (in terms of the current UCS) of the point
used to pick the object.
The pick point returned by entsel does not represent a point that lies on the
selected object. The point returned is the location of the crosshairs at the
time of selection. The relationship between the pick point and the object will
vary depending on the size of the pickbox and the current zoom scale.
Examples
The following AutoCAD command sequence illustrates the use of the entsel
function and the list returned:
Command: line
To point: 6,6
To point: ENTER
See Also
-------------------------------------------------------------------------------
entupd
(entupd ename)
Arguments
ename
Return Values
Examples
Assuming that the first entity in the drawing is a 3D polyline with several
vertices, the following code modifies and redisplays the polyline:
https://www.theswamp.org/Sources/doc/avlisp/#trans 54/300
5/8/23, 12:24 PM Auto/Visual lisp help
(setq ed
ed ; to point (1,2)
See Also
-------------------------------------------------------------------------------
eq
The eq function determines whether expr1 and expr2 are bound to the same object
(by setq, for example).
Arguments
expr1
expr2
Return Values
T if the two expressions are identical, nil otherwise.
Examples
Given the following assignments:
(setq f3 f2)
nil
eq returns nil because f1 and f3, while containing the same value, do not refer
https://www.theswamp.org/Sources/doc/avlisp/#trans 55/300
5/8/23, 12:24 PM Auto/Visual lisp help
to the same list.
See Also
-------------------------------------------------------------------------------
equal
Arguments
expr1
expr2
fuzz
A real number defining the maximum amount by which expr1 and expr2 can differ
and still be considered equal.
When comparing two real numbers (or two lists of real numbers, as in points),
the two identical numbers can differ slightly if different methods are used to
calculate them. You can specify a fuzz amount to compensate for the difference
that may result from the different methods of calculation.
Return Values
T if the two expressions are equal (evaluate to the same value), nil otherwise.
Examples
Given the following assignments:
(setq f3 f2)
(setq a 1.123456)
(setq b 1.123457)
Compare f1 to f3:
Compare f3 to f2:
Compare a to b:
Command: (equal a b)
nil
https://www.theswamp.org/Sources/doc/avlisp/#trans 56/300
5/8/23, 12:24 PM Auto/Visual lisp help
Compare a to b:, with fuzz argument of .000001:
The a and b variables differ by an amount equal to the specified fuzz factor,
so equal considers the variables equal.
If the eq function finds that two lists or atoms are the same, the equal
function also finds them to be the same.
Any atoms that the equal function determines to be the same are also found
equivalent by eq. However, two lists that equal determines to be the same may
be found to be different according to the eq function.
See Also
-------------------------------------------------------------------------------
error_function
+error+ string
Return Values
This function does not return, except when using vl-exit-with-value .
Examples
The following function does the same thing that the AutoLISP standard error
handler does. It prints the word "error," followed by a description:
(defun +error+ (msg)
(princ msg)
(princ)
See Also
-------------------------------------------------------------------------------
eval
(eval expr)
Arguments
expr
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 57/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
First, set some variables:
123
4.0
10
Command: (eval a)
123
Command: (eval b)
123
-------------------------------------------------------------------------------
exit
(exit)
If exit is called, it returns the error message quit/exit abort and returns to
the AutoCAD Command prompt.
See Also
-------------------------------------------------------------------------------
exp
Returns the constant e (a real number) raised to a specified power (the natural
antilog)
(exp num)
Arguments
num
A real number.
Return Values
Examples
Command: (exp 1.0)
2.71828
9.02501
https://www.theswamp.org/Sources/doc/avlisp/#trans 58/300
5/8/23, 12:24 PM Auto/Visual lisp help
0.67032
-------------------------------------------------------------------------------
expand
(expand n-expand)
Arguments
n-expand
Return Values
Examples
Set the segment size to 100:
_$ (alloc 100)
1000
_$ (expand 2)
82
This ensures that AutoLISP now has memory available for at least 200 additional
symbols, strings, usubrs and reals each, and 8200 free conses.
See Also
-------------------------------------------------------------------------------
expt
Arguments
number
Any number.
power
Return Values
If both arguments are integers, the result is an integer, otherwise, the result
is a real.
https://www.theswamp.org/Sources/doc/avlisp/#trans 59/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Command: (expt 2 4)
16
9.0
fill_image
Draws a filled rectangle in the currently active dialog box image tile
The first (upper-left) corner of the rectangle is located at (x1,y1) and the
second (lower-right) corner is located the relative distance (width,height)
from the first corner. The origin (0,0) is the upper-left corner of the image.
You can obtain the coordinates of the lower-right corner by calling the
dimension functions dimx_tile and dimy_tile.
The fill_image function must be used between start_image and end_image function
calls.
Arguments
x1
y1
width
height
color
An AutoCAD color number, or one of the logical color numbers shown in the
following table:
+------------------------------+--------------+--------------------------------+
| Symbolic names for color attribute |
+------------------------------+--------------+--------------------------------+
| Color number | ADI mnemonic | Description |
+------------------------------+--------------+--------------------------------+
| -2 | BGLCOLOR | Current background of the |
| | | AutoCAD drawing area |
+------------------------------+--------------+--------------------------------+
| -15 | DBGLCOLOR | Current dialog box background |
| | | color |
+------------------------------+--------------+--------------------------------+
| -16 | DFGLCOLOR | Current dialog box foreground |
| | | color (text) |
+------------------------------+--------------+--------------------------------+
| -18 | LINELCOLOR | Current dialog box line color |
+------------------------------+--------------+--------------------------------+
Return Values
Examples
(fill_image
https://www.theswamp.org/Sources/doc/avlisp/#trans 60/300
5/8/23, 12:24 PM Auto/Visual lisp help
0
(dimx_tile "slide_tile")
(dimy_tile "slide_tile")
color
(end_image)
-------------------------------------------------------------------------------
findfile
Searches the AutoCAD library path for the specified file or directory
(findfile filename)
The findfile function makes no assumption about the file type or extension of
filename. If filename does not specify a drive/directory prefix, findfile
searches the AutoCAD library path. If a drive/directory prefix is supplied,
findfile looks only in that directory.
Arguments
filename
Return Values
A string containing the fully qualified file name, or nil, if the specified
file or directory is not found.
The file name returned by findfile is suitable for use with the open function.
Examples
If the current directory is /AutoCAD and it contains the file abc.lsp, the
following function call retrieves the path name:
"C:\\Program Files\\AutoCAD\\abc.lsp"
"C:\\Program Files\\AutoCAD\\support\\xyz.txt"
If the file nosuch is not present in any of the directories on the library
search path, findfile returns nil:
nil
Note that prior to AutoCAD Release 14, findfile only returned a path if you
supplied a valid file name as your argument. If you supplied a directory path,
findfile returned nil even if the path existed. For example, the following call
to findfile returns a path name in AutoCAD:
"C:\\program files\\AutoCAD"
-------------------------------------------------------------------------------
fix
https://www.theswamp.org/Sources/doc/avlisp/#trans 61/300
5/8/23, 12:24 PM Auto/Visual lisp help
Returns the conversion of a real number into the nearest smaller integer
(fix number)
The fix function truncates number to the nearest integer by discarding the
fractional portion.
Arguments
number
A real number.
Return Values
Examples
Command: (fix 3)
-------------------------------------------------------------------------------
float
(float number)
Arguments
number
Any number.
Return Values
The real number derived from number.
Examples
Command: (float 3)
3.0
3.75
-------------------------------------------------------------------------------
foreach
The foreach function steps through a list, assigning each element in the list
to a variable, and evaluates each expression for every element in the list. Any
number of expressions can be specified.
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 62/300
5/8/23, 12:24 PM Auto/Visual lisp help
name
list
expr
Return Values
The result of the last expr evaluated. If no expr is specified, foreach returns
nil.
Examples
C C
foreach prints each element in the list and returns C, the last element. This
command is equivalent to the following sequence of commands:
(print a)
(print b)
(print c)
except that foreach returns the result of only the last expression evaluated.
-------------------------------------------------------------------------------
function
Tells the Visual LISPTM compiler to link and optimize an argument as if it were
a built-in function
The function function is identical to the quote function, except it tells the
Visual LISP compiler to link and optimize the argument as if it were a built-in
function or defun.
Compiled lambda expressions that are quoted by function will contain debugging
information when loaded into the Visual LISP IDE.
Arguments
symbol
lambda-expr
Return Values
The result of the evaluated expression.
Examples
The Visual LISP compiler cannot optimize the quoted lambda expression in the
following code:
(mapcar
https://www.theswamp.org/Sources/doc/avlisp/#trans 63/300
5/8/23, 12:24 PM Auto/Visual lisp help
'(1 2 3))
After adding the function function to the expression, the compiler can optimize
the lambda expression. For example:
(mapcar
'(1 2 3))
gc
(gc)
See Also
The Memory Management Functions topic in the Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
gcd
Arguments
int1
int2
Return Values
An integer representing the greatest common denominator between int1 and int2.
Examples
Command: (gcd 81 57)
-------------------------------------------------------------------------------
get_attr
Arguments
key
attribute
https://www.theswamp.org/Sources/doc/avlisp/#trans 64/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
-------------------------------------------------------------------------------
get_tile
(get_tile key)
Arguments
key
Return Values
A string containing the tile's value.
-------------------------------------------------------------------------------
getangle
Pauses for user input of an angle, and returns that angle in radians
Arguments
pt
msg
Return Values
The getangle function measures angles with the zero-radian direction (set by
the ANGBASE system variable) with angles increasing in the counterclockwise
direction. The returned angle is expressed in radians with respect to the
current construction plane (the XY plane of the current UCS, at the current
elevation).
Examples
The following code examples show how different arguments can be used with
getangle:
Usage Notes
Users can specify an angle by entering a number in the AutoCAD current angle
units format. Although the current angle units format might be in degrees,
https://www.theswamp.org/Sources/doc/avlisp/#trans 65/300
5/8/23, 12:24 PM Auto/Visual lisp help
grads, or some other unit, this function always returns the angle in radians.
The user can also show AutoLISP the angle by pointing to two 2D locations in
the drawing area. AutoCAD draws a rubber-band line from the first point to the
current crosshairs position to help you visualize the angle.
It is important to understand the difference between the input angle and the
angle returned by getangle. Angles that are passed to getangle are based on the
current settings of ANGDIR and ANGBASE. However, once an angle is provided, it
is measured in a counterclockwise direction (ignoring ANGDIR) with zero radians
as the current setting of ANGBASE.
The user cannot enter another AutoLISP expression as the response to a getangle
request.
See Also
-------------------------------------------------------------------------------
getcfg
Retrieves application data from the AppData section of the acad.cfg file
(getcfg cfgname)
Arguments
cfgname
A string (maximum length of 496 characters) naming the section and parameter
value to retrieve.
"AppData/application_name/section_name/.../param_name"
Return Values
Examples
"8"
See Also
-------------------------------------------------------------------------------
getcname
(getcname cname)
Arguments
cname
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 66/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
-------------------------------------------------------------------------------
getcorner
(getcorner pt [msg])
The getcorner function takes a base point argument, based on the current UCS,
and draws a rectangle from that point as the user moves the crosshairs on the
screen.
Arguments
pt
msg
Return Values
The getcorner function returns a point in the current UCS, similar to getpoint.
If the user supplies a 3D point, its Z coordinate is ignored. The current
elevation is used as the Z coordinate.
Examples
-------------------------------------------------------------------------------
getdist
The user can specify the distance by selecting two points, or by specifying
just the second point, if a base point is provided. The user can also specify a
distance by entering a number in the AutoCAD current distance units format.
Although the current distance units format might be in feet and inches
(architectural), the getdist function always returns the distance as a real.
The getdist function draws a rubber-band line from the first point to the
current crosshairs position to help the user visualize the distance.
Arguments
pt
https://www.theswamp.org/Sources/doc/avlisp/#trans 67/300
5/8/23, 12:24 PM Auto/Visual lisp help
msg
Return Values
A real number. If a 3D point is provided, the returned value is a 3D distance.
However, setting the 64 bit of the initget function instructs getdist to ignore
the Z component of 3D points and to return a 2D distance.
Examples
(setq dist (getdist))
-------------------------------------------------------------------------------
getenv
(getenv variable-name)
Arguments
variable-name
Return Values
A string representing the value assigned to the specified system variable. If
the variable does not exist, getenv returns nil.
Examples
Assume the system environment variable ACAD is set to /acad/support and there
is no variable named NOSUCH.
"/acad/support"
nil
"10000"
See Also
-------------------------------------------------------------------------------
getfiled
Prompts the user for a file name with the standard AutoCAD file dialog box, and
returns that file name
https://www.theswamp.org/Sources/doc/avlisp/#trans 68/300
5/8/23, 12:24 PM Auto/Visual lisp help
through different drives and directories, select an existing file, or specify
the name of a new file.
Arguments
title
default
ext
The default file name extension. If ext is passed as a null string (""), it
defaults to * (all file types).
If the file type dwg is included in the ext argument, the getfiled function
displays an image preview in the dialog.
flags
An integer value (a bit-coded field) that controls the behavior of the dialog
box. To set more than one condition at a time, add the values together to
create a flags value between 0 and 15. The following flags arguments are
recognized by getfiled:
1 (bit 0) Prompt for the name of a new file to create. Do not set this bit when
you prompt for the name of an existing file to open. In the latter case, if the
user enters the name of a file that doesn't exist, the dialog box displays an
error message at the bottom of the box.
If this bit is set and the user chooses a file that already exists, AutoCAD
displays an alert box and offers the choice of proceeding with or canceling the
operation.
4 (bit 2) Let the user enter an arbitrary file name extension, or no extension
at all.
If this bit is not set, getfiled accepts only the extension specified in the
ext argument and appends this extension to the file name if the user doesn't
enter it in the File text box.
8 (bit 3) If this bit is set and bit 0 is not set, getfiled performs a library
search for the file name entered. If it finds the file and its directory in the
library search path, it strips the path and returns only the file name. (It
does not strip the path name if it finds that a file of the same name is in a
different directory.)
If this bit is not set, getfiled returns the entire file name, including the
path name.
Set this bit if you use the dialog box to open an existing file whose name you
want to save in the drawing (or other database).
16 (bit 4) If this bit is set, or if the default argument ends with a path
delimiter, the argument is interpreted as a path name only. The getfiled
function assumes that there is no default file name. It displays the path in
the Look in: line and leaves the File name box blank.
32 (bit 5) If this bit is set and bit 0 is set (indicating that a new file is
being specified), users will not be warned if they are about to overwrite an
existing file. The alert box to warn users that a file of the same name already
exists will not be displayed; the old file will just be replaced.
64 (bit 6) Do not transfer the remote file if the user specifies a URL.
Return Values
If the dialog box obtains a file name from the user, getfiled returns a string
that specifies the file name; otherwise, it returns nil.
Examples
The following call to getfiled displays the Select a Lisp File dialog box:
https://www.theswamp.org/Sources/doc/avlisp/#trans 69/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
getint
(getint [msg])
Values passed to getint can range from -32,768 to +32,767. If the user enters
something other than an integer, getint displays the message "Requires an
integer value," and allows the user to try again. The users cannot enter
another AutoLISP expression as the response to a getint request.
Arguments
msg
Return Values
The integer specified by the user; or nil, if the user presses ENTER without
entering an integer.
Examples
15
15
Enter a number:25
25
15.0
15
15
See Also
The initget function in this reference and The getxxx Functions in the Visual
LISP Developer's Guide.
-------------------------------------------------------------------------------
getkword
(getkword [msg])
Valid keywords are set prior to the getkword call with the initget function.
The user cannot enter another AutoLISP expression as the response to a getkword
request.
Arguments
msg
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 70/300
5/8/23, 12:24 PM Auto/Visual lisp help
A string representing the keyword entered by the user, or nil, if the user
presses ENTER without typing a keyword. The function also returns nil if it was
not preceded by a call to initget to establish one or more keywords.
If the user enters a value that is not a valid keyword, getkword displays a
warning message and prompts the user to try again.
Examples
The following example shows an initial call to initget that sets up a list of
keywords (Yes and No) and disallows null input (bits value equal to 1) to the
getkword call that follows:
nil
"Yes"
The following sequence illustrates what happens if the user enters invalid
input in response to getkword:
nil
"Yes"
The user's response was not one of the keywords defined by the preceding
initget, so getkword issued an error message and then prompted the user again
with the string supplied in the msg argument.
See Also
The initget function in this reference and The getxxx Functions in the Visual
LISP Developer's Guide.
-------------------------------------------------------------------------------
getorient
Pauses for user input of an angle, and returns that angle in radians
The getorient function measures angles with the zero-radian direction to the
right (east) and angles that are increasing in the counterclockwise direction.
The angle input by the user is based on the current settings of ANGDIR and
ANGBASE, but once an angle is provided, it is measured in a counterclockwise
direction, with zero radians being to the right (ignoring ANGDIR and ANGBASE).
Therefore, some conversion must take place if you select a different
zero-degree base or a different direction for increasing angles by using the
UNITS command or the ANGBASE and ANGDIR system variables.
Use getangle when you need a rotation amount (a relative angle). Use getorient
to obtain an orientation (an absolute angle).
Arguments
pt
msg
Return Values
The angle specified by the user, in radians, with respect to the current
construction plane.
Examples
5.61582
See Also
The getangle function in this reference and The getxxx Functions in the
Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
getpoint
Arguments
pt
Note that getpoint will accept a single integer or real number as the pt
argument, and use the AutoCAD direct distance entry mechanism to determine a
point. This mechanism uses the value of the LASTPOINT system variable as the
starting point, the pt input as the distance, and the current cursor location
as the direction from LASTPOINT. The result is a point that is the specified
number of units away from LASTPOINT in the direction of the current cursor
location.
msg
Return Values
A 3D point, expressed in terms of the current UCS.
Examples
(setq p (getpoint))
See Also
-------------------------------------------------------------------------------
getreal
https://www.theswamp.org/Sources/doc/avlisp/#trans 72/300
5/8/23, 12:24 PM Auto/Visual lisp help
Pauses for user input of a real number, and returns that real number
(getreal [msg])
The user cannot enter another AutoLISP expression as the response to a getreal
request.
Arguments
msg
Return Values
Examples
-------------------------------------------------------------------------------
getstring
Arguments
cr
If supplied and not nil, this argument indicates that users can include blanks
in their input string (and must terminate the string by pressing ENTER).
Otherwise, the input string is terminated by space or ENTER.
msg
Return Values
The string entered by the user, or nil, if the user pressed ENTER without
typing a string.
If the string is longer than 132 characters, getstring returns only the first
132 characters of the string. If the input string contains the backslash
character (\), getstring converts it to two backslash characters (\\). This
allows you to use returned values containing file name paths in other
functions.
Examples
"Gary"
"c:\\my documents\\vlisp\\secrets"
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 73/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
getvar
(getvar varname)
Arguments
varname
A string or symbol that names a system variable. See the Command Reference for
a list of current AutoCAD system variables.
Return Values
The value of the system variable, or nil, if varname is not a valid system
variable.
Examples
0.25
See Also
-------------------------------------------------------------------------------
graphscr
(graphscr)
This function is equivalent to the GRAPHSCR command or pressing the Flip Screen
function key. The textscr function is the complement of graphscr.
Returns
nil
See Also
-------------------------------------------------------------------------------
grclear
(grclear)
Returns
nil
-------------------------------------------------------------------------------
grdraw
https://www.theswamp.org/Sources/doc/avlisp/#trans 74/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
from
to
color
An integer identifying the color used to draw the vector. A -1 signifies XOR
ink, which complements anything it draws over and which erases itself when
overdrawn.
highlight
An integer, other than zero, indicating that the vector is to be drawn using
the default highlighting method of the display device (usually dashed).
Return Values
nil
See Also
-------------------------------------------------------------------------------
grread
Only specialized AutoLISP routines need this function. Most input to AutoLISP
should be obtained through the various getxxx functions.
Arguments
track
If supplied and not nil, this argument enables the return of coordinates from a
pointing device as it is moved
allkeys
An integer representing a code that tells grread what functions to perform. The
allkeys bit code values can be added together for combined functionality. The
following values can be specified:
1 (bit 0) Return drag mode coordinates. If this bit is set and the user moves
the pointing device instead of selecting a button or pressing a key, grread
returns a list where the first member is a type 5 and the second member is the
(X,Y) coordinates of the current pointing device (mouse or digitizer) location.
This is how AutoCAD implements dragging.
2 (bit 1) Return all key values, including function and cursor key codes, and
don't move the cursor when the user presses a cursor key.
4 (bit 2) Use the value passed in the curtype argument to control the cursor
display.
8 (bit 3) Don't display the error: console break message when the user presses
ESC.
curtype
https://www.theswamp.org/Sources/doc/avlisp/#trans 75/300
5/8/23, 12:24 PM Auto/Visual lisp help
An integer indicating the type of cursor to be displayed. The allkeys value for
bit 2 must be set for the curtype values to take effect. The curtype argument
affects only the cursor type during the current grread function call. You can
specify one of the following values for curtype:
Return Values
The grread function returns a list whose first element is a code specifying the
type of input. The second element of the list is either an integer or a point,
depending on the type of input. The return values are listed in the following
table:
+----------------+-------------------------+---------------+-------------------+
| grread return values |
+----------------+-------------------------+---------------+-------------------+
| First element | Second element |
+----------------+-------------------------+---------------+-------------------+
| Value | Type of input | Value | Description |
+----------------+-------------------------+---------------+-------------------+
| 2 | Keyboard input | varies | Character code |
+----------------+-------------------------+---------------+-------------------+
| 3 | Selected point | 3D point | Point coordinates |
+----------------+-------------------------+---------------+-------------------+
| 4 | Screen/pull-down menu | 0 to 999 | Screen menu box |
| | item (from pointing | 1001 to 1999 | no. |
| | device) | 2001 to 2999 | POP1 menu box no. |
| | | 3001 to 3999 | POP2 menu box no. |
| | | ... and so | POP3 menu box no. |
| | | on, to | ... and so on, to |
| | | 16001 to | POP16 menu box |
| | | 16999 | no. |
+----------------+-------------------------+---------------+-------------------+
| 5 | Pointing device | 3D point | Drag mode |
| | (returned only if | | coordinate |
| | tracking is enabled) | | |
+----------------+-------------------------+---------------+-------------------+
| 6 | BUTTONS menu item | 0 to 999 | BUTTONS1 menu |
| | | 1000 to 1999 | button no. |
| | | 2000 to 2999 | BUTTONS2 menu |
| | | 3000 to 3999 | button no. |
| | | | BUTTONS3 menu |
| | | | button no. |
| | | | BUTTONS4 menu |
| | | | button no. |
+----------------+-------------------------+---------------+-------------------+
| 7 | TABLET1 menu item | 0 to 32767 | Digitized box no. |
+----------------+-------------------------+---------------+-------------------+
| 8 | TABLET2 menu item | 0 to 32767 | Digitized box no. |
+----------------+-------------------------+---------------+-------------------+
| 9 | TABLET3 menu item | 0 to 32767 | Digitized box no. |
+----------------+-------------------------+---------------+-------------------+
| 10 | TABLET4 menu item | 0 to 32767 | Digitized box no. |
+----------------+-------------------------+---------------+-------------------+
| 11 | AUX menu item | 0 to 999 | AUX1 menu button |
| | | 1000 to 1999 | no. |
| | | 2000 to 2999 | AUX2 menu button |
| | | 3000 to 3999 | no. |
| | | | AUX3 menu button |
| | | | no. |
| | | | AUX4 menu button |
| | | | no. |
+----------------+-------------------------+---------------+-------------------+
| 12 | Pointer button | 3D point | Point coordinates |
| | (follows a type 6 or | | |
| | type 11 return) | | |
+----------------+-------------------------+---------------+-------------------+
Handling User Input with grread
Entering ESC while a grread is active aborts the AutoLISP program with a
keyboard break (unless the allkeys argument has disallowed this). Any other
input is passed directly to grread, giving the application complete control
over the input devices.
If the user presses the pointer button within a screen menu or pull-down menu
box, grread returns a type 6 or type 11 code, but in a subsequent call, it does
not return a type 12 code: the type 12 code follows type 6 or type 11 only when
the pointer button is pressed while it is in the drawing area.
https://www.theswamp.org/Sources/doc/avlisp/#trans 76/300
5/8/23, 12:24 PM Auto/Visual lisp help
It is important to clear the code 12 data from the buffer before attempting
another operation with a pointer button or an auxiliary button. To accomplish
this, perform a nested grread like this:
This sequence captures the value of the code 12 list as streaming input from
the device.
-------------------------------------------------------------------------------
grtext
This function displays the supplied text in the menu area; it does not change
the underlying menu item. The grtext function can be called with no arguments
to restore all text areas to their standard values.
Arguments
box
text
A string that specifies the text to be written to the screen menu or status
line location. The text argument is truncated if it is too long to fit in the
available area.
highlight
If called without arguments, grtext restores all text areas to their standard
values. If called with only one argument, grtext results in an error.
Return Values
The string passed in the text argument, if successful, and nil if unsuccessful
or no arguments are supplied.
Setting box to a positive or zero value specifies a screen menu location. Valid
box values range from 0 to the highest-numbered screen menu box minus 1. The
SCREENBOXES system variable reports the maximum number of screen menu boxes. If
the highlight argument is supplied as a positive integer, grtext highlights the
text in the designated box. Highlighting a box automatically dehighlights any
other box already highlighted. If highlight is zero, the menu item is
dehighlighted. If highlight is a negative number, it is ignored. On some
platforms, the text must first be written without the highlight argument and
then must be highlighted. Highlighting of a screen menu location works only
when the cursor is not in that area.
If grtext is called with a box value of -1, it writes the text into the mode
status line area. The length of the mode status line differs from display to
display (most allow at least 40 characters). The following code uses the
$(linelen) DIESEL expression to report the length of the mode status area.
If a box value of -2 is used, grtext writes the text into the coordinate status
line area. If coordinate tracking is turned on, values written into this field
are overwritten as soon as the pointer sends another set of coordinates. For
both -1 or -2 box values, the highlight argument is ignored.
-------------------------------------------------------------------------------
grvecs
Arguments
vlist
A vector list is comprised of a series of optional color integers and two point
lists. See <PARAM name="Item2" value="Vector List Format;vlref132.html"> for
details on how to format vlist.
trans
Return Values
nil
The color value applies to all succeeding vectors until vlist specifies another
color. AutoCAD colors are in the range 0-255. If the color value is greater
than 255, succeeding vectors are drawn in XOR ink, which complements anything
it draws over and which erases itself when overdrawn. If the color value is
less than zero, the vector is highlighted. Highlighting depends on the display
device. Most display devices indicate highlighting by a dashed line, but some
indicate it by using a distinctive color.
A pair of point lists, from and to, specify the endpoints of the vectors,
expressed in the current UCS. These can be 2D or 3D points. You must pass these
points as pairs--two successive point lists--or the grvecs call will fail.
Examples
The following code draws five vertical lines in the drawing area, each a
different color:
) )
See Also
The nentselp function for more information on transformation matrixes and the
grdraw function for a routine that draws a vector between two points.
handent
https://www.theswamp.org/Sources/doc/avlisp/#trans 78/300
5/8/23, 12:24 PM Auto/Visual lisp help
(handent handle)
The handent function returns the entity name of both graphic and nongraphic
entities.
Arguments
handle
Return Values
If successful, handent returns the entity name associated with handle in the
current editing session. If handent is passed an invalid handle or a handle not
used by any entity in the current drawing, it returns nil.
The handent function returns entities that have been deleted during the current
editing session. You can undelete them with the entdel function.
An entity's name can change from one editing session to the next, but an
entity's handle remains constant.
Examples
Used with the same drawing but in another editing session, the same call might
return a different entity name. Once the entity name is obtained, you can use
it to manipulate the entity with any of the entity-related functions.
-------------------------------------------------------------------------------
help
Arguments
helpfile
A string naming the Help file. The file extension is not required with the
helpfile argument. If a file extension is provided, AutoCAD looks only for a
file with the exact name specified.
topic
A string identifying a Help topic ID. If you are calling a topic within a CHM
file, provide the file name without the extension; AutoCAD adds an .htm
extension.
command
A string that specifies the initial state of the Help window. The command
argument is a string used by the uCommand (in HTML Help) or the fuCommand (in
WinHelp) argument of the HtmlHelp() and WinHelp() functions as defined in the
Microsoft Windows SDK.
Return Values
The helpfile string, if successful, otherwise nil. If you use help without any
arguments, it returns an empty string ("") if successful, and nil if it fails.
The only error condition that the help function returns to the application is
https://www.theswamp.org/Sources/doc/avlisp/#trans 79/300
5/8/23, 12:24 PM Auto/Visual lisp help
the existence of the file specified by helpfile. All other error conditions are
reported to the user through a dialog box.
Examples
The following code calls help to display the information on MYCOMMAND in the
Help file achelp.chm:
See Also
if
Arguments
testexpr
Expression to be tested.
thenexpr
elseexpr
Return Values
Examples
"no."
"YES!!"
nil
See Also
-------------------------------------------------------------------------------
initdia
(initdia [dialogflag])
Currently, the following commands make use of the initdia function: ATTDEF,
ATTEXT, BHATCH, BLOCK, COLOR, IMAGE, IMAGEADJUST, INSERT, LAYER, LINETYPE,
MTEXT, PLOT, RENAME, STYLE, TOOLBAR, and VIEW.
Arguments
dialogflag
https://www.theswamp.org/Sources/doc/avlisp/#trans 80/300
5/8/23, 12:24 PM Auto/Visual lisp help
An integer. If this argument is not present or is present and nonzero, the next
use (and next use only) of a command will display that command's dialog box
rather than its command line prompts.
Return Values
nil
Examples
plot
Use the following sequence of function calls to make AutoCAD display the Plot
dialog box:
(initdia)
(command "_.PLOT")
-------------------------------------------------------------------------------
initget
The functions that honor keywords are getint, getreal, getdist, getangle,
getorient, getpoint, getcorner, getkword, entsel, nentsel, and nentselp. The
getstring function is the only user-input function that does not honor
keywords.
The keywords are checked by the next user-input function call when the user
does not enter the expected type of input (for example, a point to getpoint).
If the user input matches a keyword from the list, the function returns that
keyword as a string result. The application can test for the keywords and
perform the action associated with each one. If the user input is not an
expected type and does not match a keyword, AutoCAD asks the user to try again.
The initget bit values and keywords apply only to the next user-input function
call.
If initget sets a control bit and the application calls a user-input function
for which the bit has no meaning, the bit is ignored.
If the user input fails one or more of the specified conditions (as in a zero
value when zero values are not allowed), AutoCAD displays a message and asks
the user to try again.
Arguments
bits
A bit-coded integer that allows or disallows certain types of user input. The
bits can be added together in any combination to form a value between 0 and
255. If no bits argument is supplied, zero (no conditions) is assumed. The bit
values are as follows:
1 (bit 0) Prevents the user from responding to the request by entering only
ENTER.
2 (bit 1) Prevents the user from responding to the request by entering zero.
8 (bit 3) Allows the user to enter a point outside the current drawing limits.
https://www.theswamp.org/Sources/doc/avlisp/#trans 81/300
5/8/23, 12:24 PM Auto/Visual lisp help
This condition applies to the next user-input function even if the AutoCAD
system variable LIMCHECK is currently set.
32 (bit 5) Uses dashed lines when drawing a rubber-band line or box. For those
functions with which the user can specify a point by selecting a location in
the drawing area, this bit value causes the rubber-band line or box to be
dashed instead of solid. (Some display drivers use a distinctive color instead
of dashed lines.) If the system variable POPUPS is 0, AutoCAD ignores this bit.
Note: Future versions of AutoLISP may use additional initget control bits, so
avoid setting bits that are not listed here.
string
Return Values
nil
The special control values are honored only by those getxxx functions for which
they make sense, as indicated in the following table:
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| User-input functions and applicable control bits |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| Function | Honors | Control bits values |
| | key | |
| | words | |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| | | No | No | No | No | Uses | 2D | Arbitrary |
| | | null | zero | negative | limits | dashes | distance | Input |
| | | (1) | (2) | (4) | (8) | (32) | (64) | (128) |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getint | X | X | X | X | | | | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getreal | X | X | X | X | | | | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getdist | X | X | X | X | | X | X | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getangle | X | X | X | | | X | | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getorient | X | X | X | | | X | | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getpoint | X | X | | | X | X | | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getcorner | X | X | | | X | X | | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| getkword | X | X | | | | | | X |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| entsel | X | | | | | | | |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| nentsel | X | | | | | | | |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
| nentselp | X | | | | | | | |
+------------+--------+---------+------+----------+--------+--------+----------+-----------+
Keyword Specifications
* Each keyword is separated from the following keyword by one or more spaces.
For example, "Width Height Depth" defines three keywords.
* Each keyword can contain only letters, numbers, and hyphens (-).
https://www.theswamp.org/Sources/doc/avlisp/#trans 82/300
5/8/23, 12:24 PM Auto/Visual lisp help
* The entire keyword is specified in uppercase characters, and it is followed
immediately by a comma, which is followed by the required characters (for
example, "LTYPE,LT"). The keyword characters in this case must include the
first letter of the keyword, which means that "EXIT,X" is not valid.
The two brief examples, "LType" and "LTYPE,LT", are equivalent: if the user
types LT (in either uppercase or lowercase letters), this is sufficient to
identify the keyword. The user can enter characters that follow the required
portion of the keyword, provided they don't conflict with the specification. In
the example, the user could also enter LTY or LTYP, but L would not be
sufficient.
The initget function provides support for localized keywords. The following
syntax for the keyword string allows input of the localized keyword while it
returns the language independent keyword:
where local1 through localn are the localized keywords, and indep1 through
indepn are the language-independent keywords.
See Also
-------------------------------------------------------------------------------
inters
All points are expressed in terms of the current UCS. If all four point
arguments are 3D, inters checks for 3D intersection. If any of the points are
2D, inters projects the lines onto the current construction plane and checks
only for 2D intersection.
Arguments
pt1
pt2
pt3
pt4
onseg
If specified as nil, the lines defined by the four pt arguments are considered
infinite in length. If the onseg argument is omitted or is not nil, the
intersection point must lie on both lines or inters returns nil.
Return Values
If the onseg argument is present and is nil, inters returns the point where the
lines intersect, even if that point is off the end of one or both of the lines.
https://www.theswamp.org/Sources/doc/avlisp/#trans 83/300
5/8/23, 12:24 PM Auto/Visual lisp help
If the onseg argument is omitted or is not nil, the intersection point must lie
on both lines or inters returns nil. The inters function returns nil if the two
lines do not intersect.
Examples
Command: (inters a b c d)
nil
Command: (inters a b c d T)
nil
(4.0 4.0)
-------------------------------------------------------------------------------
itoa
(itoa int)
Arguments
int
An integer.
Return Values
A string derived from int.
Examples
"33"
"-17"
See Also
lambda
Use the lambda function when the overhead of defining a new function is not
justified. It also makes the programmer's intention more apparent by laying out
the function at the spot where it is to be used. This function returns the
value of its last expr, and is often used in conjunction with apply and/or
mapcar to perform a function on a list.
Arguments
arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 84/300
5/8/23, 12:24 PM Auto/Visual lisp help
An AutoLISP expression.
Return Values
The value of the last expr.
Examples
The following examples demonstrate the lambda function from the Visual LISP
Console window:
_$ (apply '(lambda (x y z)
(* x (- y z))
'(5 20 14)
30
_$ (setq counter 0)
(* x 5)
'(2 4 -6 10.2)
-------------------------------------------------------------------------------
last
(last lst)
Arguments
lst
A list.
Return Values
An atom or a list.
Examples
(D E)
-------------------------------------------------------------------------------
layoutlist
https://www.theswamp.org/Sources/doc/avlisp/#trans 85/300
5/8/23, 12:24 PM Auto/Visual lisp help
(layoutlist)
Return Values
A list of strings.
Examples
Command: (layoutlist)
("Layout1" "Layout2")
-------------------------------------------------------------------------------
length
(length lst)
Arguments
lst
A list.
Return Values
An integer.
Examples
See Also
-------------------------------------------------------------------------------
list
Takes any number of expressions, and combines them into one list
(list [expr...])
Arguments
expr
An AutoLISP expression.
Return Values
A list, unless no expressions are supplied, in which case list returns nil.
Examples
(A B C)
https://www.theswamp.org/Sources/doc/avlisp/#trans 86/300
5/8/23, 12:24 PM Auto/Visual lisp help
(A (B C) D)
(3.9 6.7)
As an alternative to using the list function, you can explicitly quote a list
with the quote function if there are no variables or undefined items in the
list. The single quote character (') is defined as the quote function.
This can be useful for creating association lists and defining points.
See Also
-------------------------------------------------------------------------------
listp
(listp item)
Arguments
item
Return Values
T if item is a list, nil otherwise. Because nil is both an atom and a list, the
listp function returns T when passed nil.
Examples
nil
nil
See Also
-------------------------------------------------------------------------------
load
The load function can be used from within another AutoLISP function, or even
recursively (in the file being loaded).
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 87/300
5/8/23, 12:24 PM Auto/Visual lisp help
filename
A string that represents the file name. If the filename argument does not
specify a file extension, load adds an extension to the name when searching for
a file to load. The function will try several extensions, if necessary, in the
following order:
* .vlx
* .fas
* .lsp
As soon as load finds a match, it stops searching and loads the file.
onfailure
Return Values
Examples
For the following examples, assume that file /fred/test1.lsp contains the
expressions
...function body...
...function body...
and that no file named test2 with a .lsp, .fas, or .vlx extension exists:
MY-FUNC2
MY-FUNC2
MY-FUNC2
"bad"
See Also
-------------------------------------------------------------------------------
load_dialog
(load_dialog dclfile)
https://www.theswamp.org/Sources/doc/avlisp/#trans 88/300
5/8/23, 12:24 PM Auto/Visual lisp help
The load_dialog function searches for files according to the AutoCAD library
search path.
Arguments
dclfile
A string that specifies the DCL file to load. If the dclfile argument does not
specify a file extension, .dcl is assumed.
Return Values
-------------------------------------------------------------------------------
log
(log num)
Arguments
num
A positive number.
Return Values
A real number.
Examples
Command: (log 4.5)
1.50408
0.198851
-------------------------------------------------------------------------------
logand
Arguments
int
An integer.
Return Values
Examples
Command: (logand 7 15 3)
Command: (logand 8 3 4)
https://www.theswamp.org/Sources/doc/avlisp/#trans 89/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
logior
Arguments
int
An integer.
Return Values
An integer (0, if no arguments are supplied).
Examples
Command: (logior 1 2 4)
Command: (logior 9 3)
11
-------------------------------------------------------------------------------
lsh
Arguments
int
An integer.
numbits
Return Values
The value of int after the bitwise shift. The returned value is positive if the
significant bit (bit number 31) contains a 0 after the shift operation,
otherwise it is negative. If no arguments are supplied, lsh returns 0.
The behavior is different from other languages (>> & << of C, C++, or Java)
where more than 32 left shifts (of a 32 bit integer) results 0. In right shift
also the integer appears again on every 32 shifts.
Examples
Command: (lsh 2 1)
Command: (lsh 40 2)
https://www.theswamp.org/Sources/doc/avlisp/#trans 90/300
5/8/23, 12:24 PM Auto/Visual lisp help
160
mapcar
Returns a list that is the result of executing a function with a list (or
lists) supplied as arguments to the function
Arguments
function
A function.
list1... listn
One or more lists. The number of lists must match the number of arguments
required by function.
Return Values
A list.
Examples
30
(11 21 31)
(1+ a)
(1+ b)
(1+ c)
(+ x 3)
'(10 20 30)
(13 23 33)
-------------------------------------------------------------------------------
max
Arguments
number
https://www.theswamp.org/Sources/doc/avlisp/#trans 91/300
5/8/23, 12:24 PM Auto/Visual lisp help
A number.
Return Values
A number. If any of the arguments are real numbers, a real is returned,
otherwise an integer is returned. If no argument is supplied, max returns 0.
Examples
Command: (max 4.07 -144)
4.07
19
8.0
-------------------------------------------------------------------------------
mem
(mem)
The mem function displays statistics on AutoLISP memory usage. The first line
of this statistics report contains the following information:
GC calls
GC run time
PgSz
Used
Free
FMCL
Segs
Type
The final line in the report lists the minimal segment size and the number of
allocated segments. AutoLISP keeps a list of no more than three free segments,
in order to save system calls for memory requests.
All heap memory is global; that is, all AutoCAD documents share the same heap.
This could change in future releases of AutoCAD.
Note that mem does not list all memory requested from the operating system,
only those requests served by the AutoLISP Dynamic Memory (DM) subsystem; some
AutoLISP classes do not use DM for memory allocation.
Return Values
nil
Examples
Command: (mem)
nil
-------------------------------------------------------------------------------
member
Arguments
expr
lst
Return Values
A list, or nil, if there is no occurrence of expr in lst.
Examples
Command: (member 'c '(a b c d e))
(C D E)
nil
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 93/300
5/8/23, 12:24 PM Auto/Visual lisp help
menucmd
(menucmd string)
The menucmd function can switch between subpages in an AutoCAD menu. This
function can also force the display of menus. This allows AutoLISP programs to
use image tile menus and to display other menus from which the user can make
selections. AutoLISP programs can also enable, disable, and place marks in menu
items.
Arguments
string
A string that specifies a menu area and the value to assign to that menu area.
The string argument has the following parameters.
"menu_area=value"
The allowed values of menu_area, shown in the following list, are the same as
they are in menu file submenu references. For more information, see Pull-Down
and Shortcut Menus in the Customization Guide.
S SCREEN menu.
Return Values
nil
Examples
The following code displays the image tile menu MOREICONS.
The following code checks the status of the third menu item in the pull-down
menu POP11. If the menu item is currently enabled, the menucmd function
disables it.
The menucmd function also allows AutoLISP programs to take advantage of the
DIESEL string expression language. Some things can be done much easier with
DIESEL than with the equivalent AutoLISP code. The following code returns a
string containing the current day and date:
https://www.theswamp.org/Sources/doc/avlisp/#trans 94/300
5/8/23, 12:24 PM Auto/Visual lisp help
See Also
The Customization Guide for more information on using AutoLISP to access menu
label status, and for information on using DIESEL.
-------------------------------------------------------------------------------
menugroup
(menugroup groupname)
Arguments
groupname
Return Values
If groupname matches a loaded menugroup, the function returns the groupname
string; otherwise, it returns nil.
-------------------------------------------------------------------------------
min
Arguments
number
A number.
Return Values
A number. If any number argument is a real, a real is returned, otherwise an
integer is returned. If no argument is supplied, min returns 0.
Examples
Command: (min 683 -10.0)
-10.0
Command: (min 73 2 48 5)
2.0
2.0
-------------------------------------------------------------------------------
minusp
(minusp num)
Arguments
num
https://www.theswamp.org/Sources/doc/avlisp/#trans 95/300
5/8/23, 12:24 PM Auto/Visual lisp help
A number.
Return Values
Examples
Command: (minusp -1)
nil
-------------------------------------------------------------------------------
mode_tile
Arguments
key
mode
0 Enable tile
1 Disable tile
Return Values
nil
namedobjdict
Returns the entity name of the current drawing's named object dictionary, which
is the root of all nongraphical objects in the drawing
(namedobjdict)
Using the name returned by this function and the dictionary access functions,
an application can access the nongraphical objects in the drawing.
-------------------------------------------------------------------------------
nentsel
https://www.theswamp.org/Sources/doc/avlisp/#trans 96/300
5/8/23, 12:24 PM Auto/Visual lisp help
(nentsel [msg])
The nentsel function prompts the user to select an object. The current Object
Snap mode is ignored unless the user specifically requests it. To provide
additional support at the Command prompt, nentsel honors keywords defined by a
previous call to initget.
Arguments
msg
Return Values
When the selected object is not complex (i.e., not a 3D polyline or block),
nentsel returns the same information as entsel. However, if the selected object
is a 3D polyline, nentsel returns a list containing the name of the subentity
(vertex) and the pick point. This is similar to the list returned by entsel,
except that the name of the selected vertex is returned instead of the polyline
header. The nentsel function always returns the starting vertex of the selected
3D polyline segment. Picking the third segment of the polyline, for example,
returns the third vertex. The Seqend subentity is never returned by nentsel for
a 3D polyline.
The first element of the list returned from picking an object within a block is
the selected entity's name. The second element is a list containing the
coordinates of the point used to pick the object.
Note: nentsel is the only AutoLISP function that uses a matrix of this type;
the nentselp function returns a matrix similar to those used by other AutoLISP
and ObjectARX functions.
The fourth element is a list containing the entity name of the block that
contains the selected object. If the selected object is in a nested block (a
block within a block), the list additionally contains the entity names of all
blocks in which the selected object is nested, starting with the innermost
block and continuing outward until the name of the block that was inserted in
the drawing is reported.
For information on converting MCS coordinates to WCS, see Entity Context and
Coordinate Transform Data in the Using AutoLISP to Manipulate AutoCAD Objects
chapter of the Visual LISP Developer's Guide.
Examples
Draw a 3Dpolyline with multiple line segments, then load and run the following
function and select different segments of the line. Pick off of the line and
then pick the same segments again to see the subentity handle. Try it with a
lightweight polyline to see the difference.
(defun c:subent ()
(while
(while
https://www.theswamp.org/Sources/doc/avlisp/#trans 97/300
5/8/23, 12:24 PM Auto/Visual lisp help
(print (strcat "Entity or subEntity handle is: "
(cdr (assoc 5 (entget (car Ent))))))
(prompt "\nDone.")
(princ)
See Also
-------------------------------------------------------------------------------
nentselp
Provides similar functionality to that of the nentsel function without the need
for user input
Arguments
msg
pt
Return Values
The first three columns of the matrix specify scaling and rotation. The fourth
column is a translation vector.
The functions that use a matrix of this type treat a point as a column vector
of dimension 4. The point is expressed in homogeneous coordinates, where the
fourth element of the point vector is a scale factor that is normally set to
1.0. The final row of the matrix, the vector [M30 M31 M32 M33], has the nominal
value of [0 0 0 1]; it is currently ignored by the functions that use this
matrix format. In this convention, applying a transformation to a point is a
matrix multiplication that appears as follows:
As these equations show, the scale factor and the last row of the matrix have
no effect and are ignored.
See Also
-------------------------------------------------------------------------------
new_dialog
Begins a new dialog box and displays it, and can also specify a default action
Arguments
dlgname
https://www.theswamp.org/Sources/doc/avlisp/#trans 98/300
5/8/23, 12:24 PM Auto/Visual lisp help
dcl_id
action
The default action is evaluated when the user picks an active tile that doesn't
have an action or callback explicitly assigned to it by action_tile or in DCL.
screen-pt
A 2D point list that specifies the X,Y location of the dialog box on the
screen. The point specifies the upper-left corner of the dialog box. If you
pass the point as'(-1 -1), the dialog box is opened in the default position
(the center of the AutoCAD drawing area).
Return Values
T, if successful, otherwise nil.
See Also
The Managing Dialog Boxes chapter of the Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
not
(not item)
Typically, the null function is used for lists, and not is used for other data
types along with some types of control functions.
Arguments
item
An AutoLISP expression.
Return Values
T if item evaluates to nil, nil otherwise.
Examples
nil
Command: (not a)
nil
Command: (not b)
nil
Command: (not c)
See Also
-------------------------------------------------------------------------------
nth
https://www.theswamp.org/Sources/doc/avlisp/#trans 99/300
5/8/23, 12:24 PM Auto/Visual lisp help
(nth n lst)
Arguments
n
The number of the element to return from the list (zero is the first element).
lst
The list.
Return Values
The nth element of lst. If n is greater than the highest element number of lst,
nth returns nil.
Examples
nil
-------------------------------------------------------------------------------
null
(null item)
Arguments
item
An AutoLISP expression.
Return Values
T if item evaluates to nil, nil otherwise.
Examples
Command: (setq a 123 b "string" c nil)
nil
Command: (null a)
nil
Command: (null b)
nil
Command: (null c)
See Also
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 100/300
5/8/23, 12:24 PM Auto/Visual lisp help
numberp
(numberp item)
Arguments
item
An AutoLISP expression.
Return Values
T if item evaluates to a real or an integer, nil otherwise.
Examples
Command: (setq a 123 b 'a)
Command: (numberp 4)
nil
Command: (numberp a)
Command: (numberp b)
nil
open
Arguments
filename
A string that specifies the name and extension of the file to be opened. If you
do not specify the full path name of the file, open assumes you are referring
to the AutoCAD start-up directory.
mode
Indicates whether the file is open for reading, writing, or appending. Specify
a string containing one of the following letters:
w Open for writing. If filename does not exist, a new file is created and
opened. If filename already exists, its existing data is overwritten. Data
passed to an open file is not actually written until the file is closed with
the close function.
a Open for appending. If filename does not exist, a new file is created and
opened. If filename already exists, it is opened and the pointer is positioned
https://www.theswamp.org/Sources/doc/avlisp/#trans 101/300
5/8/23, 12:24 PM Auto/Visual lisp help
at the end of the existing data, so new data you write to the file is appended
to the existing data.
The mode argument can be uppercase or lowercase. Note that in releases prior to
AutoCAD 2000, mode had to be specified in lowercase.
Return Values
If successful, open returns a file descriptor that can be used by the other I/O
functions. If mode "r" is specified and filename does not exist, open returns
nil.
Note: On DOS systems, some programs and text editors write text files with an
end-of-file marker (CTRL+Z, decimal ASCII code 26) at the end of the text. When
reading a text file, DOS returns an end-of-file status if a CTRL+Z marker is
encountered, even if that marker is followed by more data. If you intend to use
open's "a" mode to append data to files produced by another program, be certain
the other program does not insert CTRL+Z markers at the end of its text files.
Examples
Open an existing file:
The following examples issue open against files that do not exist:
nil
#<file "logfile">
-------------------------------------------------------------------------------
or
(or [expr...])
The or function evaluates the expressions from left to right, looking for a
non-nil expression.
Arguments
expr
Return Values
T, if a non-nil expression is found, or nil, if all of the expressions are nil
or no arguments are supplied.
Examples
Command: (or nil 45 '())
nil
-------------------------------------------------------------------------------
osnap
https://www.theswamp.org/Sources/doc/avlisp/#trans 102/300
5/8/23, 12:24 PM Auto/Visual lisp help
(osnap pt mode)
Arguments
pt
A point.
mode
A string that consists of one or more valid Object Snap identifiers such as
mid, cen, and so on, separated by commas.
Return Values
A point, or nil, if the pick did not return an object (for example, there is no
geometry under the pick aperture, or the geometry is not applicable to the
selected object snap mode). The point returned by osnap depends on the current
3D view, the AutoCAD entity around pt, and the setting of the APERTURE system
variable.
Examples
Command: (setq pt1 (getpoint))
polar
Returns the UCS 3D point at a specified angle and distance from a point
Arguments
pt
A 2D or 3D point.
ang
dist
Return Values
Examples
Supplying a 3D point to polar:
(2.0 2.0)
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 103/300
5/8/23, 12:24 PM Auto/Visual lisp help
prin1
Arguments
expr
file-desc
Return Values
The value of the evaluated expr. If called with no arguments, prin1 returns a
null symbol.
Examples
Command: (setq a 123 b '(a))
(A)
AA
Command: (prin1 a)
123123
Command: (prin1 b)
(A)(A)
"Hello"
+---------------+-----------------------------------+
| Control codes |
+---------------+-----------------------------------+
| Code | Description |
+---------------+-----------------------------------+
| \\ | \ character |
+---------------+-----------------------------------+
| \" | " character |
+---------------+-----------------------------------+
| \e | Escape character |
+---------------+-----------------------------------+
| \n | Newline character |
+---------------+-----------------------------------+
| \r | Return character |
+---------------+-----------------------------------+
| \t | TAB character |
+---------------+-----------------------------------+
| \nnn | Character whose octal code is nnn |
+---------------+-----------------------------------+
https://www.theswamp.org/Sources/doc/avlisp/#trans 104/300
5/8/23, 12:24 PM Auto/Visual lisp help
The following example shows how to use control characters:
"\002""\002"
See Also
-------------------------------------------------------------------------------
princ
This function is the same as prin1, except control characters in expr are
printed without expansion. In general, prin1 is designed to print expressions
in a way that is compatible with load, while princ prints them in a way that is
readable by functions such as read-line.
Arguments
expr
file-desc
Return Values
The value of the evaluated expr. If called with no arguments, princ returns a
null symbol.
See Also
-------------------------------------------------------------------------------
This function is the same as prin1, except it prints a newline character before
expr, and prints a space following expr.
Arguments
expr
file-desc
Return Values
The value of the evaluated expr. If called with no arguments, print returns a
null symbol.
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 105/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
progn
Evaluates each expression sequentially and returns the value of the last
expression
(progn [expr]...)
You can use progn to evaluate several expressions where only one expression is
expected.
Arguments
expr
Return Values
The result of the last evaluated expression.
Examples
The if function normally evaluates one then expression if the test expression
evaluates to anything but nil. The following example uses progn to evaluate two
expressions following if:
(if (= a b)
(progn
See Also
The if function.
-------------------------------------------------------------------------------
prompt
(prompt msg)
Arguments
msg
A string.
Return Values
nil
Examples
Command: (prompt "New value: ")
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 106/300
5/8/23, 12:24 PM Auto/Visual lisp help
================================ Q Functions ===================================
quit
(quit)
If quit is called, it returns the error message quit/exit abort and returns to
the AutoCAD Command prompt.
See Also
-------------------------------------------------------------------------------
quote
(quote expr)
Arguments
expr
An AutoLISP expression.
Return Values
Examples
Command: (quote a)
Command: !'a
(A B)
See Also
read
(read [string])
The read function parses the string representation of any LISP data and returns
the first expression in the string, converting it to a corresponding data type.
Arguments
string
A string. The string argument should not contain blanks, except within a list
or string.
https://www.theswamp.org/Sources/doc/avlisp/#trans 107/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
A list or atom. The read function returns its argument converted into the
corresponding data type. If no argument is specified, read returns nil.
Examples
HELLO
HELLO
"Hi Y'all"
(A B C)
(A B C)
1.23
87
87
-------------------------------------------------------------------------------
read-char
Returns the decimal ASCII code representing the character read from the
keyboard input buffer or from an open file
(read-char [file-desc])
Arguments
file-desc
Return Values
An integer representing the ASCII code for a character. The read-char function
returns a single newline character (ASCII code 10) whenever it detects an
end-of-line character or character sequence.
Examples
The following example omits file-desc, so read-char looks for data in the
keyboard buffer:
Command: (read-char)
ABC
65
The user entered ABC; read-char returned the ASCII code representing the first
https://www.theswamp.org/Sources/doc/avlisp/#trans 108/300
5/8/23, 12:24 PM Auto/Visual lisp help
character entered (A). The next three calls to read-char return the data
remaining in the keyboard input buffer. This data translates to 66 (the ASCII
code for the letter B), 67 (C), and 10 (newline), respectively:
Command: (read-char)
66
Command: (read-char)
67
Command: (read-char)
10
With the keyboard input buffer now empty, read-char waits for user input the
next time it is called:
Command: (read-char)
-------------------------------------------------------------------------------
read-line
Reads a string from the keyboard or from an open file, until an end-of-line
marker is encountered
(read-line [file-desc])
Arguments
file-desc
Return Values
The string read by read-line, without the end-of-line marker. If read-line
encounters the end of the file, it returns nil.
Examples
Command: (read-line f)
Command: (read-line)
To boldly go
-------------------------------------------------------------------------------
redraw
https://www.theswamp.org/Sources/doc/avlisp/#trans 109/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
ename
mode
An integer value that controls the visibility and highlighting of the entity.
The mode can be one of the following values:
1 Show entity
3 Highlight entity
4 Unhighlight entity
Return Values
The redraw function always returns nil.
-------------------------------------------------------------------------------
regapp
(regapp application)
Arguments
application
A string naming the application. The name must be a valid symbol table name.
See the description of snvalid for the rules AutoLISP uses to determine if a
symbol name is valid.
Return Values
If an application of the same name has already been registered, this function
returns nil; otherwise it returns the name of the application.
Examples
(regapp "ADESK_4153322344")
(regapp "DESIGNER-v2.1-124753")
Note: It is recommended that you pick a unique application name. One way of
ensuring this is to adopt a naming scheme that uses the company or product name
and a unique number (like your telephone number or the current date/ time). The
product version number can be included in the application name or stored by the
application in a separate integer or real-number field; for example, (1040
2.1).
-------------------------------------------------------------------------------
rem
https://www.theswamp.org/Sources/doc/avlisp/#trans 110/300
5/8/23, 12:24 PM Auto/Visual lisp help
Divides the first number by the second, and returns the remainder
Arguments
number
Any number.
If you provide more than two numbers, rem divides the result of dividing the
first number by the second with the third, and so on.
If you provide more than two numbers, rem evaluates the arguments from left to
right. For example, if you supply three numbers, rem divides the first number
by the second, then takes the result and divides it by the third number,
returning the remainder of that operation.
Return Values
A number. If any number argument is a real, rem returns a real, otherwise rem
returns an integer. If no arguments are supplied, rem returns 0. If a single
number argument is supplied, rem returns number.
Examples
12.0
Command: (rem 26 7 2)
-------------------------------------------------------------------------------
repeat
Evaluates each expression a specified number of times, and returns the value of
the last expression
Arguments
int
expr
Return Values
The value of the last expression or atom evaluated. If expr is not supplied,
repeat returns nil.
Examples
100
500
https://www.theswamp.org/Sources/doc/avlisp/#trans 111/300
5/8/23, 12:24 PM Auto/Visual lisp help
"You"
-------------------------------------------------------------------------------
reverse
(reverse lst)
Arguments
lst
A list.
Return Values
A list.
Examples
Command: (reverse '((a) b c))
(C B (A))
-------------------------------------------------------------------------------
rtos
Arguments
number
A number.
mode
An integer specifying the linear units mode. The mode corresponds to the values
allowed for the LUNITS AutoCAD system variable. The mode can be one of the
following numbers:
1 Scientific
2 Decimal
5 Fractional
precision
The mode and precision arguments correspond to the system variables LUNITS and
LUPREC. If you omit the arguments, rtos uses the current settings of LUNITS and
LUPREC.
Return Values
A string. The UNITMODE system variable affects the returned string when
engineering, architectural, or fractional units are selected (mode values 3, 4,
or 5).
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 112/300
5/8/23, 12:24 PM Auto/Visual lisp help
Set variable x:
17.5
"1.7500E+01"
"17.50"
"1'-5.50\""
"1'-5 1/2\""
"17 1/2"
"1'5.50\""
"1'5-1/2\""
"17-1/2"
See Also
set
The set function is similar to setq except that set evaluates both of its
arguments whereas setq only evaluates its second argument.
Arguments
sym
A symbol.
expr
https://www.theswamp.org/Sources/doc/avlisp/#trans 113/300
5/8/23, 12:24 PM Auto/Visual lisp help
An AutoLISP expression.
Return Values
The value of the expression.
Examples
(setq a 5.0)
Both set and setq expect a symbol as their first argument, but set accepts an
expression that returns a symbol, whereas setq does not, as the following
shows:
5.0
See Also
-------------------------------------------------------------------------------
set_tile
Arguments
key
value
A string that names the new value to assign (initially set by the value
attribute).
Return Values
The value the tile was set to.
-------------------------------------------------------------------------------
setcfg
Arguments
cfgname
A string that specifies the section and parameter to set with the value of
cfgval. The cfgname argument must be a string of the following form:
AppData/application_name/section_name/.../param_name
cfgval
https://www.theswamp.org/Sources/doc/avlisp/#trans 114/300
5/8/23, 12:24 PM Auto/Visual lisp help
A string. The string can be up to 512 characters in length. Larger strings are
accepted by setcfg, but cannot be returned by getcfg.
Return Values
If successful, setcfg returns cfgval. If cfgname is not valid, setcfg returns
nil.
Examples
The following code sets the WallThk parameter in the AppData/ArchStuff section
to 8, and returns the string "8":
"8"
See Also
-------------------------------------------------------------------------------
setenv
Arguments
varname
value
Return Values
value
Examples
The following command sets the value of the MaxArray environment variable to
10000:
"10000"
Note that changes to settings might not take effect until the next time AutoCAD
is started.
See Also
-------------------------------------------------------------------------------
setfunhelp
Registers a user-defined command with the Help facility so the appropriate Help
file and topic are called when the user requests help on that command
Arguments
c:fname
A string specifying the user-defined command (the C:XXX function). You must
include the c: prefix.
https://www.theswamp.org/Sources/doc/avlisp/#trans 115/300
5/8/23, 12:24 PM Auto/Visual lisp help
helpfile
A string naming the Help file. The file extension is not required with the
helpfile argument. If a file extension is provided, AutoCAD looks only for a
file with the exact name specified.
topic
A string identifying a Help topic ID. If you are calling a topic within a CHM
file, provide the file name without the extension; AutoCAD adds an .htm
extension.
command
A string that specifies the initial state of the Help window. The command
argument is a string used by the uCommand (in HTML Help) or the fuCommand (in
WinHelp) argument of the HtmlHelp() and WinHelp() functions as defined in the
Microsoft Windows SDK.
Return Values
The string passed as c:fname, if successful, otherwise, nil.
This function verifies only that the c:fname argument has the c: prefix. It
does not verify that the c:fname function exists, nor does it verify the
correctness of the other arguments supplied.
Examples
(defun c:foo ()
After this code is loaded, issuing the foo command and then pressing F1
displays the circle topic.
This example works, but serves no real purpose. In the real world, you would
create your own Help file and associate that help file and topic with your
function.
C:TEST
Associate the function with a call to Help with the string "line":
"c:test"
Run the test command and at the prompt, press F1; you should see the Help topic
for the AutoCAD LINE command.
Note: When you use the defun function to define a C:XXX function, it removes
that function's name from those registered by setfunhelp (if one exists).
Therefore, setfunhelp should only be called after the defun call, which defines
the user-defined command.
See Also
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 116/300
5/8/23, 12:24 PM Auto/Visual lisp help
setq
This is the basic assignment function in AutoLISP. The setq function can assign
multiple symbols in one call to the function.
Arguments
sym
expr
An expression.
Return Values
Examples
The following function call sets variable a to 5.0:
5.0
4.7
"it"
(A B)
See Also
-------------------------------------------------------------------------------
setvar
Arguments
varname
value
https://www.theswamp.org/Sources/doc/avlisp/#trans 117/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
If successful, setvar returns value.
Examples
0.5
When using the setvar function to change the AutoCAD system variable ANGBASE,
the value argument is interpreted as radians. This differs from the AutoCAD
SETVAR command, which interprets this argument as degrees. When using the
setvar function to change the AutoCAD system variable SNAPANG, the value
argument is interpreted as radians relative to the AutoCAD default direction
for angle 0, which is east or 3 o'clock. This also differs from the SETVAR
command, which interprets this argument as degrees relative to the ANGBASE
setting.
Note: The UNDO command does not undo changes made to the CVPORT system
variable by the setvar function.
You can find a list of the current AutoCAD system variables in the Command
Reference.
See Also
-------------------------------------------------------------------------------
setview
Arguments
view_descriptor
vport_id
You can obtain the vport_id number from the CVPORT system variable.
Return Values
-------------------------------------------------------------------------------
sin
(sin ang)
Arguments
ang
An angle, in radians.
https://www.theswamp.org/Sources/doc/avlisp/#trans 118/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
A real number representing the sine of ang, in radians.
Examples
0.841471
0.0
-------------------------------------------------------------------------------
slide_image
Displays an AutoCAD slide in the currently active dialog box image tile
Arguments
x1
X-offset from the upper-left corner of the tile, in pixels. Must be a positive
value.
y1
Y-offset from the upper-left corner of the tile, in pixels. Must be a positive
value.
width
height
sldname
Identifies the slide. This argument can be a slide file (.sld) or a slide in a
slide library file (.slb). Specify sldname the same way you would specify it
for the VSLIDE command or for a menu file (see the Creating Images topic in the
Visual LISP Developer's Guide). Use one of the following formats for sldname:
sldname or libname(sldname)
Return Values
Examples
(slide_image
(dimx_tile "slide_tile")
(dimy_tile "slide_tile")
"myslide"
(end_image)
https://www.theswamp.org/Sources/doc/avlisp/#trans 119/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
snvalid
The snvalid function inspects the system variable EXTNAMES to determine the
rules to enforce for the active drawing. If EXTNAMES is 0, snvalid validates
using the symbol name rules in effect prior to AutoCAD 2000. If EXTNAMES is 1
(the default value), snvalid validates using the rules for extended symbol
names introduced with AutoCAD 2000. The following are not allowed in any symbol
names, regardless of the setting of EXTNAMES:
* Null strings
AutoLISP does not enforce restrictions on the length of symbol table names if
extnames is 1.
Arguments
sym_name
flag
An integer that specifies whether the vertical bar character is allowed within
sym_name. The flag argument can be one of the following:
1 Allow vertical bar characters in sym_name, as long as they are not the first
or last characters in the name.
Return Values
+------------------------------------------+-----------------------------------+
| Characters disallowed in symbol table names |
+------------------------------------------+-----------------------------------+
| < > | less-than and greater-than symbol |
+------------------------------------------+-----------------------------------+
| / \ | forward slash and backslash |
+------------------------------------------+-----------------------------------+
| " | quotation mark |
+------------------------------------------+-----------------------------------+
| : | colon |
+------------------------------------------+-----------------------------------+
| ? | question mark |
+------------------------------------------+-----------------------------------+
| * | asterisk |
+------------------------------------------+-----------------------------------+
| | | vertical bar |
+------------------------------------------+-----------------------------------+
| , | comma |
+------------------------------------------+-----------------------------------+
| = | equal sign |
+------------------------------------------+-----------------------------------+
| ` | backquote |
+------------------------------------------+-----------------------------------+
| ; | Semi-colon (ASCII 59) |
+------------------------------------------+-----------------------------------+
A symbol table name may contain spaces.
https://www.theswamp.org/Sources/doc/avlisp/#trans 120/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
nil
nil
The following example includes a vertical bar in the symbol table name:
nil
-------------------------------------------------------------------------------
sqrt
(sqrt num)
Arguments
num
Return Values
A real number.
Examples
Command: (sqrt 4)
2.0
1.41421
-------------------------------------------------------------------------------
ssadd
https://www.theswamp.org/Sources/doc/avlisp/#trans 121/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
ename
An entity name.
ss
A selection set.
Return Values
The new or modified selection set.
Examples
When adding an entity to a set, the new entity is added to the existing set,
and the set passed as ss is returned as the result. Thus, if the set is
assigned to other variables, they also reflect the addition. If the named
entity is already in the set, the ssadd operation is ignored and no error is
reported.
The following command adds the e1 entity to the selection set referenced by ss:
-------------------------------------------------------------------------------
ssdel
Arguments
ename
An entity name.
ss
https://www.theswamp.org/Sources/doc/avlisp/#trans 122/300
5/8/23, 12:24 PM Auto/Visual lisp help
A selection set.
Return Values
The name of the selection set, or nil, if the specified entity is not in the
set.
Note that the entity is actually deleted from the existing selection set, as
opposed to a new set being returned with the element deleted.
Examples
nil
The function returns nil because e3 is not a member of selection set ss.
-------------------------------------------------------------------------------
ssget
Selection sets can contain objects from both paper and model space, but when
the selection set is used in an operation, ssget filters out objects from the
space not currently in effect. Selection sets returned by ssget contain main
entities only (no attributes or polyline vertices).
Arguments
sel-method
A string that specifies the object selection method. Valid selection methods
are:
C Crossing selection.
F Fence selection.
W Window selection.
X Entire database. If you specify the X selection method and do not provide a
filter-list, ssget selects all entities in the database, including entities on
layers that are off, frozen, and out of the visible screen.
Unlike the other object selection methods, :N may return multiple entities with
the same entity name in the selection set. For example, if the user selects a
subentity of a complex entity such as a BlockReference, PolygonMesh, or old
style polyline, ssget looks at the subentity that is selected when determining
if it has already been selected. However, ssget actually adds the main entity
https://www.theswamp.org/Sources/doc/avlisp/#trans 123/300
5/8/23, 12:24 PM Auto/Visual lisp help
(BlockReference, PolygonMesh, etc.) to the selection set. The result could be
multiple entries with the same entity name in the selection set (each will have
different subentity information for ssnamex to report).
pt1
pt2
pt-list
A list of points.
filter-list
An association list that specifies object properties. Objects that match the
filter-list are added to the selection set.
If you omit all arguments, ssget prompts the user with the Select objects
prompt, allowing interactive construction of a selection set.
If you supply a point but do not specify an object selection method, AutoCAD
assumes the user is selecting an object by picking a single point.
Return Values
The name of the created selection set if successful, or nil if no objects were
selected.
* When using the L selection method in an MDI environment, you cannot always
count on the last object drawn to remain visible. For example, if your
application draws a line, and the user subsequently minimizes or cascades
the AutoCAD drawing window, the line may no longer be visible. If this
occurs, ssget with the "L" option will return nil.
Examples
Prompt the user to select the objects to be placed in a selection set:
Command: (ssget)
nil
Create a selection set of the objects crossing the box from (0,0) to (1,1):
Create a selection set of the objects inside the window from (0,0):
https://www.theswamp.org/Sources/doc/avlisp/#trans 124/300
5/8/23, 12:24 PM Auto/Visual lisp help
By specifying filters, you can obtain a selection set that includes all objects
of a given type, on a given layer, or of a given color. The following example
returns a selection set that consists only of blue lines that are part of the
implied selection set (those objects selected while PICKFIRST is in effect):
The following examples of ssget require that a list of points be passed to the
function. The pt_list variable cannot contain points that define zero-length
segments.
((1 1) (3 1) (5 2) (2 4))
Create a selection set of all objects crossing and inside the polygon defined
by pt_list:
Create a selection set of all blue lines inside the polygon defined by pt_list:
The selected objects are highlighted only when ssget is used with no arguments.
Selection sets consume AutoCAD temporary file slots, so AutoLISP is not
permitted to have more than 128 open at one time. If this limit is reached,
AutoCAD refuses to create any more selection sets and returns nil to all ssget
calls. To close an unnecessary selection set variable, set it to nil.
The current setting of Object Snap mode is ignored by ssget unless you
specifically request it while you are in the function.
See Also
The Selection Set Handling and Selection Set Filter Lists topics in the Visual
LISP Developer's Guide.
-------------------------------------------------------------------------------
ssgetfirst
(ssgetfirst)
Returns a list of two selection sets similar to those passed to sssetfirst. The
first element in the list is a selection set of entities that are gripped but
not selected. The second element is a selection set of entities that are both
gripped and selected. Either (or both) elements of the list can be nil.
Note: Only entities from the current drawing's model space and paper space,
not nongraphical objects or entities in other block definitions, can be
analyzed by this function.
See Also
-------------------------------------------------------------------------------
sslength
https://www.theswamp.org/Sources/doc/avlisp/#trans 125/300
5/8/23, 12:24 PM Auto/Visual lisp help
set
(sslength ss)
Arguments
ss
A selection set.
Return Values
An integer.
Examples
Use sslength to determine the number of objects in the new selection set:
-------------------------------------------------------------------------------
ssmemb
Arguments
ename
An entity name.
ss
A selection set.
Return Values
If ename is a member of ss, ssmemb returns the entity name. If ename is not a
member, ssmemb returns nil.
Examples
nil
-------------------------------------------------------------------------------
ssname
Returns the object (entity) name of the indexed element of a selection set
(ssname ss index)
Entity names in selection sets obtained with ssget are always names of main
entities. Subentities (attributes and polyline vertices) are not returned. (The
entnext function allows access to them.)
https://www.theswamp.org/Sources/doc/avlisp/#trans 126/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
ss
A selection set.
index
Return Values
An entity name, if successful. If index is negative or greater than the highest
numbered entity in the selection set, ssname returns nil.
Examples
Get the name of the first entity in a selection set:
To access entities beyond the 32767th one in a selection set, you must supply
the index argument as a real, as in the following example:
See Also
-------------------------------------------------------------------------------
ssnamex
(ssnamex ss [index])
Only selection sets with entities from the current drawing's model space and
paper space--not nongraphical objects or entities in other block
definitions--can be retrieved by this function.
Arguments
ss
A selection set.
index
Return Values
If successful, ssnamex returns the name of the entity at index, along with data
describing how the entity was selected. If the index argument is not supplied,
this function returns a list containing the entity names of all of the elements
in the selection set, along with data that describes how each entity was
selected. If index is negative or greater than the highest numbered entity in
the selection set, ssnamex returns nil.
The data returned by ssnamex takes the form of a list of lists that contains
information that either describes an entity and its selection method or a
polygon used to select one or more entities. Each sublist that describes the
selection of a particular entity comprises three parts: the selection method ID
(an integer >= 0), the entity name of the selected entity, and selection method
specific data that describes how the entity was selected.
https://www.theswamp.org/Sources/doc/avlisp/#trans 127/300
5/8/23, 12:24 PM Auto/Visual lisp help
+----------------------+-----------------------------------+
| Selection method IDs |
+----------------------+-----------------------------------+
| ID | Description |
+----------------------+-----------------------------------+
| 0 | nonspecific (i.e., Last All etc.) |
+----------------------+-----------------------------------+
| 1 | Pick |
+----------------------+-----------------------------------+
| 2 | Window or WPolygon |
+----------------------+-----------------------------------+
| 3 | Crossing or CPolygon |
+----------------------+-----------------------------------+
| 4 | Fence |
+----------------------+-----------------------------------+
Each sublist that describes a polygon and is used during entity selection takes
the form of a polygon ID (an integer < 0), followed by point descriptions.
+----------------------+---------------+
| Point descriptor IDs |
+----------------------+---------------+
| ID | Description |
+----------------------+---------------+
| 0 | Infinite line |
+----------------------+---------------+
| 1 | Ray |
+----------------------+---------------+
| 2 | Line segment |
+----------------------+---------------+
The unit_or_offset_vector is returned when the view point is something other
than 0,0,1.
Examples
The data associated with Pick (type 1) entity selections is a single point
description. For example, the following record is returned for the selection of
an entity picked at 1,1 in plan view of the WCS:
The data associated with an entity selected with the Window, WPolygon,
Crossing, or CPolygon method is the integer ID of the polygon that selected the
entity. It is up to the application to associate the polygon identifiers and
make the connection between the polygon and the entities it selected. For
example, the following returns an entity selected by Crossing (note that the
polygon ID is -1):
((3 <Entity name: 1d62d60> 0 -1) (-1 (0 (-1.80879 8.85536 0.0)) (0 (13.4004
8.85536 0.0)) (0 (13.4004 1.80024 0.0)) (0 (-1.80879 1.80024 0.0))))
The data associated with Fence selections is a list of points and descriptions
for the points where the fence and entity visually intersect. For example, the
following command returns information for a nearly vertical line intersected
three times by a Z-shaped fence:
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 128/300
5/8/23, 12:24 PM Auto/Visual lisp help
sssetfirst
The selection set of objects specified by the gripset argument are gripped, and
the selection set of objects specified by pickset are both gripped and
selected. If any objects are common to both selection sets, sssetfirst grips
and selects the selection set specified by pickset only (it does not grip the
gripset set).
You are responsible for creating a valid selection set. For example, you may
need to verify that a background paper space viewport (DXF group code 69) is
not included in the selection set. You may also need to ensure that selected
objects belong to the current layout, as in the following code:
Arguments
gripset
pickset
Return Values
Examples
First, draw a square and build three selection sets. Begin by drawing side 1
and creating a selection set to include the line drawn:
Command: (entmake (list (cons 0 "line") '(10 0.0 0.0 0.0)'(11 0.0 10.0 0.0)))
((0 . "line") (10 0.0 0.0 0.0) (11 0.0 10.0 0.0))
Command: (entmake (list (cons 0 "line") '(10 0.0 10.0 0.0)'(11 10.0 10.0 0.0)))
((0 . "line") (10 0.0 10.0 0.0) (11 10.0 10.0 0.0))
Command: (entmake (list (cons 0 "line") '(10 10.0 10.0 0.0)'(11 10.0 0.0 0.0)))
((0 . "line") (10 10.0 10.0 0.0) (11 10.0 0.0 0.0))
https://www.theswamp.org/Sources/doc/avlisp/#trans 129/300
5/8/23, 12:24 PM Auto/Visual lisp help
<Selection set: ab>
Draw side 4 and add it to the gripset and pickset selection sets:
Command: (entmake (list (cons 0 "line") '(10 10.0 0.0 0.0)'(11 0.0 0.0 0.0)))
((0 . "line") (10 10.0 0.0 0.0) (11 0.0 0.0 0.0))
At this point, gripset contains sides 1-4, pickset contains sides 3 and 4, and
2onlyset contains only side 2.
Turn grip handles on for all objects in the gripset selection set:
(nil)
Turn on grip handles for all objects in 2onlyset, and select all objects in
pickset:
Each sssetfirst call replaces the gripped and selected selection sets from the
previous sssetfirst call. For example, after the following command is issued,
grips are turned on in 2onlyset, and no selection set is selected:
See Also
-------------------------------------------------------------------------------
startapp
Arguments
appcmd
A string that specifies the application to execute. If appcmd does not include
a full path name, startapp searches the directories in the PATH environment
variable for the application.
file
https://www.theswamp.org/Sources/doc/avlisp/#trans 130/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
Examples
The following code starts the Windows Notepad and opens the acad.lsp file.
33
33
-------------------------------------------------------------------------------
start_dialog
(start_dialog)
You must first initialize the dialog box by a previous new_dialog call. The
dialog box remains active until an action expression or callback function calls
done_dialog. Usually done_dialog is associated with the tile whose key is
"accept" (typically the OK button) and the tile whose key is "cancel"
(typically the Cancel button).
Return Values
-------------------------------------------------------------------------------
start_image
(start_image key)
Arguments
key
A string that specifies the dialog box tile. The key argument is
case-sensitive.
Return Values
Note: Do not use the set_tile function between start_image and end_image
function calls.
-------------------------------------------------------------------------------
start_list
https://www.theswamp.org/Sources/doc/avlisp/#trans 131/300
5/8/23, 12:24 PM Auto/Visual lisp help
Starts the processing of a list in the list box or in the pop-up list dialog
box tile
Subsequent calls to add_list affect the list started by start_list until the
application calls end_list.
Arguments
key
A string that specifies the dialog box tile. The key argument is
case-sensitive.
operation
An integer indicating the type of list operation to perform. You can specify
one of the following:
index
A number indicating the list item to change by the subsequent add_list call.
The first item in the list is index 0. If not specified, index defaults to 0.
Return Values
Note: Do not use the set_tile function between start_list and end_list
function calls.
-------------------------------------------------------------------------------
strcase
Arguments
string
A string.
which
Return Values
A string.
Examples
Command: (strcase "Sample")
"SAMPLE"
"sample"
The strcase function will correctly handle case mapping of the currently
configured character set.
https://www.theswamp.org/Sources/doc/avlisp/#trans 132/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
strcat
Arguments
string
A string.
Return Values
Examples
Command: (strcat "a" "bout")
"about"
"abc"
"ac"
Command: (strcat)
""
-------------------------------------------------------------------------------
strlen
(strlen [string]...)
Arguments
string
A string.
Return Values
An integer. If multiple string arguments are provided, strlen returns the sum
of the lengths of all arguments. If you omit the arguments or enter an empty
string, strlen returns 0.
Examples
Command: (strlen "abcd")
10
Command: (strlen)
https://www.theswamp.org/Sources/doc/avlisp/#trans 133/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
subst
Searches a list for an old item and returns a copy of the list with a new item
substituted in place of every occurrence of the old item
Arguments
newitem
An atom or list.
olditem
An atom or list.
lst
A list.
Return Values
A list, with newitem replacing all occurrences of olditem. If olditem is not
found in lst, subst returns lst unchanged.
Examples
Command: (setq sample '(a b (c d) b))
(A B (C D) B)
(A QQ (C D) QQ)
(A B (C D) B)
(A B QQ B)
(A B (QQ RR) B)
(A B (C D) B)
The following sets old to (FIRST JOHN) and new to (FIRST J):
(FIRST J)
Finally, replace the value of the first item in the association list:
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 134/300
5/8/23, 12:24 PM Auto/Visual lisp help
substr
The substr function starts at the start character position of string and
continues for length characters.
Arguments
string
A string.
start
length
Note: The first character of string is character number 1. This differs from
other functions that process elements of a list (like nth and ssname) that
count the first element as 0.
Return Values
A string.
Examples
"bcde"
"b"
"cd"
tablet
Arguments
code
1 Set the calibration according to the arguments that follow. In this case, you
must provide the new calibration settings (row1, row2, row3, and direction).
Three 3D points. These three arguments specify the three rows of the tablet's
transformation matrix.
The third element in row3 (Z) should always equal 1: tablet returns it as 1
even if you specify a different value in row3.
https://www.theswamp.org/Sources/doc/avlisp/#trans 135/300
5/8/23, 12:24 PM Auto/Visual lisp help
direction
One 3D point. This is the vector (expressed in the World Coordinate System, or
WCS) that is normal to the plane that represents the surface of the tablet.
Return Values
If tablet fails, it returns nil and sets the ERRNO system variable to a value
that indicates the reason for the failure (see appendix C, AutoLISP Error Codes
in the Visual LISP Developer's Guide). This can happen if the digitizer is not
a tablet.
Examples
A very simple transformation that can be established with tablet is the
identity transformation:
The TABMODE system variable allows AutoLISP routines to toggle the tablet on
and off.
See Also
-------------------------------------------------------------------------------
tblnext
When tblnext is used repeatedly, it normally returns the next entry in the
specified table each time. The tblsearch function can set the next entry to be
retrieved. If the rewind argument is present and is not nil, the symbol table
is rewound and the first entry in it is retrieved.
Arguments
table-name
A string that identifies a symbol table. Valid table-name values are "LAYER",
"LTYPE", "VIEW", "STYLE", "BLOCK", "UCS", "APPID", "DIMSTYLE", and "VPORT". The
argument is not case sensitive.
rewind
If this argument is present and is not nil, the symbol table is rewound and the
first entry in it is retrieved.
Return Values
If a symbol table entry is found, the entry is returned as a list of dotted
pairs of DXF-type codes and values. If there are no more entries in the table,
nil is returned. Deleted table entries are never returned.
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 136/300
5/8/23, 12:24 PM Auto/Visual lisp help
(70 . 0) Flags
Note that there is no -1 group. The last entry returned from each table is
stored, and the next one is returned each time tblnext is called for that
table. When you begin scanning a table, be sure to supply a non-nil second
argument to rewind the table and to return the first entry.
Entries retrieved from the block table include a -2 group with the entity name
of the first entity in the block definition (if any). For example, the
following command obtains information about a block called BOX:
((0 . "BLOCK") (2 . "BOX") (70 . 0) (10 9.0 2.0 0.0) (-2 . <Entity name:
1dca370>))
(70 . 0) Flags
The entity name in the -2 group is accepted by entget and entnext, but not by
other entity access functions. For example, you cannot use ssadd to put it in a
selection set. By providing the -2 group entity name to entnext, you can scan
the entities comprising a block definition; entnext returns nil after the last
entity in the block definition.
Note: The vports function returns current VPORT table information, therefore
it may be easier to use vports as opposed to tblnext to retrieve this
information.
-------------------------------------------------------------------------------
tblobjname
Arguments
table-name
A string that identifies the symbol table to be searched. The argument is not
case sensitive.
symbol
Return Values
The entity name of the symbol table entry, if found.
The entity name returned by tblobjname can be used in entget and entmod
operations.
Examples
The following command searches for the entity name of the block entry "ESC-01":
https://www.theswamp.org/Sources/doc/avlisp/#trans 137/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
tblsearch
Arguments
table-name
A string that identifies the symbol table to be searched. This argument is not
case sensitive.
symbol
A string identifying the symbol name to be searched for. This argument is not
case sensitive.
setnext
If this argument is supplied and is not nil, the tblnext entry counter is
adjusted so the following tblnext call returns the entry after the one returned
by this tblsearch call. Otherwise, tblsearch has no effect on the order of
entries retrieved by tblnext.
Return Values
If tblsearch finds an entry for the given symbol name, it returns that entry in
the format described for tblnext . If no entry is found, tblsearch returns nil.
Examples
((0 . "STYLE") (2 . "STANDARD") (70 . 0) (40 . 0.0) (41 . 1.0) (50 . 0.0) (71 .
0) (42 . 0.3) (3 . "txt") (4 . ""))
-------------------------------------------------------------------------------
term_dialog
Terminates all current dialog boxes as if the user had canceled each of them
(term_dialog)
Return Values
The term_dialog function always returns nil.
-------------------------------------------------------------------------------
terpri
(terpri)
The terpri function is not used for file I/O. To write a newline to a file, use
prin1, princ, or print.
Return Values
nil
https://www.theswamp.org/Sources/doc/avlisp/#trans 138/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
textbox
Measures a specified text object, and returns the diagonal coordinates of a box
that encloses the text
(textbox elist)
Arguments
elist
If fields that define text parameters other than the text itself are omitted
from elist, the current (or default) settings are used.
Return Values
The points returned by textbox describe the bounding box of the text object as
if its insertion point is located at (0,0,0) and its rotation angle is 0. The
first list returned is generally the point (0.0 0.0 0.0) unless the text object
is oblique or vertical, or it contains letters with descenders (such as g and
p). The value of the first point list specifies the offset from the text
insertion point to the lower-left corner of the smallest rectangle enclosing
the text. The second point list specifies the upper-right corner of that box.
Regardless of the orientation of the text being measured, the point list
returned always describes the bottom-left and upper-right corners of this
bounding box.
Examples
The following command supplies the text and accepts the current defaults for
the remaining parameters:
-------------------------------------------------------------------------------
textpage
(textpage)
Return Values
nil
-------------------------------------------------------------------------------
textscr
Switches focus from the drawing area to the text screen (like the AutoCAD Flip
Screen function key)
(textscr)
Return Values
The textscr function always returns nil.
https://www.theswamp.org/Sources/doc/avlisp/#trans 139/300
5/8/23, 12:24 PM Auto/Visual lisp help
See Also
-------------------------------------------------------------------------------
trace
(trace [function...])
The trace function sets the trace flag for the specified functions. Each time a
specified function is evaluated, a trace display appears showing the entry of
the function (indented to the level of calling depth) and prints the result of
the function.
If Visual LISP is active, trace output is sent to the Visual LISP Trace window.
If Visual LISP is not active, trace output goes to the AutoCAD command window.
Note: Once you start Visual LISP during an AutoCAD session, it remains active
until you exit AutoCAD. Therefore, all trace output prints in the Visual LISP
Trace window for the remainder of that AutoCAD session. Exiting or closing
Visual LISP while AutoCAD is running only closes the IDE windows and places
Visual LISP in a quiescent state; it does not result in a true shutdown. You
must reopen Visual LISP to view the output in the Trace window.
Arguments
function
Return Values
The last function name passed to trace. If no argument is supplied, trace
returns nil.
Examples
Define a function named foo and set the trace flag for the function:
FOO
FOO
Command: (foo 3)
Entering (FOO 3)
Entering (FOO 2)
Entering (FOO 1)
Entering (FOO 0)
Result: nil
Result: nil
Result: nil
Result: nil
FOO
https://www.theswamp.org/Sources/doc/avlisp/#trans 140/300
5/8/23, 12:24 PM Auto/Visual lisp help
See Also
-------------------------------------------------------------------------------
trans
Arguments
pt
from
0 World (WCS)
2 If used with code 0 or 1, this indicates the Display Coordinate System (DCS)
of the current viewport. When used with code 3, it indicates the DCS of the
current model space viewport.
to
disp
If you use an entity name for the from or to arguments, it must be passed in
the format returned by the entnext, entlast, entsel, nentsel, and ssname
functions. This format lets you translate a point to and from the Object
Coordinate System (OCS) of a particular object. (For some objects, the OCS is
equivalent to the WCS; for these objects, conversion between OCS and WCS is a
null operation.) A 3D extrusion vector (a list of three reals) is another
method of converting to and from an object's OCS. However, this does not work
for those objects whose OCS is equivalent to the WCS.
Return Values
A 3D point (or displacement) in the requested to coordinate system.
Examples
The coordinate systems are discussed in greater detail in the Visual LISP
Developer's Guide, under the topic, Coordinate System Transformations.
For example, to draw a line from the insertion point of a piece of text
(without using Osnap), you convert the text object's insertion point from the
text object's OCS to the UCS.
https://www.theswamp.org/Sources/doc/avlisp/#trans 141/300
5/8/23, 12:24 PM Auto/Visual lisp help
You can then pass the result to the From point prompt.
Then you add the resulting displacement to the circle's center point.
For example, if you have a point entered by the user and want to find out which
end of a line it looks closer to, you convert the user's point from the UCS to
the DCS.
(trans user-point 1 2)
Then you convert each of the line's endpoints from the OCS to the DCS.
From there you can compute the distance between the user's point and each
endpoint of the line (ignoring the Z coordinates) to determine which end looks
closer.
The trans function can also transform 2D points. It does this by setting the Z
coordinate to an appropriate value. The Z component used depends on the from
coordinate system that was specified and on whether the value is to be
converted as a point or as a displacement. If the value is to be converted as a
displacement, the Z value is always 0.0; if the value is to be converted as a
point, the filled-in Z value is determined as shown in the following table.
+-----------------------------+------------------------------------------------+
| Converted 2D point Z values |
+-----------------------------+------------------------------------------------+
| From | Filled-in Z value |
+-----------------------------+------------------------------------------------+
| WCS | 0.0 |
+-----------------------------+------------------------------------------------+
| UCS | Current elevation |
+-----------------------------+------------------------------------------------+
| OCS | 0.0 |
+-----------------------------+------------------------------------------------+
| DCS | Projected to the current construction |
| | plane(UCS XY plane + current elevation) |
+-----------------------------+------------------------------------------------+
| PSDCS | Projected to the current construction |
| | plane(UCS XY plane + current elevation) |
+-----------------------------+------------------------------------------------+
-------------------------------------------------------------------------------
type
(type item)
Arguments
item
A symbol.
Return Values
The data type of item. Items that evaluate to nil (such as unassigned symbols)
return nil. The data type is returned as one of the atoms listed in the
following table:
+-------------------------------------+----------------------------------------+
| Data types returned by the type function |
+-------------------------------------+----------------------------------------+
| Data type | Description |
+-------------------------------------+----------------------------------------+
| ENAME | Entity names |
+-------------------------------------+----------------------------------------+
| EXRXSUBR | External ObjectARX applications |
+-------------------------------------+----------------------------------------+
| FILE | File descriptors |
+-------------------------------------+----------------------------------------+
| INT | Integers |
https://www.theswamp.org/Sources/doc/avlisp/#trans 142/300
5/8/23, 12:24 PM Auto/Visual lisp help
+-------------------------------------+----------------------------------------+
| LIST | Lists |
+-------------------------------------+----------------------------------------+
| PAGETB | Function paging table |
+-------------------------------------+----------------------------------------+
| PICKSET | Selection sets |
+-------------------------------------+----------------------------------------+
| REAL | Floating-point numbers |
+-------------------------------------+----------------------------------------+
| SAFEARRAY | Safearray |
+-------------------------------------+----------------------------------------+
| STR | Strings |
+-------------------------------------+----------------------------------------+
| SUBR | Internal AutoLISP functions or |
| | functions loaded from compiled (FAS |
| | or VLX) files. Functions in LISP |
| | source files loaded from the AutoCAD |
| | Command prompt may also appear as |
| | SUBR. |
+-------------------------------------+----------------------------------------+
| SYM | Symbols |
+-------------------------------------+----------------------------------------+
| VARIANT | Variant |
+-------------------------------------+----------------------------------------+
| USUBR | User-defined functions loaded from |
| | LISP source files |
+-------------------------------------+----------------------------------------+
| VLA-object | ActiveX objects |
+-------------------------------------+----------------------------------------+
Examples
then
The following code example uses the type function on the argument passed to it:
T yes, return T
unload_dialog
(unload_dialog dcl_id)
Unloads the DCL file associated with dcl_id (obtained from a previous
new_dialog call) from memory.
https://www.theswamp.org/Sources/doc/avlisp/#trans 143/300
5/8/23, 12:24 PM Auto/Visual lisp help
It is generally not necessary to unload a DCL definition from memory, unless
you are running low on memory or need to update the DCL dialog definition from
a new file.
Arguments
dcl_id
Return Values
The unload_dialog function always returns nil.
See Also
-------------------------------------------------------------------------------
untrace
(untrace [function...])
Arguments
function
Return Values
The last function name passed to untrace. If function was not specified,
untrace returns nil.
Examples
The following command clears the trace flag for function foo:
FOO
See Also
vector_image
(vector_image x1 y1 x2 y2 color)
This function draws a vector in the currently active dialog box image (opened
by start_image) from the point (x1,y1) to (x2,y2). The origin (0,0) is the
upper-left corner of the image. You can obtain the coordinates of the
lower-right corner by calling the dimension functions (dimx_tile and
dimy_tile).
Arguments
x1
y1
x2
https://www.theswamp.org/Sources/doc/avlisp/#trans 144/300
5/8/23, 12:24 PM Auto/Visual lisp help
y2
color
An AutoCAD color number, or one of the logical color numbers shown in the
following table:
+------------------------------+--------------+--------------------------------+
| Symbolic names for color attribute |
+------------------------------+--------------+--------------------------------+
| Color number | ADI mnemonic | Description |
+------------------------------+--------------+--------------------------------+
| -2 | BGLCOLOR | Current background of the |
| | | AutoCAD drawing area |
+------------------------------+--------------+--------------------------------+
| -15 | DBGLCOLOR | Current dialog box background |
| | | color |
+------------------------------+--------------+--------------------------------+
| -16 | DFGLCOLOR | Current dialog box foreground |
| | | color (text) |
+------------------------------+--------------+--------------------------------+
| -18 | LINELCOLOR | Current dialog box line color |
+------------------------------+--------------+--------------------------------+
Return Values
An integer representing the color of the vector.
Examples
(vector_image
(dimx_tile "slide_tile")
(dimy_tile "slide_tile")
color
(end_image)
-------------------------------------------------------------------------------
ver
(ver)
Return Values
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 145/300
5/8/23, 12:24 PM Auto/Visual lisp help
Command: (ver)
-------------------------------------------------------------------------------
vl-acad-defun
(vl-acad-defun 'symbol)
symbol
If a function does not have the c: prefix, and you want to be able to invoke
this function from an external ObjectARX application, you can use vl-acad-defun
to make the function accessible.
Return Values
Unspecified.
-------------------------------------------------------------------------------
vl-acad-undefun
(vl-acad-undefun 'symbol)
symbol
Return Values
T if successful, nil if unsuccessful (for example, the function was not defined
in AutoLISP).
-------------------------------------------------------------------------------
vl-arx-import
Arguments
function
application
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 146/300
5/8/23, 12:24 PM Auto/Visual lisp help
Unspecified.
If executed from a document VLX, this function does nothing and returns nil, as
all ADS-DEFUN function names are automatically imported to document VLX
applications.
Examples
To see how vl-arx-import works, try the following:
* Copy the following code into the VLISP editor and save the file:
(vl-doc-export 'testarx)
(defun testarx ()
(vl-arx-import 'c:cal)
(c:cal)
)
* Use Make Application to build a VLX with this code. Select Separate-
Namespace Application Options.
* Load geomcal.arx, if it is not already loaded.
In the example above, you could have replaced the vl-arx-import call with the
following:
(vl-arx-import "geomcal.arx")
-------------------------------------------------------------------------------
vl-bb-ref
(vl-bb-ref 'variable)
Arguments
'variable
Return Values
The value of the variable named by symbol.
Examples
See Also
The vl-bb-set function. Also, see Sharing Data between Namespaces in the
Visual LISP Developer's Guide for a description of the blackboard namespace.
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 147/300
5/8/23, 12:24 PM Auto/Visual lisp help
vl-bb-set
Arguments
'symbol
value
Return Values
The value you assigned to symbol.
Examples
Command: (vl-bb-set 'foobar "Root toot toot")
See Also
The vl-bb-ref function. Also, see Sharing Data between Namespaces in the
Visual LISP Developer's Guide for a description of the blackboard namespace.
-------------------------------------------------------------------------------
vl-catch-all-apply
Arguments
'function
list
Return Values
Examples
If the function invoked by vl-catch-all-apply completes successfully, it is the
same as using apply, as the following examples show:
10
10
When you use apply, an exception occurs and an error message displays.
#<%catch-all-apply-error%>
The vl-catch-all-apply function traps the error and returns an error object.
Use vl-catch-all-error-message to see the error message contained in the error
object:
_$ (vl-catch-all-error-message catchit)
"divide by zero"
See Also
-------------------------------------------------------------------------------
vl-catch-all-error-message
(vl-catch-all-error-message error-obj)
Arguments
error-obj
Return Values
A string containing an error message.
Examples
Divide by zero using vl-catch-all-apply:
#<%catch-all-apply-error%>
The vl-catch-all-apply function traps the error and returns an error object.
Use vl-catch-all-error-message to see the error message contained in the error
object:
_$ (vl-catch-all-error-message catchit)
"divide by zero"
See Also
-------------------------------------------------------------------------------
vl-catch-all-error-p
(vl-catch-all-error-p arg)
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 149/300
5/8/23, 12:24 PM Auto/Visual lisp help
arg
Any argument.
Return Values
T, if the supplied argument is an error object returned from
vl-catch-all-apply, nil otherwise.
Examples
#<%catch-all-apply-error%>
_$ (vl-catch-all-error-p catchit)
See Also
-------------------------------------------------------------------------------
vl-cmdf
Arguments
(vl-cmdf [arguments] ...)
The vl-cmdf function is similar to the command function, but differs from
command in the way it evaluates the arguments passed to it. The vl-cmdf
function evaluates all the supplied arguments before executing the AutoCAD
command, and will not execute the AutoCAD command if it detects an error during
argument evaluation. In contrast, the command function passes each argument in
turn to AutoCAD, so the command may be partially executed before an error is
detected.
If your command call includes a call to another function, vl-cmdf executes the
call before it executes your command, while command executes the call after it
begins executing your command.
Some AutoCAD commands may work correctly when invoked through vl-cmdf, while
failing when invoked through command. The vl-cmdf function mainly overcomes the
limitation of not being able to use getxxx functions inside command.
Arguments
arguments
Return Values
T
Note that if you issue vl-cmdf from Visual LISP, focus does not change to the
AutoCAD window. If the command requires user input, you'll see the return value
(T) in the Console window, but AutoCAD will be waiting for input. You must
manually activate the AutoCAD window and respond to the prompts. Until you do
so, any subsequent commands will fail.
Examples
The differences between command and vl-cmdf are easier to see if you enter the
https://www.theswamp.org/Sources/doc/avlisp/#trans 150/300
5/8/23, 12:24 PM Auto/Visual lisp help
following calls at the AutoCAD Command prompt, rather than the VLISP Console
prompt:
Command: nil
Using command, the LINE command executes first, then the getpoint function is
called.
Command: T
Using vl-cmdf, the getpoint function is called first (notice the "point?"
prompt from getpoint), then the LINE command executes.
The following examples show the same commands, but pass an invalid point list
argument to the LINE command. Notice how the results differ:
Cancel
0 found
nil
Because vl-cmdf evaluates each argument before passing the command to AutoCAD,
the invalid point list is detected and the command is not executed.
See Also
-------------------------------------------------------------------------------
vl-consp
(vl-consp list-variable)
Arguments
list-variable
A list.
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 151/300
5/8/23, 12:24 PM Auto/Visual lisp help
T, if list-variable is a list and is not nil, otherwise nil.
Examples
_$ (vl-consp nil)
nil
_$ (vl-consp t)
nil
-------------------------------------------------------------------------------
vl-copyobjects
Signature
Object
Database, Document
The object or objects this method applies to.
Objects
Owner
IDPairs
RetVal
Remarks
To copy objects to another open drawing, set the Owner parameter to the other
drawing's model space.
During the CopyObjects operation, objects that are owned or referenced by the primary
objects in the Objects parameter will also be copied.
NOTE You cannot execute this method while simultaneously iterating through a
collection. An iteration will open the work space for a read-only operation, while
this method attempts to perform a read-write operation. Complete any iteration before
you call this method.
-------------------------------------------------------------------------------
vl-directory-files
https://www.theswamp.org/Sources/doc/avlisp/#trans 152/300
5/8/23, 12:24 PM Auto/Visual lisp help
Lists all files in a given directory
Arguments
directory
pattern
A string containing a DOS pattern for the file name; if nil or absent,
vl-directory-files assumes "*.*"
directories
An integer that indicates whether the returned list should include directory
names. Specify one of the following:
Return Values
A list of file and path names, or nil if no files match the specified pattern.
Examples
-------------------------------------------------------------------------------
vl-doc-export
(vl-doc-export 'function)
When issued from a VLX that runs in its own namespace, vl-doc-export exposes
the specified function to any document namespace that loads the VLX.
Arguments
'function
Return Values
Unspecified.
Examples
The following code shows the contents of a file named kertrats.lsp. This file
is compiled into a VLX that runs in its own namespace. The VLX file is named
kertrats.vlx. The vl-doc-export call makes the kertrats function visible to any
document that loads kertrats.vlx:
(vl-doc-export 'kertrats)
(defun kertrats ()
https://www.theswamp.org/Sources/doc/avlisp/#trans 153/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
vl-doc-import
Arguments
application
A string naming the VLX application whose functions are to be imported. Do not
include the .vlx extension in the name.
function
Return Values
Unspecified.
Examples
Import function ldataget from the ldatatest application:
nil
-------------------------------------------------------------------------------
vl-doc-ref
(vl-doc-ref 'symbol)
Arguments
'symbol
Return Values
The value of the variable identified by symbol.
Examples
See Also
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 154/300
5/8/23, 12:24 PM Auto/Visual lisp help
vl-doc-set
This function can be used by a VLX application to set the value of a variable
that resides in the current document's namespace.
Arguments
'symbol
value
Any value.
Return Values
The value set.
Examples
See Also
-------------------------------------------------------------------------------
vl-every
The vl-every function passes the first element of each supplied list as an
argument to the test function, followed by the next element from each list, and
so on. Evaluation stops as soon as one of the lists runs out.
Arguments
predicate-function
The test function. This can be any function that accepts as many arguments as
there are lists provided with vl-every, and returns T on any user-specified
condition. The predicate-function value can take one of the following forms:
list
A list to be tested.
Return Values
T, if predicate-function returns a non-nil value for every element combination,
nil otherwise.
Examples
Check whether there are any empty files in the current directory:
_$ (vl-every
(0 2 3.14159 3.14159 4)
nil
The first expression returned nil because vl-every compared the second element
in each list and they were not numerically equal. The second expression
returned T because vl-every stopped comparing elements after it had processed
all the elements in the shorter list (1 2), at which point the lists were
numerically equal. If the end of a list is reached, vl-every returns a non-nil
value.
The following example demonstrates the result when vl-every evaluates one list
that contains integer elements and another list that is nil:
(1 2 3 4)
nil
The return value is T because vl-every responds to the nil list as if it has
reached the end of the list (even though the predicate hasn't yet been applied
to any elements). And since the end of a list has been reached, vl-every
returns a non-nil value.
-------------------------------------------------------------------------------
vl-exit-with-error
(vl-exit-with-error msg)
This function is used by VLX applications that run in their own namespace. When
vl-exit-with-error executes, it calls the +error+ function, the stack is
unwound, and control returns to a command prompt.
Arguments
msg
A string.
Return Values
None.
Examples
The following code illustrates the use of vl-exit-with-error to pass a string
the +error+ function of the calling namespace:
https://www.theswamp.org/Sources/doc/avlisp/#trans 156/300
5/8/23, 12:24 PM Auto/Visual lisp help
... ; processing in VLX namespace/execution context
See Also
-------------------------------------------------------------------------------
vl-exit-with-value
(vl-exit-with-value value)
VLX +error+ handler can use the vl-exit-with-value function to return a value
to the program that called the VLX.
Arguments
value
Any value.
Return Values
value
Examples
(vl-exit-with-value 3))
See Also
-------------------------------------------------------------------------------
vl-file-copy
Copy or append the contents of one file to another file. The vl-file-copy
function will not overwrite an existing file, only append to it.
Arguments
source-file
A string naming the file to be copied. If you do not specify a full path name,
vl-file-copy looks in the AutoCAD start-up directory.
destination-file
A string naming the destination file. If you do not specify a path name,
vl-file-copy writes to the AutoCAD start-up directory.
append
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 157/300
5/8/23, 12:24 PM Auto/Visual lisp help
* source-file is a directory
* append? is absent or nil and destination-file exists
* destination-file cannot be opened for output (that is, it is an illegal
file name or a write-protected file)
Examples
Copy autoexec.bat to newauto.bat:
1417
nil
The copy fails because newauto.bat already exists, and the append argument was
not specified.
185
The copy is successful because T was specified for the append argument.
-------------------------------------------------------------------------------
vl-file-delete
Deletes a file
(vl-file-delete filename)
Arguments
filename
A string containing the name of the file to be deleted. If you do not specify a
full path name, vl-file-delete searches the AutoCAD start-up directory.
Return Values
Examples
Delete newauto.bat:
_$ (vl-file-delete "newauto.bat")
nil
_$ (vl-file-delete "c:/newauto.bat")
The delete was successful because the full path name identified an existing
file.
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 158/300
5/8/23, 12:24 PM Auto/Visual lisp help
vl-file-directory-p
(vl-file-directory-p filename)
Arguments
filename
A string containing a file name. If you do not specify a full path name,
vl-file-directory-p searches only the AutoCAD start-up directory.
Return Values
T, if filename is the name of a directory, nil if it is not.
Examples
_$ (vl-file-directory-p "sample")
_$ (vl-file-directory-p "yinyang")
nil
nil
-------------------------------------------------------------------------------
vl-file-rename
Renames a file
Arguments
old-filename
A string containing the name of the file you want to rename. If you do not
specify a full path name, vl-file-rename looks in the AutoCAD start-up
directory.
new-filename
Note: If you do not specify a path name, vl-file-rename writes the renamed
file to the AutoCAD start-up directory.
Return Values
T, if renaming completed successfully, nil if renaming failed.
Examples
_$ (vl-file-rename "c:/newauto.bat" "c:/myauto.bat")
-------------------------------------------------------------------------------
vl-file-size
https://www.theswamp.org/Sources/doc/avlisp/#trans 159/300
5/8/23, 12:24 PM Auto/Visual lisp help
Determines the size of a file, in bytes
(vl-file-size filename)
Arguments
filename
A string naming the file to be sized. If you do not specify a full path name,
vl-file-size searches the AutoCAD start-up directory for the file.
Return Values
If successful, vl-file-size returns an integer showing the size of filename. If
the file is not readable, vl-file-size returns nil. If filename is a directory
or an empty file, vl-file-size returns 0.
Examples
_$ (vl-file-size "c:/autoexec.bat")
1417
_$ (vl-file-size "c:/")
-------------------------------------------------------------------------------
vl-file-systime
(vl-file-systime filename)
Arguments
filename
Return Values
A list containing the modification date and time, or nil, if the file is not
found.
* year
* month
* day-of-week
* day-of-month
* hours
* minutes
* seconds
Examples
_$ (vl-file-systime
"c:/program files/AutoCAD/sample/visuallisp/yinyang.lsp")
(1998 4 3 8 10 6 52)
The returned value shows that the file was last modified in 1998, in the 4th
month of the year (April), the 3rd day of the week (Wednesday), on the 8th day
of the month, at 10:6:52.
-------------------------------------------------------------------------------
vl-filename-base
https://www.theswamp.org/Sources/doc/avlisp/#trans 160/300
5/8/23, 12:24 PM Auto/Visual lisp help
Returns the name of a file, after stripping out the directory path and extension
(vl-filename-base filename)
Arguments
filename
A string containing a file name. The vl-filename-base function does not check
to see if the file exists.
Return Values
A string containing filename in uppercase, with any directory and extension
stripped from the name.
Examples
_$ (vl-filename-base "c:\\acadwin\\acad.exe")
"ACAD"
_$ (vl-filename-base "c:\\acadwin")
"ACADWIN"
-------------------------------------------------------------------------------
vl-filename-directory
Returns the directory path of a file, after stripping out the name and extension
(vl-filename-directory filename)
Arguments
filename
Return Values
A string containing the directory portion of filename, in uppercase.
Examples
_$ (vl-filename-directory "c:\\acadwin\\acad.exe")
"C:\\ACADWIN"
_$ (vl-filename-directory "acad.exe")
""
-------------------------------------------------------------------------------
vl-filename-extension
Returns the extension from a file name, after stripping out the rest of the name
(vl-filename-extension filename)
Arguments
filename
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 161/300
5/8/23, 12:24 PM Auto/Visual lisp help
A string containing the extension of filename. The returned string starts with
a period (.) and is in uppercase. If filename does not contain an extension,
vl-filename-extension returns nil.
Examples
_$ (vl-filename-extension "c:\\acadwin\\acad.exe")
".EXE"
_$ (vl-filename-extension "c:\\acadwin\\acad")
nil
-------------------------------------------------------------------------------
vl-filename-mktemp
Arguments
pattern
directory
extension
Return Values
A string containing a file name, in the following format:
directory\base<XXX><.extension>
where:
Examples
_$ (vl-filename-mktemp)
"C:\\TMP\\$VL~~004"
_$ (vl-filename-mktemp "myapp.del")
"C:\\TMP\\MYAPP005.DEL"
_$ (vl-filename-mktemp "c:\\acadwin\\myapp.del")
"C:\\ACADWIN\\MYAPP006.DEL"
_$ (vl-filename-mktemp "c:\\acadwin\\myapp.del")
"C:\\ACADWIN\\MYAPP007.DEL"
https://www.theswamp.org/Sources/doc/avlisp/#trans 162/300
5/8/23, 12:24 PM Auto/Visual lisp help
"C:\\ACADWIN\\MYAPP008"
"C:\\ACADWIN\\MYAPP00A.DEL"
-------------------------------------------------------------------------------
vl-get-resource
(vl-get-resource text-file)
Arguments
text-file
A string naming a .txt file packaged with the VLX. Do not include the .txt
extension when specifying the file name.
Return Values
A string containing the text in text-file.
Examples
Assume the getres.vlx file contains a LISP program defining a function named
print-readme, and a text file named readme.txt. The print-readme function is
defined as follows:
(defun print-readme ()
(princ)
_$ (print-readme)
Here it comes...
-------------------------------------------------------------------------------
vl-list_star
Arguments
object
Return Values
The vl-list* function is similar to list, but it will place the last object in
the final cdr of the result list. If the last argument to vl-list* is an atom,
the result is a dotted list. If the last argument is a list, its elements are
appended to all previous arguments added to the constructed list. The possible
return values from vl-list* are:
https://www.theswamp.org/Sources/doc/avlisp/#trans 163/300
5/8/23, 12:24 PM Auto/Visual lisp help
* A dotted list if the last argument is an atom and neither of the previous
conditions is true.
Examples
_$ (vl-list* 1)
_$ (vl-list* 0 "text")
(0 . "TEXT")
_$ (vl-list* 1 2 3)
(1 2 . 3)
(1 2 3 4)
See Also
-------------------------------------------------------------------------------
vl-list->string
(vl-list->string char-codes-list)
Arguments
char-codes-list
Return Values
A string of characters, with each character based on one of the integers
supplied in char-codes-list.
Examples
_$ (vl-list->string nil)
""
"12"
See Also
-------------------------------------------------------------------------------
vl-list-exported-functions
(vl-list-exported-functions [appname])
Arguments
appname
A string naming a loaded VLX application. Do not include the .vlx extension.
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 164/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
_$ (vl-list-exported-functions "whichexpns")
("WHICHNAMESPACE")
See Also
-------------------------------------------------------------------------------
vl-list-length
(vl-list-length list-or-cons-object)
Arguments
list-or-cons-object
Return Values
An integer containing the list length if the argument is a true list, or nil if
list-or-cons-object is a dotted list.
Compatibility note: The vl-list-length function returns nil for a dotted list,
while the corresponding Common Lisp function issues an error message if the
argument is a dotted list.
Examples
_$ (vl-list-length nil)
nil
See Also
-------------------------------------------------------------------------------
vl-list-loaded-vlx
Returns a list of all separate-namespace VLX files associated with the current
document
(vl-list-loaded-vlx)
Return Values
A list of symbols identifying separate-namespace VLX applications associated
with the current AutoCAD document, or nil if there are no VLX applications
associated with the current document.
The vl-list-loaded-vlx function does not identify VLX applications that are
loaded in the current document's namespace.
https://www.theswamp.org/Sources/doc/avlisp/#trans 165/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Test for loaded VLX files associated with the current AutoCAD document:
_$ (vl-list-loaded-vlx)
nil
Load two VLX files; both VLX applications have been compiled to run in their
own namespace:
nil
nil
Test for loaded VLX files associated with the current AutoCAD document:
_$ (vl-list-loaded-vlx)
(FOO1 FOO2)
nil
_$ (vl-list-loaded-vlx)
(FOO1 FOO2))
-------------------------------------------------------------------------------
vl-load-all
Loads a file into all open AutoCAD documents, and into any document
subsequently opened during the current AutoCAD session
(vl-load-all filename)
Arguments
filename
A string naming the file to be loaded. If the file is in the AutoCAD Support
File Search Path, you can omit the path name, but you must always specify the
file extension; vl-load-all does not assume a file type.
Return Values
Examples
_$ (vl-load-all "c:/my documents/visual lisp/examples/whichns.lsp")
nil
_$ (vl-load-all "yinyang.lsp")
nil
-------------------------------------------------------------------------------
vl-load-com
https://www.theswamp.org/Sources/doc/avlisp/#trans 166/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vl-load-com)
This function loads the extended AutoLISP functions provided with Visual LISP.
The Visual LISP extensions implement ActiveX and AutoCAD reactor support
through AutoLISP, and also provide ActiveX utility and data conversion
functions, dictionary handling functions, and curve measurement functions.
Return Values
Unspecified.
See Also
The load function in this reference and the Using Extended AutoLISP Functions
topic in the Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
vl-load-reactors
(vl-load-reactors)
See Also
-------------------------------------------------------------------------------
vl-member-if
The vl-member-if function passes each element in list to the function specified
in predicate-function. If predicate-function returns a non-nil value,
vl-member-if returns the rest of the list in the same manner as the member
function.
Arguments
predicate-function
The test function. This can be any function that accepts a single argument and
returns T for any user-specified condition. The predicate-function value can
take one of the following forms:
list
A list to be tested.
Return Values
A list, starting with the first element that passes the test and containing all
elements following this in the original argument. If none of the elements
passes the test condition, vl-member-if returns nil.
Examples
The following command draws a line:
https://www.theswamp.org/Sources/doc/avlisp/#trans 167/300
5/8/23, 12:24 PM Auto/Visual lisp help
_$ (COMMAND "_.LINE" '(0 10) '(30 50) nil)
nil
_$ (vl-member-if
(entget (entlast)))
((100 . "AcDbLine") (10 0.0 10.0 0.0) (11 30.0 50.0 0.0) (210 0.0
0.0 1.0))
See Also
-------------------------------------------------------------------------------
vl-member-if-not
Arguments
predicate-function
The test function. This can be any function that accepts a single argument and
returns T for any user-specified condition. The predicate-function value can
take one of the following forms:
list
A list to be tested.
Return Values
A list, starting with the first element that fails the test and containing all
elements following this in the original argument. If none of the elements fails
the test condition, vl-member-if-not returns nil.
Examples
_$ (vl-member-if-not 'atom '(1 "Str" (0 . "line") nil t))
See Also
-------------------------------------------------------------------------------
vl-position
Arguments
symbol
https://www.theswamp.org/Sources/doc/avlisp/#trans 168/300
5/8/23, 12:24 PM Auto/Visual lisp help
list
A true list.
Return Values
An integer containing the index position of symbol in list, or nil if symbol
does not exist in the list.
Note that the first list element is index 0, the second element is index 1, and
so on.
Examples
_$ (setq stuff (list "a" "b" "c" "d" "e"))
-------------------------------------------------------------------------------
vl-prin1-to-string
(vl-prin1-to-string data)
Arguments
data
Return Values
A string containing the printed representation of data as if displayed by
prin1.
Examples
_$ (vl-prin1-to-string "abc")
"\"abc\""
_$ (vl-prin1-to-string "c:\\acadwin")
"\"C:\\\\ACADWIN\""
_$ (vl-prin1-to-string 'my-var)
"MY-VAR"
See Also
-------------------------------------------------------------------------------
vl-princ-to-string
(vl-princ-to-string data)
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 169/300
5/8/23, 12:24 PM Auto/Visual lisp help
data
Return Values
A string containing the printed representation of data as if displayed by
princ.
Examples
_$ (vl-princ-to-string "abc")
"abc"
_$ (vl-princ-to-string "c:\\acadwin")
"C:\\ACADWIN"
_$ (vl-princ-to-string 'my-var)
"MY-VAR"
See Also
-------------------------------------------------------------------------------
vl-propagate
Copies the value of a variable into all open document namespaces (and sets its
value in any subsequent drawings opened during the current AutoCAD session)
(vl-propagate 'symbol)
Arguments
symbol
Return Values
Unspecified.
Examples
Command: (vl-propagate 'radius)
nil
-------------------------------------------------------------------------------
vl-registry-delete
Arguments
reg-key
val-name
If val-name is supplied and is not nil, the specified value will be purged from
the registry. If val-name is absent or nil, the function deletes the specified
key and all of its values.
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 170/300
5/8/23, 12:24 PM Auto/Visual lisp help
T if successful, otherwise nil.
Examples
"test data"
_$ (vl-registry-read "HKEY_CURRENT_USER\\Test")
"test data"
_$ (vl-registry-delete "HKEY_CURRENT_USER\\Test")
Note: This function cannot delete a key that has subkeys. To delete a subtree
you must use vl-registry-descendents to enumerate all subkeys and delete all of
them.
See Also
-------------------------------------------------------------------------------
vl-registry-descendents
Returns a list of subkeys or value names for the specified registry key
Arguments
reg-key
val-names
If val-names is supplied and is not nil, the specified value names will be
listed from the registry. If val-name is absent or nil, the function displays
all subkeys of reg-key.
Return Values
A list of strings, if successful, otherwise nil.
Examples
_$ (vl-registry-descendents "HKEY_LOCAL_MACHINE\\SOFTWARE")
See Also
-------------------------------------------------------------------------------
vl-registry-read
Returns data stored in the Windows registry for the specified key/value pair
Arguments
reg-key
https://www.theswamp.org/Sources/doc/avlisp/#trans 171/300
5/8/23, 12:24 PM Auto/Visual lisp help
val-name
If val-name is supplied and is not nil, the specified value will be read from
the registry. If val-name is absent or nil, the function reads the specified
key and all of its values.
Return Values
Examples
_$ (vl-registry-read "HKEY_CURRENT_USER\\Test")
nil
"test data"
_$ (vl-registry-read "HKEY_CURRENT_USER\\Test")
"test data"
See Also
-------------------------------------------------------------------------------
vl-registry-write
Arguments
reg-key
val-name
val-data
If val-name is not supplied or is nil, a default value for the key is written.
If val-name is supplied and val-data is not specified, an empty string is
stored.
Return Values
Examples
_$ (vl-registry-write "HKEY_CURRENT_USER\\Test" "" "test data")
"test data"
_$ (vl-registry-read "HKEY_CURRENT_USER\\Test")
"test data"
See Also
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 172/300
5/8/23, 12:24 PM Auto/Visual lisp help
vl-remove
Arguments
element-to-remove
The value of the element to be removed; may be any LISP data type.
list
Any list.
Return Values
Examples
_$ (vl-remove pi (list pi t 0 "abc"))
(T 0 "abc")
-------------------------------------------------------------------------------
vl-remove-if
Returns all elements of the supplied list that fail the test function
Arguments
predicate-function
The test function. This can be any function that accepts a single argument and
returns T for any user-specified condition. The predicate-function value can
take one of the following forms:
list
A list to be tested.
Return Values
A list containing all elements of list for which predicate-function returns
nil.
Examples
_$ (vl-remove-if 'vl-symbolp (list pi t 0 "abc"))
(3.14159 0 "abc")
-------------------------------------------------------------------------------
vl-remove-if-not
Returns all elements of the supplied list that pass the test function
Arguments
predicate-function
https://www.theswamp.org/Sources/doc/avlisp/#trans 173/300
5/8/23, 12:24 PM Auto/Visual lisp help
The test function. This can be any function that accepts a single argument and
returns T for any user-specified condition. The predicate-function value can
take one of the following forms:
list
A list to be tested.
Return Values
A list containing all elements of list for which predicate-function returns a
non-nil value
Examples
(T)
-------------------------------------------------------------------------------
vl-some
Checks whether the predicate is not nil for one element combination
Arguments
predicate-function
The test function. This can be any function that accepts as many arguments as
there are lists provided with vl-some, and returns T on a user-specified
condition. The predicate-function value can take one of the following forms:
list
A list to be tested.
The vl-some function passes the first element of each supplied list as an
argument to the test function, then the next element from each list, and so on.
Evaluation stops as soon as the predicate function returns a non-nil value for
an argument combination, or until all elements have been processed in one of
the lists.
Return Values
Examples
The following example checks whether nlst (a number list) has equal elements in
sequence:
(0 2 3.14159 3.14159 4)
-------------------------------------------------------------------------------
vl-sort
https://www.theswamp.org/Sources/doc/avlisp/#trans 174/300
5/8/23, 12:24 PM Auto/Visual lisp help
Sorts the elements in a list according to a given compare function
Arguments
list
Any list.
comparison-function
A comparison function. This can be any function that accepts two arguments and
returns T (or any non-nil value) if the first argument precedes the second in
the sort order. The comparison-function value can take one of the following
forms:
Return Values
A list containing the elements of list in the order specified by
comparison-function. Duplicate elements may be eliminated from the list.
Examples
Sort a list of numbers:
(1 2 3) ;
((3 1) (2 2) (1 3))
_$ (vl-sort
'(a d c b a)
-------------------------------------------------------------------------------
vl-sort-i
Sorts the elements in a list according to a given compare function, and returns
the element index numbers
Arguments
list
Any list.
comparison-function
A comparison function. This can be any function that accepts two arguments and
returns T (or any non-nil value) if the first argument precedes the second in
the sort order. The comparison-function value can take one of the following
forms:
https://www.theswamp.org/Sources/doc/avlisp/#trans 175/300
5/8/23, 12:24 PM Auto/Visual lisp help
* A symbol (function name)
* '(LAMBDA (A1 A2) ...)
* (FUNCTION (LAMBDA (A1 A2) ...))
Return Values
A list containing the index values of the elements of list, sorted in the order
specified by comparison-function. Duplicate elements will be retained in the
result.
Examples
Sort a list of characters in descending order:
(2 1 3 0)
The sorted list order is "f" "d" "c" "a"; "f" is the 3rd element (index 2) in
the original list, "d" is the 2nd element (index 1) in the list, and so on.
(2 1 3 0)
Note that both occurrences of 3 are accounted for in the result list.
Sort a list of 2D points by Y coordinate:
(2 1 0)
_$ (vl-sort-i
'(a d c b a)
(4 0 3 2 1)
Note that both a's are accounted for in the result list.
-------------------------------------------------------------------------------
vl-string->list
(vl-string->list string)
Arguments
string
A string.
Return Values
A list, each element of which is an integer representing the character code of
the corresponding character in string.
Examples
_$ (vl-string->list "")
nil
_$ (vl-string->list "12")
https://www.theswamp.org/Sources/doc/avlisp/#trans 176/300
5/8/23, 12:24 PM Auto/Visual lisp help
(49 50)
See Also
-------------------------------------------------------------------------------
vl-string-elt
Arguments
string
A string to be inspected.
position
Return Values
An integer denoting the ASCII representation of the character at the specified
position
Examples
_$ (vl-string-elt "May the Force be with you" 8)
70
-------------------------------------------------------------------------------
vl-string-left-trim
Arguments
character-set
string
Return Values
A string containing a substring of string with all leading characters in
character-set removed
Examples
"STR "
_$ (vl-string-left-trim " " " There are too many spaces here")
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 177/300
5/8/23, 12:24 PM Auto/Visual lisp help
vl-string-mismatch
Returns the length of the longest common prefix for two strings, starting at
specified positions
Arguments
str1
str2
pos1
pos2
ignore-case-p
Return Values
An integer.
Examples
_$ (vl-string-mismatch "VL-FUN" "VL-VAR")
-------------------------------------------------------------------------------
vl-string-position
Arguments
char-code
str
start-pos
https://www.theswamp.org/Sources/doc/avlisp/#trans 178/300
5/8/23, 12:24 PM Auto/Visual lisp help
The position to begin searching from in the string (first character is 0); 0 if
omitted.
from-end-p
If T is specified for this argument, the search begins at the end of the string
and continues backward to pos.
Return Values
An integer representing the displacement at which char-code was found from the
beginning of the string; nil if the character was not found.
Examples
_$ (vl-string-position (ascii "z") "azbdc")
nil
The search string used in the following example contains two "z" characters.
Reading from left to right, with the first character being displacement 0,
there is one z at displacement 1 and another z at displacement 3:
Searching from left to right (the default), the "z" in position 1 is the first
one vl-string-position encounters. But when searching from right to left, as in
the following example, the "z" in position 3 is the first one encountered:
-------------------------------------------------------------------------------
vl-string-right-trim
Arguments
character-set
string
Return Values
A string containing a substring of string with all trailing characters in
character-set removed.
Examples
_$ (vl-string-right-trim " \t\n" " STR \n\t ")
" STR"
_$ (vl-string-right-trim " " "There are too many spaces here ")
https://www.theswamp.org/Sources/doc/avlisp/#trans 179/300
5/8/23, 12:24 PM Auto/Visual lisp help
"There are too many spaces here"
-------------------------------------------------------------------------------
vl-string-search
Arguments
pattern
string
start-pos
Return Values
An integer representing the position in the string where the specified pattern
was found, or nil if the pattern is not found; the first character of the
string is position 0.
Examples
_$ (vl-string-search "foo" "pfooyey on you")
nil
11
-------------------------------------------------------------------------------
vl-string-subst
Arguments
new-str
pattern
string
start-pos
Return Values
The value of string after any substitutions have been made
https://www.theswamp.org/Sources/doc/avlisp/#trans 180/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Replace the string "Ben" with "Obi-wan":
"Obi-wan Kenobi"
"ben Kenobi"
Nothing was substituted because vl-string-subst did not find a match for "Ben";
the "ben" in the string that was searched begins with a lowercase "b".
Note that there are two occurrences of "Ben" in the string that was searched,
but vl-string-subst only replaces the first occurrence.
Replace "Ben" with "Obi-wan," but start the search at the fourth character in
the string:
There are two occurrences of "Ben" in the string that was searched, but because
vl-string-subst was instructed to begin searching at the fourth character, it
found and replaced the second occurrence, not the first.
-------------------------------------------------------------------------------
vl-string-translate
Arguments
source-set
dest-set
str
Return Values
The value of str after any substitutions have been made
Examples
"1 is 1, 2 is 2, 3 is 3"
"A is 1, B is 2, C is 3"
-------------------------------------------------------------------------------
vl-string-trim
https://www.theswamp.org/Sources/doc/avlisp/#trans 181/300
5/8/23, 12:24 PM Auto/Visual lisp help
Removes the specified characters from the beginning and end of a string
Arguments
char-set
str
Return Values
The value of str, after any characters have been trimmed.
Examples
_$ (vl-string-trim " \t\n" " \t\n STR \n\t ")
"STR"
"Leave me alone"
-------------------------------------------------------------------------------
vl-symbol-name
(vl-symbol-name symbol)
Arguments
symbol
Return Values
A string containing the name of the supplied symbol argument, in uppercase.
Examples
_$ (vl-symbol-name 'S::STARTUP)
"S::STARTUP"
"MY-VAR"
_$ (vl-symbol-name 1)
-------------------------------------------------------------------------------
vl-symbol-value
(vl-symbol-value symbol)
This function is equivalent to the eval function, but does not call the LISP
https://www.theswamp.org/Sources/doc/avlisp/#trans 182/300
5/8/23, 12:24 PM Auto/Visual lisp help
evaluator.
Arguments
symbol
Return Values
The value of symbol, after evaluation.
Examples
_$ (vl-symbol-value 't)
_$ (vl-symbol-value 'PI)
3.14159
"\\"
-------------------------------------------------------------------------------
vl-symbolp
Arguments
(vl-symbolp object)
object
Return Values
T if object is a symbol, otherwise nil.
Examples
_$ (vl-symbolp t)
_$ (vl-symbolp nil)
nil
_$ (vl-symbolp 1)
nil
nil
-------------------------------------------------------------------------------
vl-unload-vlx
(vl-unload-vlx appname)
Arguments
appname
A string naming a VLX application that is loaded in its own namespace. Do not
include the .vlx extension.
https://www.theswamp.org/Sources/doc/avlisp/#trans 183/300
5/8/23, 12:24 PM Auto/Visual lisp help
The vl-unload-vlx function does not unload VLX applications that are loaded in
the current document's namespace.
Return Values
T if successful, otherwise vl-unload-vlx results in an error.
Examples
Assuming that vlxns is an application that is loaded in its own namespace, the
following command unloads vlxns:
The vl-unload-vlx command fails this time, because the application was not
loaded.
See Also
-------------------------------------------------------------------------------
vl-vbaload
Arguments
(vl-vbaload filename)
filename
Return Values
Unspecified, if successful.
Examples
_$ (vl-vbaload "c:/program files/AutoCAD/sample/vba/
drawline.dvb")
"c:\\program files\\AutoCAD\\sample\\vba\\drawline.dvb"
See Also
-------------------------------------------------------------------------------
vl-vbarun
Arguments
(vl-vbarun macroname)
macroname
Return Values
macroname
https://www.theswamp.org/Sources/doc/avlisp/#trans 184/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Load a VBA project file:
"c:\\program files\\AutoCAD\\sample\\vba\\drawline.dvb"
_$ (vl-vbarun "drawline")
"drawline"
See Also
-------------------------------------------------------------------------------
vl-vlx-loaded-p
(vl-vlx-loaded-p appname)
Arguments
appname
Return Values
T if the application is loaded, nil if it is not loaded.
Examples
Check to see if the vlxns application is loaded in its own namespace:
nil
nil
This example assumes vlxns was defined to run in its own namespace. If the
application was not defined to run in its own namespace, it would load into the
current document's namespace and vl-vlx-loaded-p would return nil.
See Also
-------------------------------------------------------------------------------
vlax-3D-point
https://www.theswamp.org/Sources/doc/avlisp/#trans 185/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
list
x, y
Return Values
A variant containing a three-element array of doubles.
Examples
_$ (vlax-3D-point 5 20)
See Also
-------------------------------------------------------------------------------
vlax-add-cmd
Note: You cannot use vlax-add-cmd to expose functions that create reactor
objects or serve as reactor callbacks.
Arguments
global-name
A string.
func-sym
local-name
https://www.theswamp.org/Sources/doc/avlisp/#trans 186/300
5/8/23, 12:24 PM Auto/Visual lisp help
cmd-flags
ACRX_CMD_REDRAW (4) When the pickfirst set or grip set is retrieved, neither
will be cleared within AutoCAD. Command can retrieve the pickfirst set and the
grip set.
If both ACRX_CMD_USEPICKSET and ACRX_CMD_REDRAW are set, the effect is the same
as if just ACRX_CMD_REDRAW is set. For more information on the flags, refer to
the Command Stack topic in the ObjectARX Reference manual.
Return Values
The global-name argument, if successful. The function returns nil, if
acedRegCmds->addCommand(...) returns an error condition.
Examples
The hello-autocad function in the following example has no c: prefix, but
vlax-add-cmd makes it visible as an ObjectARX-style command at the AutoCAD
Command prompt:
HELLO-AUTOCAD
"hello-autocad"
See Also
-------------------------------------------------------------------------------
vlax-create-object
(vlax-create-object prog-id)
Arguments
prog-id
<Vendor>.<Component>.<Version>
For example:
AutoCAD.Drawing.15
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 187/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Create an instance of an Excel application:
_$ (vlax-create-object "Excel.Application")
-------------------------------------------------------------------------------
vlax-curve-getArea
(vlax-curve-getArea curve-obj)
Arguments
curve-obj
Return Values
A real number representing the area of the curve, if successful, otherwise nil.
Examples
Assume the curve being measured is the ellipse in the following drawing:
_$ (vlax-curve-getArea ellipseObj)
4.712393
-------------------------------------------------------------------------------
vlax-curve-getClosestPointTo
Returns the point (in WCS) on a curve that is nearest to the specified point
Arguments
curve-obj
givenPnt
A point (in WCS) for which to find the nearest point on the curve.
extend
Return Values
A 3D point list representing a point on the curve, if successful, otherwise
nil.
Examples
Assume that the curve being measured is the arc in the following drawing:
Return the closest point on the arc to the coordinates 6.0, 0.5:
https://www.theswamp.org/Sources/doc/avlisp/#trans 188/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return the closest point on the arc to the coordinates 6.0, 0.5, after
extending the arc:
-------------------------------------------------------------------------------
vlax-curve-getClosestPointToProjection
Returns the closest point (in WCS) on a curve after projecting the curve onto a
plane
Arguments
curve-obj
givenPnt
A point (in WCS) for which to find the nearest point on the curve.
normal
extend
Return Values
A 3D point list representing a point on the curve, if successful, otherwise
nil.
-------------------------------------------------------------------------------
vlax-curve-getDistAtParam
Returns the length of the curve's segment from the curve's beginning to the
specified parameter
Arguments
curve-obj
param
Return Values
A real number that is the length up to the specified parameter, if successful,
otherwise nil.
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 189/300
5/8/23, 12:24 PM Auto/Visual lisp help
0.0
17.1546
_$ (vlax-curve-getDistAtParam splineObj
8.99417
The distance from the start to the middle of the curve is 8.99417.
-------------------------------------------------------------------------------
vlax-curve-getDistAtPoint
Returns the length of the curve's segment between the curve's start point and
the specified point
Arguments
curve-obj
point
Return Values
A real number if successful, otherwise nil.
Examples
For the following example, assume that splineObj points to the spline shown in
the example for vlax-curve-getDistAtParam .
Set OSNAP to tangent and select the point where the line is tangent to the
curve:
Determine the distance from the start of the curve to the selected point:
5.17769
-------------------------------------------------------------------------------
vlax-curve-getEndParam
https://www.theswamp.org/Sources/doc/avlisp/#trans 190/300
5/8/23, 12:24 PM Auto/Visual lisp help
Returns the parameter of the endpoint of the curve
(vlax-curve-getEndParam curve-obj)
Arguments
curve-obj
Return Values
A real number representing an end parameter, if successful, otherwise nil.
Examples
Assuming that ellipseObj points to the ellipse shown in the example for
vlax-curve-getArea , the following function call returns the end parameter of
the curve:
_$ (vlax-curve-getendparam ellipseObj)
6.28319
See Also
-------------------------------------------------------------------------------
vlax-curve-getEndPoint
(vlax-curve-getEndPoint curve-obj)
Arguments
curve-obj
Return Values
A 3D point list representing an endpoint, if successful, otherwise nil.
Examples
Get the endpoint of the ellipse used to demonstrate vlax-curve-getArea :
_$ (vlax-curve-getEndPoint ellipseObj)
-------------------------------------------------------------------------------
vlax-curve-getFirstDeriv
Returns the first derivative (in WCS) of a curve at the specified location
Arguments
curve-obj
param
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 191/300
5/8/23, 12:24 PM Auto/Visual lisp help
A 3D vector list, if successful, otherwise nil.
Examples
For the following example, assume that splineObj points to the spline shown in
the example of the vlax-curve-getDistAtParam function.
0.0
17.1546
Determine the first derivative at the parameter midway along the curve:
_$ (vlax-curve-getFirstDeriv splineObj
-------------------------------------------------------------------------------
vlax-curve-getParamAtDist
Returns the parameter of a curve at the specified distance from the beginning
of the curve
Arguments
curve-obj
dist
Return Values
Examples
Assuming that splineObj points to the spline shown in the example for
vlax-curve-getDistAtParam , determine the parameter at a distance of 1.0 from
the beginning of the spline:
0.685049
-------------------------------------------------------------------------------
vlax-curve-getParamAtPoint
Arguments
curve-obj
point
https://www.theswamp.org/Sources/doc/avlisp/#trans 192/300
5/8/23, 12:24 PM Auto/Visual lisp help
A 3D point list (in WCS) on curve-obj.
Return Values
A real number representing a parameter, if successful, otherwise nil.
Examples
Assuming that ellipseObj points to the ellipse shown in the example for
vlax-curve-getArea , set OSNAP to tangent and select the point where the line
is tangent to the ellipse:
4.58296
-------------------------------------------------------------------------------
vlax-curve-getPointAtDist
Returns the point (in WCS) along a curve at the distance specified by the user
Arguments
curve-obj
dist
The distance along the curve from the beginning of the curve to the location of
the specified point.
Return Values
A 3D point list representing a point on the curve, if successful, otherwise
nil.
Examples
Assuming that splineObj points to the spline shown in the example for
vlax-curve-getDistAtParam , determine the point at a distance of 1.0 from the
beginning of the spline:
-------------------------------------------------------------------------------
vlax-curve-getPointAtParam
Arguments
curve-obj
param
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 193/300
5/8/23, 12:24 PM Auto/Visual lisp help
A 3D point list representing a point on the curve, if successful, otherwise
nil.
Examples
For the following example, assume that splineObj points to the spline shown in
the example for vlax-curve-getDistAtParam .
0.0
17.1546
_$ (vlax-curve-getPointAtParam splineObj
-------------------------------------------------------------------------------
vlax-curve-getSecondDeriv
Returns the second derivative (in WCS) of a curve at the specified location
Arguments
curve-obj
param
Return Values
A 3D vector list, if successful, otherwise nil.
Examples
For the following example, assume that splineObj points to the spline shown in
the example of the vlax-curve-getDistAtParam function.
0.0
17.1546
Determine the second derivative at the parameter midway along the curve:
_$ (vlax-curve-getSecondDeriv splineObj
-------------------------------------------------------------------------------
vlax-curve-getStartParam
https://www.theswamp.org/Sources/doc/avlisp/#trans 194/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vlax-curve-getStartParam curve-obj)
Arguments
curve-obj
Return Values
A real number representing the start parameter, if successful, otherwise nil.
Examples
Assuming that ellipseObj points to the ellipse shown in the example for
vlax-curve-getArea , determine the start parameter of the curve:
_$ (vlax-curve-getstartparam ellipseObj)
0.0
See Also
-------------------------------------------------------------------------------
vlax-curve-getStartPoint
(vlax-curve-getStartPoint curve-obj)
Arguments
curve-obj
Return Values
A 3D point list representing the start point, if successful, otherwise nil.
Examples
Get the start point of the ellipse used to demonstrate vlax-curve-getArea :
_$ (vlax-curve-getStartPoint ellipseObj)
For an ellipse, the start points and endpoints are the same.
_$ (vlax-curve-getStartPoint splineObj)
-------------------------------------------------------------------------------
vlax-curve-isClosed
Determines if the specified curve is closed (that is, the start point is the
same as the endpoint)
(vlax-curve-isClosed curve-obj)
Arguments
curve-obj
https://www.theswamp.org/Sources/doc/avlisp/#trans 195/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
T if the curve is closed, otherwise nil.
Examples
Determine if the ellipse used to demonstrate vlax-curve-getArea is closed:
_$ (vlax-curve-isClosed ellipseObj)
_$ (vlax-curve-isClosed splineObj)
nil
-------------------------------------------------------------------------------
vlax-curve-isPeriodic
Determines if the specified curve has an infinite range in both directions and
there is a period value dT, such that a point on the curve at (u + dT) = point
on curve (u), for any parameter u
(vlax-curve-isPeriodic curve-obj)
Arguments
curve-obj
Return Values
T if the curve is periodic, otherwise nil.
Examples
Determine if the ellipse used to demonstrate vlax-curve-getArea is periodic:
_$ (vlax-curve-isPeriodic ellipseObj)
_$ (vlax-curve-isPeriodic splineObj)
nil
-------------------------------------------------------------------------------
vlax-curve-isPlanar
(vlax-curve-isPlanar curve-obj)
Arguments
curve-obj
Return Values
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 196/300
5/8/23, 12:24 PM Auto/Visual lisp help
_$ (vlax-curve-isPlanar ellipseObj)
_$ (vlax-curve-isPeriodic splineObj)
nil
-------------------------------------------------------------------------------
vlax-dump-object
Lists an object's properties, and optionally, the methods that apply to the
object
Arguments
obj
A VLA-object.
Return Values
Examples
_$ (setq aa (vlax-get-acad-object))
_$ (vlax-dump-object aa)
; Property values:
List an object's properties and the methods that apply to the object:
_$ (vlax-dump-object aa T)
; Property values:
https://www.theswamp.org/Sources/doc/avlisp/#trans 197/300
5/8/23, 12:24 PM Auto/Visual lisp help
; Methods supported:
; EndUndoMark ()
; Eval (1)
; GetInterfaceObject (1)
; ListAds ()
; ListArx ()
-------------------------------------------------------------------------------
vlax-ename->vla-object
(vlax-ename->vla-object entname)
Arguments
entname
Return Values
A VLA-object.
Examples
_$ (setq e (car (entsel)))
_$ (vlax-ename->vla-object e)
See Also
-------------------------------------------------------------------------------
vlax-erased-p
(vlax-erased-p obj)
Arguments
obj
A VLA-object.
Return Values
T if the object was erased, otherwise nil.
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 198/300
5/8/23, 12:24 PM Auto/Visual lisp help
vlax-for
Arguments
symbol
collection
expression1, expression2...
Return Values
The value of the last expression evaluated for the last object in the
collection.
Examples
The following code issues vlax-dump-object on every drawing object in the model
space:
(vlax-for for-item
(vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
-------------------------------------------------------------------------------
vlax-get-acad-object
Retrieves the top level AutoCAD application object for the current AutoCAD
session
(vlax-get-acad-object)
Return Values
A VLA-object.
Examples
_$ (setq aa (vlax-get-acad-object))
-------------------------------------------------------------------------------
vlax-get-object
(vlax-get-object prog-id)
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 199/300
5/8/23, 12:24 PM Auto/Visual lisp help
prog-id
A string that identifies the desired application object. The format of prog-id
is:
appname.objecttype
where appname is the name of the application and objecttype is the application
object. The objecttype may be followed by a version number.
Note: You can usually find the prog-id for an application in that
application's Help. For example, Microsoft(R) Office applications document this
information in the Visual Basic(R) Reference section of their Help.
Return Values
The application object, or nil, if there is no instance of the specified object
currently running.
Examples
Obtain the Application object for the Excel program:
_$ (vlax-get-object "Excel.Application")
-------------------------------------------------------------------------------
vlax-get-or-create-object
(vlax-get-or-create-object prog-id)
Arguments
prog-id
<Vendor>.<Component>.<Version>
For example:
AutoCAD.Drawing.15
Return Values
The object.
Examples
_$ (vlax-get-or-create-object "Excel.Application")
-------------------------------------------------------------------------------
vlax-get-property
Arguments
object
A VLA-object.
property
https://www.theswamp.org/Sources/doc/avlisp/#trans 200/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
The value of the object's property.
Examples
Begin by retrieving a pointer to the root AutoCAD object:
256
See Also
-------------------------------------------------------------------------------
vlax-import-type-library
Arguments
filename
A string naming the type library. A file can be one of the following types:
If you omit the path from tlb-filename, AutoCAD looks for the file in the
Support File Search Path.
mprefix
Prefix to be used for method wrapper functions. For example, if the type
library contains a Calculate method and the mprefix parameter is set to "cc-",
Visual LISP generates a wrapper function named cc-Calculate. This parameter
defaults to "".
pprefix
https://www.theswamp.org/Sources/doc/avlisp/#trans 201/300
5/8/23, 12:24 PM Auto/Visual lisp help
Prefix to be used for property wrapper functions. For example, if the type
library contains a Width property with both read and write permissions, and
pprefix is set to "cc-", then Visual LISP generates wrapper functions named
cc-get-Width and cc-put-Width. This parameter defaults to "".
cprefix
Prefix to be used for constants contained in the type library. For example, if
the type library contains a ccMaxCountOfRecords property with both read and
write permissions, and cprefix is set to "cc-", Visual LISP generates a
constant named cc-ccMaxCountOfRecords. This parameter defaults to "".
Return Values
T, if successful.
Examples
Import a Microsoft WordTM type library, assigning the prefix "msw-" to methods
and properties, and "mswc-" to constants:
_$ (vlax-import-type-library
:methods-prefix "msw-"
:properties-prefix "msw-"
:constants-prefix "mswc-")
Remarks
See Also
-------------------------------------------------------------------------------
vlax-invoke-method
Arguments
obj
A VLA-object.
method
https://www.theswamp.org/Sources/doc/avlisp/#trans 202/300
5/8/23, 12:24 PM Auto/Visual lisp help
arg
Return Values
Depends on the method invoked.
Examples
The following example uses the AddCircle method to draw a circle in the current
AutoCAD drawing.
The first argument to AddCircle specifies the location of the center of the
circle. The method requires the center to be specified as a variant containing
a three-element array of doubles. You can use vlax-3d-point to convert an
AutoLISP point list to the required variant data type:
See Also
-------------------------------------------------------------------------------
vlax-ldata-delete
Arguments
dict
key
private
Return Values
T, if successful, otherwise nil (for example, the data did not exist).
Examples
Add LISP data to a dictionary:
(1)
https://www.theswamp.org/Sources/doc/avlisp/#trans 203/300
5/8/23, 12:24 PM Auto/Visual lisp help
because the data does not exist in the dictionary:
nil
See Also
-------------------------------------------------------------------------------
vlax-ldata-get
Arguments
dict
key
default-data
private
If you specify private, you must also specify default-data; you can use nil for
default-data.
Note that a separate-namespace VLX can store both private and non-private data
using the same dict and key. The private data can only be accessed by the same
VLX, but any application can retrieve the non-private data.
Return Values
The value of the key item.
Examples
Enter the following commands at the Visual LISP Console window:
"Mumbo Dumbo"
"Mumbo Dumbo"
"Mumbo Dumbo"
"Mumbo Dumbo"
* Enter the following code in a file and use Make Application to build a VLX
from the file. Use the Expert mode of the Make Application Wizard, and
select the Separate Namespace option in the Compile Options tab.
(vl-doc-export 'ldataput)
(vl-doc-export 'ldataget)
https://www.theswamp.org/Sources/doc/avlisp/#trans 204/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vl-doc-export 'ldataget-nilt)
(defun ldataput ()
(defun ldataget ()
(defun ldataget-nilt ()
)
* Load the VLX file.
* Run ldataput to save private data:
_$ (ldataput)
Refer back to the code defining ldataput: this function stores a string
containing "Mine! Mine!"
_$ (ldataget)
"Mumbo Dumbo"
Notice that the data returned by ldataget is not the data stored by ldataput.
This is because ldataget does not specify the private argument in its call to
vlax-ldata-get. So the data retrieved byldataget is the data set by issuing
vlax-ldata-put from the Visual LISP Console in step 1.
_$ (ldataget-nilt)
_$ (ldataget-nilt)
This time the private data saved by ldataput is returned, because ldataget-nilt
specifies the private argument in its call to vlax-ldata-get.
* From the Visual LISP Console prompt, issue the same call that ldataget-nilt
uses to retrieve private data:
"Mumbo Dumbo"
See Also
-------------------------------------------------------------------------------
vlax-ldata-list
Arguments
dict
https://www.theswamp.org/Sources/doc/avlisp/#trans 205/300
5/8/23, 12:24 PM Auto/Visual lisp help
A VLA-object, AutoCAD drawing entity object, or a string naming a global
dictionary.
private
Return Values
An associative list consisting of pairs (key . value).
Examples
Use vlax-ldata-put to store LISP data in a dictionary:
"Floobar "
_$ (vlax-ldata-list "dict")
See Also
-------------------------------------------------------------------------------
vlax-ldata-put
Arguments
dict
key
data
private
Return Values
The value of data.
Examples
_$ (vlax-ldata-put "dict" "key" '(1))
(1)
"Gumbo jumbo"
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 206/300
5/8/23, 12:24 PM Auto/Visual lisp help
The vlax-ldata-get, and vlax-ldata-list functions.
-------------------------------------------------------------------------------
vlax-ldata-test
(vlax-ldata-test data)
Arguments
data
Return Values
T, if the data can be saved and restored over the session boundary, nil
otherwise.
Examples
Determine if a string can be saved as ldata over a session boundary:
_$ (vlax-ldata-test yinyang)
nil
See Also
-------------------------------------------------------------------------------
vlax-make-safearray
Creates a safearray
Numbers
Strings
Zero-length string.
Booleans
:vlax-false
Object
nil
Variant
Uninitialized (vlax-vbEmpty)
Arguments
type
https://www.theswamp.org/Sources/doc/avlisp/#trans 207/300
5/8/23, 12:24 PM Auto/Visual lisp help
The integer shown in parentheses indicates the value to which the constant
evaluates. It is recommended that you specify the constant in your argument,
not the integer value, in case the value changes in later releases of AutoCAD.
'(l-bound . u-bound)
Return Values
The safearray created.
Examples
Create a single-dimension safearray consisting of doubles, beginning with index
0:
#<safearray...>
_$ (vlax-safearray->list point)
The result shows each element of the array was initialized to zero.
#<safearray...>
See Also
-------------------------------------------------------------------------------
vlax-make-variant
Arguments
value
type
The type of variant. This can be represented by one of the following constants:
https://www.theswamp.org/Sources/doc/avlisp/#trans 208/300
5/8/23, 12:24 PM Auto/Visual lisp help
vlax-vbEmpty (0) Uninitialized (default value)
The integer shown in parentheses indicates the value to which the constant
evaluates. It is recommended that you specify the constant in your argument,
not the integer value, because the value may change in later releases of
AutoCAD.
nil vlax-vbEmpty
:vlax-null vlax-vbNull
integer vlax-vbLong
real vlax-vbDouble
string vlax-vbString
VLA-object vlax-vbObject
vlax-make-safearray vlax-vbArray
Return Values
The variant created.
Examples
#<variant 0 >
#<variant 0 >
#<variant 2 5>
Repeat the previous command, but omit the type argument and see what happens:
#<variant 3 5>
https://www.theswamp.org/Sources/doc/avlisp/#trans 209/300
5/8/23, 12:24 PM Auto/Visual lisp help
#<variant 8 ghost>
#<safearray...>
_$ (vlax-make-variant 4dubs)
See Also
The vlax-variant-type ,
and vlax-variant-value functions. For more information on using variants, see
Working with Variants in the Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
vlax-map-collection
Arguments
obj
function
Return Values
The obj first argument.
Examples
(vlax-map-collection (vla-get-ModelSpace acadDocument) 'vlax-dump-
object)
; Property values:
; Closed = 0
; Color = 256
; ConstantWidth = 0.0
; Elevation = 0.0
; HasExtensionDictionary (RO) = 0
https://www.theswamp.org/Sources/doc/avlisp/#trans 210/300
5/8/23, 12:24 PM Auto/Visual lisp help
; Layer = "0"
; Linetype = "BYLAYER"
; LinetypeGeneration = 0
; LinetypeScale = 1.0
; Lineweight = -1
; PlotStyleName = "ByLayer"
; Thickness = 0.0
; Visible = -1
-------------------------------------------------------------------------------
vlax-method-applicable-p
Arguments
obj
A VLA-object.
method
Return Values
Examples
The following commands are issued against a LightweightPolyline object:
nil
See Also
-------------------------------------------------------------------------------
vlax-object-released-p
(vlax-object-released-p obj)
Note: Erasing a VLA-object (using command ERASE or vla-erase) does not release
the object. A VLA-object is not released until you either invoke
vlax-release-object on the object, normal AutoLISP garbage collection occurs,
or the drawing database is destroyed at the end of the drawing session.
https://www.theswamp.org/Sources/doc/avlisp/#trans 211/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
obj
A VLA-object.
Return Values
T, if the object is released (no AutoCAD drawing object is attached to obj),
nil, if the object has not been released.
Examples
Attach an Excel application to the current AutoCAD drawing:
_$ (vlax-release-object excelobj)
_$ (vlax-object-released-p excelobj)
-------------------------------------------------------------------------------
vlax-product-key
(vlax-product-key)
The AutoCAD registry path can be used to register an application for demand
loading.
Return Values
A string containing the AutoCAD registry path.
Examples
_$ (vlax-product-key)
"Software\\Autodesk\\AutoCAD\\R15.0\\ACAD-1:409"
-------------------------------------------------------------------------------
vlax-property-available-p
Arguments
obj
A VLA-object.
property
check-modify
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 212/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
The following examples apply to a LightweightPolyline object:
nil
Note how supplying the optional third argument changes the result:
_$ (vlax-property-available-p myCircle 'area T)
nil
The function returns nil because, although the circle has an "area" property,
that property cannot be modified.
See Also
-------------------------------------------------------------------------------
vlax-put-property
Arguments
obj
A VLA-object.
property
arg
Return Values
Nil, if successful.
Examples
nil
See Also
-------------------------------------------------------------------------------
vlax-read-enabled-p
https://www.theswamp.org/Sources/doc/avlisp/#trans 213/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vlax-read-enabled-p obj)
Arguments
obj
A VLA-object.
Return Values
-------------------------------------------------------------------------------
vlax-release-object
(vlax-release-object obj)
Arguments
obj
A VLA-object.
Return Values
Unspecified.
-------------------------------------------------------------------------------
vlax-remove-cmd
(vlax-remove-cmd global-name)
Removes a single command or the whole command group for the current AutoCAD
session.
Arguments
global-name
Return Values
T, if successful, nil otherwise (for example, the command is not defined).
Examples
Remove a command defined with vlax-add-cmd:
_$ (vlax-remove-cmd "hello-autocad")
_$ (vlax-remove-cmd "hello-autocad")
nil
This time vlax-remove-cmd returns nil, because the specified command does not
exist anymore.
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 214/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
vlax-safearray-fill
Arguments
var
'element-values
A list of values to be stored in the array. You can specify as many values as
there are elements in the array. If you specify fewer values than there are
elements, the remaining elements retain their current value.
Return Values
var
Examples
Create a single-dimension array of doubles:
#<safearray...>
#<safearray...>
_$ (vlax-safearray->list sa)
_$ (vlax-safearray-fill sa '(-66))
#<safearray...>
_$ (vlax-safearray->list sa)
Notice that only the first element in the array has been changed; the remaining
elements are unaffected and retain the value you previously set them to. If you
need to change the second or third elements and leave the first element
unaffected, use vlax-put-element.
https://www.theswamp.org/Sources/doc/avlisp/#trans 215/300
5/8/23, 12:24 PM Auto/Visual lisp help
each dimension:
#<safearray...>
#<safearray...>
_$ (vlax-safearray->list mat2)
See Also
The vlax-safearray-get-dim ,
vlax-safearray-get-l-bound ,
vlax-safearray-put-element ,
vlax-variant-value
functions.
-------------------------------------------------------------------------------
vlax-safearray-get-dim
(vlax-safearray-get-dim var)
Arguments
var
Return Values
An integer identifying the number of dimensions in var. An error occurs if var
is not a safearray.
Examples
Set sa-int to a single-dimension safearray with one dimension:
#<safearray...>
_$ (vlax-safearray-get-dim sa-int)
See Also
-------------------------------------------------------------------------------
vlax-safearray-get-element
Arguments
var
https://www.theswamp.org/Sources/doc/avlisp/#trans 216/300
5/8/23, 12:24 PM Auto/Visual lisp help
A variable whose data type is a safearray.
element...
Return Values
Examples
Create an array with two dimensions, each dimension starting at index 1:
#<safearray...>
"a"
"b"
"c"
"d"
_$ (vlax-safearray-get-element matrix 1 2)
"b"
See Also
The vlax-safearray-get-dim ,
vlax-safearray-get-u-bound , and
vlax-safearray-put-element functions.
-------------------------------------------------------------------------------
vlax-safearray-get-l-bound
Arguments
var
dim
Return Values
An integer representing the lower boundary (starting index) of the dimension.
If var is not an array, or dim is invalid (for example, 0, or a number greater
than the number of dimensions in the array), an error results.
Examples
The following examples evaluate a safearray defined as follows:
https://www.theswamp.org/Sources/doc/avlisp/#trans 217/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vlax-make-safearray vlax-vbString '(1 . 2) '(0 . 1) ))
_$ (vlax-safearray-get-l-bound tmatrix 1)
Get the starting index value of the second dimension of the array:
_$ (vlax-safearray-get-l-bound tmatrix 2)
See Also
-------------------------------------------------------------------------------
vlax-safearray-get-u-bound
Arguments
var
dim
Return Values
An integer representing the upper boundary (end index) of the dimension. If var
is not an array, or dim is invalid (for example, 0, or a number greater than
the number of dimensions in the array), an error results.
Examples
The following examples evaluate a safearray defined as follows:
_$ (vlax-safearray-get-u-bound tmatrix 1)
Get the end index value of the second dimension of the array:
_$ (vlax-safearray-get-u-bound tmatrix 2)
See Also
-------------------------------------------------------------------------------
vlax-safearray-put-element
https://www.theswamp.org/Sources/doc/avlisp/#trans 218/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
var
index...
A set of index values pointing to the element you are assigning a value to. For
a single-dimension array, specify one index value; for a two-dimension array,
specify two index values, and so on.
value
Return Values
Examples
Create a single-dimension array consisting of doubles:
#<safearray...>
100
100
_$ (vlax-safearray-put-element point 2 0)
#<safearray...>
"a"
"b"
"c"
"d"
Note that you can also populate arrays using the vlax-safearray-fill function.
The following function call accomplishes the same task as three
vlax-safearray-put-element calls:
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 219/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
vlax-safearray-type
(vlax-safearray-type var)
Arguments
var
Return Values
If var contains a safearray, one of the following integers is returned:
Integer (vlax-vbInteger)
String (vlax-vbString)
Object (vlax-vbObject)
11
Boolean (vlax-vbBoolean)
12
Variant (vlax-vbVariant)
Examples
Create a single-dimension array of doubles and a two-dimension array of
strings:
#<safearray...>
#<safearray...>
_$ (vlax-safearray-type point)
_$ (vlax-safearray-type matrix)
See Also
https://www.theswamp.org/Sources/doc/avlisp/#trans 220/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
vlax-safearray->list
(vlax-safearray->list var)
Arguments
var
Return Values
A list.
Examples
Create a single-dimension array of doubles:
#<safearray...>
100
100
_$ (vlax-safearray-put-element point 2 0)
_$ (vlax-safearray->list matrix)
See Also
-------------------------------------------------------------------------------
vlax-tmatrix
(vlax-tmatrix list)
Arguments
list
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 221/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Define a transformation matrix and assign its value to variable tmatrix:
((1.0 1.0 1.0 0.0) (1.0 2.0 3.0 0.0) (2.0 3.0 4.0 5.0) (2.0 9.0 8.0
3.0))
The following code example creates a line and rotates it 90 degrees using a
transformation matrix:
;; Create a line
(vla-zoomall acadObject)
(princ)
-------------------------------------------------------------------------------
vlax-typeinfo-available-p
(vlax-typeinfo-available-p obj)
https://www.theswamp.org/Sources/doc/avlisp/#trans 222/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
obj
A VLA-object.
Return Values
T, if TypeLib information is available, otherwise nil.
See Also
-------------------------------------------------------------------------------
vlax-variant-change-type
Returns the value of a variant after changing it from one data type to another
Arguments
var
type
The type of variant to return, using the value of var (the value of var is
unchanged). The type value can be represented by one of the following
constants:
The integer shown in parentheses indicates the value to which the constant
evaluates. It is recommended that you specify the constant in your argument,
not the integer value, in case the value changes in later releases of AutoCAD.
Return Values
The value of var, after converting it to the specified variant type, or nil, if
var could not be converted to the specified type.
Examples
Set a variable named varint to a variant value:
#<variant 3 5>
Set a variable named varintstr to the value contained in varint, but convert
that value to a string:
#<variant 8 5>
https://www.theswamp.org/Sources/doc/avlisp/#trans 223/300
5/8/23, 12:24 PM Auto/Visual lisp help
_$ (vlax-variant-value varintStr)
"5"
See Also
-------------------------------------------------------------------------------
vlax-variant-type
(vlax-variant-type var)
Arguments
var
Return Values
If var contains a variant, one of the following integers is returned:
Uninitialized (vlax-vbEmpty)
Integer (vlax-vbInteger)
String (vlax-vbString)
Object (vlax-vbObject)
11
Boolean (vlax-vbBoolean)
8192 + n
Examples
Set a variant to nil and display the variant's data type:
https://www.theswamp.org/Sources/doc/avlisp/#trans 224/300
5/8/23, 12:24 PM Auto/Visual lisp help
#<variant 0 >
_$ (vlax-variant-type varnil)
#<variant 2 5>
_$ (vlax-variant-type varint)
Set a variant to an integer value and display the variant's data type:
#<variant 3 5>
_$ (vlax-variant-type varint)
#<variant 8 ghost>
_$ (vlax-variant-type varstr)
#<safearray...>
_$ (vlax-variant-type var4dubs)
8197
A variant type value greater than 8192 indicates that the variant contains some
type of safearray. Subtract 8192 from the return value to determine the data
type of the safearray. In this example, 8197-8192=5 (vlax-vbDouble).
6.0
_$ (vlax-variant-type notvar)
See Also
The vlax-variant-change-type ,
and vlax-variant-value functions.
-------------------------------------------------------------------------------
vlax-variant-value
https://www.theswamp.org/Sources/doc/avlisp/#trans 225/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vlax-variant-value var)
Arguments
var
Return Values
The value of the variable. If the variable does not contain a variant, an error
occurs.
Examples
_$ (vlax-variant-value varstr)
"ghost"
_$ (vlax-variant-value varint)
_$ (vlax-variant-value notvar)
The last example results in an error, because notvar does not contain a
variant.
See Also
-------------------------------------------------------------------------------
vlax-vla-object->ename
(vlax-vla-object->ename obj)
Arguments
obj
A VLA-object.
Return Values
An AutoLISP entity name (ename data type).
Examples
_$ (vlax-vla-object->ename vlaobj)
See Also
-------------------------------------------------------------------------------
vlax-write-enabled-p
(vlax-write-enabled-p obj)
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 226/300
5/8/23, 12:24 PM Auto/Visual lisp help
obj
Return Values
T, if the AutoCAD drawing object can be modified, nil if the object cannot be
modified.
-------------------------------------------------------------------------------
vlisp-compile
Note: The Visual LISP IDE must be open in order for vlisp-compile to work.
Arguments
mode
filename
A string identifying the AutoLISP source file. If the source file is in the
AutoCAD Support File Search Path, you can omit the path when specifying the
file name. If you omit the file extension, .lsp is assumed.
out-filename
A string identifying the compiled output file. If you do not specify an output
file, vlisp-compile names the output with the same name as the input file, but
replaces the extension with .fas.
Note that if you specify an output file name but do not specify a path name for
either the input or the output file, vlisp-compile places the output file in
the AutoCAD install directory.
Return Values
T, if compilation is successful, nil otherwise.
Examples
The output file is named yinyang.fas and resides in the same directory as the
source file.
The following command compiles yinyang.lsp and names the output file
GoodKarma.fas:
Note that the output file from the previous command resides in the AutoCAD
install directory, not the directory where yinyang.lsp resides. The following
command compiles yinyang.lsp and directs the output file to the c:\my documents
directory:
This last example identifies the full path of the file to be compiled:
https://www.theswamp.org/Sources/doc/avlisp/#trans 227/300
5/8/23, 12:24 PM Auto/Visual lisp help
The output file from this command is named yinyang.fas and resides in the same
directory as the input file.
See Also
The Compiling a Program from a File topic in the Visual LISP Developer's Guide.
-------------------------------------------------------------------------------
vlr-acdb-reactor
Constructs a reactor object that notifies when an object is added to, modified
in, or erased from a drawing database
Arguments
data
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Database Reactor Events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
obj The database object (AutoLISP entity) associated with the event
+----------------------------+-------------------------------------------------+
| Database reactor events |
+----------------------------+-------------------------------------------------+
| Name | Event |
+----------------------------+-------------------------------------------------+
| :vlr-objectAppended | An object has been appended to the drawing |
| | database. |
+----------------------------+-------------------------------------------------+
| :vlr-objectUnAppended | An object has been detached from the drawing |
| | database, e.g., by using UNDO. |
+----------------------------+-------------------------------------------------+
| :vlr-objectReAppended | A detached object has been restored in the |
| | drawing database, e.g., by using REDO. |
+----------------------------+-------------------------------------------------+
| :vlr-objectOpenedForModify | An object is about to be changed. |
+----------------------------+-------------------------------------------------+
| :vlr-objectModified | An object has been changed. |
+----------------------------+-------------------------------------------------+
| :vlr-objectErased | An object has been flagged as being erased. |
+----------------------------+-------------------------------------------------+
| :vlr-objectUnErased | An object's erased-flag has been removed. |
+----------------------------+-------------------------------------------------+
-------------------------------------------------------------------------------
vlr-add
(vlr-add obj)
Arguments
obj
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 228/300
5/8/23, 12:24 PM Auto/Visual lisp help
The obj argument.
See Also
-------------------------------------------------------------------------------
vlr-added-p
(vlr-added-p obj)
Arguments
obj
Return Values
T if the specified reactor is enabled, or nil if the reactor is disabled.
See Also
-------------------------------------------------------------------------------
vlr-beep-reaction
(vlr-beep-reaction [args])
Arguments
-------------------------------------------------------------------------------
vlr-command-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data
is to be associated with the reactor.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Command Reactor Events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
list A list containing a single element, the string identifying the command.
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 229/300
5/8/23, 12:24 PM Auto/Visual lisp help
+------------------------+--------------------------------------------+
| Command reactor events |
+------------------------+--------------------------------------------+
| Event name | Description |
+------------------------+--------------------------------------------+
| :vlr-unknownCommand | A command not known to AutoCAD was issued. |
+------------------------+--------------------------------------------+
| :vlr-commandWillStart | An AutoCAD command has been called. |
+------------------------+--------------------------------------------+
| :vlr-commandEnded | An AutoCAD command has completed. |
+------------------------+--------------------------------------------+
| :vlr-commandCancelled | An AutoCAD command has been canceled. |
+------------------------+--------------------------------------------+
| :vlr-commandFailed | An AutoCAD command failed to complete. |
+------------------------+--------------------------------------------+
-------------------------------------------------------------------------------
vlr-current-reaction-name
Returns the name (symbol) of the current event, if called from within a
reactor's callback
(vlr-current-reaction-name)
Return Values
A symbol indicating the event that triggered the reactor.
-------------------------------------------------------------------------------
vlr-data
(vlr-data obj)
Arguments
obj
A VLR object representing the reactor object from which to extract data.
Return Values
The application-specific data obtained from the reactor object.
Examples
The following example obtains a string associated with the circleReactor VLR
object:
_$ (vlr-data circleReactor)
"Circle Reactor"
-------------------------------------------------------------------------------
vlr-data-set
Note: The vlr-data-set function should be used with care to avoid creation of
circular structures.
Arguments
obj
https://www.theswamp.org/Sources/doc/avlisp/#trans 230/300
5/8/23, 12:24 PM Auto/Visual lisp help
data
Return Values
The data argument.
Examples
Return the application-specific data value attached to a reactor:
_$ (vlr-data circleReactor)
"Circle Reactor"
_$ (vlr-data circleReactor)
-------------------------------------------------------------------------------
vlr-deepclone-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the DeepClone reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table DeepClone
reactor callback data.
Return Values
The reactor_object argument.
+----------------------------+-------------------------------------------------+
| DeepClone reactor events |
+----------------------------+-------------------------------------------------+
| Event name | Description |
+----------------------------+-------------------------------------------------+
| :vlr-beginDeepClone | A deep clone operation is beginning. |
+----------------------------+-------------------------------------------------+
| :vlr-beginDeepCloneXlation | A deep clone operation has two stages. First, |
| | each object and any owned objects are cloned. |
| | Second, any object ID references are |
| | translated to their cloned IDs. This callback |
| | occurs between these two stages. |
+----------------------------+-------------------------------------------------+
| :vlr-abortDeepClone | A deep clone operation is aborting. |
+----------------------------+-------------------------------------------------+
https://www.theswamp.org/Sources/doc/avlisp/#trans 231/300
5/8/23, 12:24 PM Auto/Visual lisp help
| :vlr-endDeepClone | A deep clone operation is ending. |
+----------------------------+-------------------------------------------------+
+---------------------------------+-------------+------------------------------+
| DeepClone reactor callback data |
+---------------------------------+-------------+------------------------------+
| Name | List length | Parameters |
+---------------------------------+-------------+------------------------------+
| :vlr-beginDeepClone | 0 | |
| :vlr-abortDeepClone | | |
| :vlr-endDeepClone | | |
+---------------------------------+-------------+------------------------------+
| :vlr-beginDeepCloneXlation | 1 | An integer containing the |
| | | return error status; if |
| | | this value indicates an |
| | | error, the deep clone |
| | | operation is terminated. |
+---------------------------------+-------------+------------------------------+
-------------------------------------------------------------------------------
vlr-docmanager-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the DocManager reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table DocManager
reactor callback data.
Return Values
The reactor_object argument.
+-----------------------------------+------------------------------------------+
| DocManager reactor events |
+-----------------------------------+------------------------------------------+
| Event name | Description |
+-----------------------------------+------------------------------------------+
| :vlr-documentCreated | A new document was created for a |
| | drawing (new or open).Useful for |
| | updating your per-document structures. |
+-----------------------------------+------------------------------------------+
| :vlr-documentToBeDestroyed | A document will be destroyed. |
+-----------------------------------+------------------------------------------+
| :vlr-documentLockModeWillChange | A command is about to start or finish |
| | modifying elements in the document, and |
| | is obtaining or releasing a lock on the |
| | document. |
+-----------------------------------+------------------------------------------+
| :vlr-documentLockModeChangeVetoed | A reactor invoked veto on itself from a |
| | :vlr-documentLockModeChanged callback. |
+-----------------------------------+------------------------------------------+
| :vlr-documentLockModeChanged | The lock on the document has been |
| | obtained or released. |
+-----------------------------------+------------------------------------------+
| :vlr-documentBecameCurrent | The current document has been changed. |
| | This does not necessarily imply that |
| | the document has been activated, |
| | because changing the current document |
| | is necessary for some operations. To |
| | obtain user input, the document must be |
| | activated as well. |
https://www.theswamp.org/Sources/doc/avlisp/#trans 232/300
5/8/23, 12:24 PM Auto/Visual lisp help
+-----------------------------------+------------------------------------------+
| :vlr-documentToBeActivated | A currently inactive document has just |
| | received the activate signal, implying |
| | that it is about to become the current |
| | document. |
+-----------------------------------+------------------------------------------+
| :vlr-documentToBeDeactivated | Another window (inside or outside of |
| | AutoCAD) has been activated. |
+-----------------------------------+------------------------------------------+
+-----------------------------------+-----------+------------------------------+
| DocManager reactor callback data |
+-----------------------------------+-----------+------------------------------+
| Name | List | Parameters |
| | length | |
+-----------------------------------+-----------+------------------------------+
| :vlr-documentCreated | 1 | The affected document |
| :vlr-documentToBeDestroyed | | object (VLA-object). |
| :vlr-documentBecameCurrent | | |
| :vlr-documentToBeActivated | | |
| :vlr-documentToBeDeactivated | | |
+-----------------------------------+-----------+------------------------------+
| :vlr-documentLockModeChangeVetoed | 2 | First parameter is the |
| | | affected document object |
| | | (VLA-object).Second |
| | | parameter is the global |
| | | command string passed in |
| | | for the lock request. If |
| | | the callback is being made |
| | | on behalf of an unlock |
| | | request, the string will be |
| | | prefixed with "#". |
+-----------------------------------+-----------+------------------------------+
| :vlr-documentLockModeWillChange | 5 | First parameter is the |
| :vlr-documentLockModeChanged | | affected document object |
| | | (VLA-object).Second |
| | | parameter is an integer |
| | | indicating the lock |
| | | currently in effect for the |
| | | document object.Third |
| | | parameter is an integer |
| | | indicating the lock mode |
| | | that will be in effect |
| | | after the lock is |
| | | applied.Fourth parameter is |
| | | the strongest lock mode |
| | | from all other execution |
| | | contexts.Fifth parameter is |
| | | the global command string |
| | | passed in for the lock |
| | | request. If the callback is |
| | | being made on behalf of an |
| | | unlock request, the string |
| | | will be prefixed with |
| | | "#".Lock modes may be any |
| | | of the following:1--Auto |
| | | Write Lock2--Not |
| | | Locked4--Shared |
| | | Write8--Read10--Exclusive |
| | | Write |
+-----------------------------------+-----------+------------------------------+
-------------------------------------------------------------------------------
vlr-dwg-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
https://www.theswamp.org/Sources/doc/avlisp/#trans 233/300
5/8/23, 12:24 PM Auto/Visual lisp help
where event-name is one of the symbols listed in the DWG reactor events table
below, and callback_function is a symbol representing a function to be called
when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table DWG reactor
callback data.
Return Values
The reactor_object argument.
+----------------------------+-------------------------------------------------+
| DWG reactor events |
+----------------------------+-------------------------------------------------+
| Event name | Description |
+----------------------------+-------------------------------------------------+
| :vlr-beginClose | The drawing database is to be closed. |
+----------------------------+-------------------------------------------------+
| :vlr-databaseConstructed | A drawing database has been constructed. |
+----------------------------+-------------------------------------------------+
| :vlr-databaseToBeDestroyed | The contents of the drawing database is about |
| | to be deleted from memory. |
+----------------------------+-------------------------------------------------+
| vlr-beginDwgOpen | AutoCAD is about to open a drawing file. |
+----------------------------+-------------------------------------------------+
| :vlr-endDwgOpen | AutoCAD has ended the open operation. |
+----------------------------+-------------------------------------------------+
| :vlr-dwgFileOpened | A new drawing has been loaded into the AutoCAD |
| | drawing window. |
+----------------------------+-------------------------------------------------+
| vlr-beginSave | AutoCAD is about to save the drawing file. |
+----------------------------+-------------------------------------------------+
| vlr-saveComplete | AutoCAD has saved the current drawing to disk. |
+----------------------------+-------------------------------------------------+
+----------------------------+-------------+-----------------------------------+
| DWG reactor callback data |
+----------------------------+-------------+-----------------------------------+
| Name | List length | Parameters |
+----------------------------+-------------+-----------------------------------+
| :vlr-beginClose | 0 | |
| :vlr-databaseConstructed | | |
| :vlr-databaseToBeDestroyed | | |
+----------------------------+-------------+-----------------------------------+
| :vlr-beginDwgOpen | 1 | A string identifying the file to |
| :vlr-endDwgOpen | | open. |
| :vlr-dwgFileOpened | | |
+----------------------------+-------------+-----------------------------------+
| :vlr-beginSave | 1 | A string containing the default |
| | | file name for save; may be |
| | | changed by the user |
+----------------------------+-------------+-----------------------------------+
| :vlr-saveComplete | 1 | A string containing the actual |
| | | file name used for the save. |
+----------------------------+-------------+-----------------------------------+
-------------------------------------------------------------------------------
vlr-dxf-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the DXF reactor events table
below, and callback_function is a symbol representing a function to be called
when the event fires. Each callback function accepts two arguments:
https://www.theswamp.org/Sources/doc/avlisp/#trans 234/300
5/8/23, 12:24 PM Auto/Visual lisp help
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table DXF reactor
callback data.
Return Values
The reactor_object argument.
+---------------------+--------------------------------------------------------+
| DXF reactor events |
+---------------------+--------------------------------------------------------+
| Event name | Description |
+---------------------+--------------------------------------------------------+
| :vlr-beginDxfIn | The contents of a DXF file is to be appended to the |
| | drawing database. |
+---------------------+--------------------------------------------------------+
| :vlr-abortDxfIn | The DXF import was not successful. |
+---------------------+--------------------------------------------------------+
| :vlr-dxfInComplete | The DXF import was successful. |
+---------------------+--------------------------------------------------------+
| :vlr-beginDxfOut | AutoCAD is about to export the drawing database into |
| | a DXF file. |
+---------------------+--------------------------------------------------------+
| :vlr-abortDxfOut | The DXF export operation failed. |
+---------------------+--------------------------------------------------------+
| :vlr-dxfOutComplete | The DXF export operation was successful. |
+---------------------+--------------------------------------------------------+
+---------------------------+-------------+------------+
| DXF reactor callback data |
+---------------------------+-------------+------------+
| Name | List length | Parameters |
+---------------------------+-------------+------------+
| :vlr-beginDxfIn | 0 | |
| :vlr-abortDxfIn | | |
| :vlr-dxfInComplete, | | |
| :vlr-beginDxfOut | | |
| :vlr-abortDxfOut | | |
| :vlr-dxfOutComplete | | |
+---------------------------+-------------+------------+
-------------------------------------------------------------------------------
vlr-editor-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Editor reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Editor
reactor callback data.
Return Values
The reactor_object argument.
+----------------------------+-------------------------------------------------+
| Editor reactor events |
+----------------------------+-------------------------------------------------+
| Event name | Description |
https://www.theswamp.org/Sources/doc/avlisp/#trans 235/300
5/8/23, 12:24 PM Auto/Visual lisp help
+----------------------------+-------------------------------------------------+
| :vlr-beginClose | The drawing database is to be closed. |
+----------------------------+-------------------------------------------------+
| :vlr-beginDxfIn | The contents of a DXF file is to be appended |
| | to the drawing database. |
+----------------------------+-------------------------------------------------+
| :vlr-abortDxfIn | The DXF import was not successful. |
+----------------------------+-------------------------------------------------+
| :vlr-dxfInComplete | The DXF import completed successfully. |
+----------------------------+-------------------------------------------------+
| :vlr-beginDxfOut | AutoCAD is about to export the drawing |
| | database into a DXF file. |
+----------------------------+-------------------------------------------------+
| :vlr-abortDxfOut | DXF export operation failed. |
+----------------------------+-------------------------------------------------+
| :vlr-dxfOutComplete | DXF export operation completed successfully. |
+----------------------------+-------------------------------------------------+
| :vlr-databaseToBeDestroyed | The contents of the drawing database is about |
| | to be deleted from memory. |
+----------------------------+-------------------------------------------------+
| :vlr-unknownCommand | A command not known to AutoCAD was issued. |
+----------------------------+-------------------------------------------------+
| :vlr-commandWillStart | An AutoCAD command has been called. |
+----------------------------+-------------------------------------------------+
| vlr-commandEnded | An AutoCAD command has completed. |
+----------------------------+-------------------------------------------------+
| :vlr-commandCancelled | An AutoCAD command has been canceled. |
+----------------------------+-------------------------------------------------+
| :vlr-commandFailed | An AutoCAD command failed to complete. |
+----------------------------+-------------------------------------------------+
| :vlr-lispWillStart | An AutoLISP expression is to be evaluated. |
+----------------------------+-------------------------------------------------+
| :vlr-lispEnded | Evaluation of an AutoLISP expression has |
| | completed. |
+----------------------------+-------------------------------------------------+
| :vlr-lispCancelled | Evaluation of an AutoLISP expression has been |
| | canceled. |
+----------------------------+-------------------------------------------------+
| :vlr-beginDwgOpen | AutoCAD is about to open a drawing file. |
+----------------------------+-------------------------------------------------+
| :vlr-endDwgOpen | AutoCAD has ended the open operation. |
+----------------------------+-------------------------------------------------+
| :vlr-dwgFileOpened | A new drawing has been loaded into the AutoCAD |
| | drawing window. |
+----------------------------+-------------------------------------------------+
| :vlr-beginSave | AutoCAD is about to save the drawing file. |
+----------------------------+-------------------------------------------------+
| :vlr-saveComplete | AutoCAD has saved the current drawing to disk. |
+----------------------------+-------------------------------------------------+
| :vlr-sysVarWillChange | AutoCAD is about to change the value of a |
| | system variable. |
+----------------------------+-------------------------------------------------+
| :vlr-sysVarChanged | The value of a system variable has changed. |
+----------------------------+-------------------------------------------------+
+------------------------------+-------------+---------------------------------+
| Editor reactor callback data |
+------------------------------+-------------+---------------------------------+
| Name | List length | Parameters |
+------------------------------+-------------+---------------------------------+
| :vlr-lispEnded | 0 | |
| :vlr-lispCancelled | | |
| :vlr-beginClose | | |
| :vlr-beginDxfIn | | |
| :vlr-abortDxfIn | | |
| :vlr-dxfInComplete | | |
| :vlr-beginDxfOut | | |
| :vlr-abortDxfOut | | |
| :vlr-dxfOutComplete | | |
| :vlr-databaseToBeDestroyed | | |
+------------------------------+-------------+---------------------------------+
| :vlr-unknownCommand | 1 | A string containing the |
| :vlr-commandWillStart | | command name. |
| :vlr-commandEnded | | |
| :vlr-commandCancelled | | |
| :vlr-commandFailed | | |
+------------------------------+-------------+---------------------------------+
| :vlr-lispWillStart | 1 | A string containing the first |
| | | line of the AutoLISP |
| | | expression to evaluate. |
+------------------------------+-------------+---------------------------------+
| :vlr-beginDwgOpen | 1 | A string identifying the file |
| :vlr-endDwgOpen | | to open. |
| :vlr-dwgFileOpened | | |
+------------------------------+-------------+---------------------------------+
| :vlr-beginSave | 1 | A string containing the |
https://www.theswamp.org/Sources/doc/avlisp/#trans 236/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | | default file name for save; |
| | | this may be changed by the |
| | | user. |
+------------------------------+-------------+---------------------------------+
| :vlr-saveComplete | 1 | A string identifying the |
| | | actual file name used for the |
| | | save. |
+------------------------------+-------------+---------------------------------+
| :vlr-sysVarWillChange | 1 | A string naming the system |
| | | variable. |
+------------------------------+-------------+---------------------------------+
| :vlr-sysVarChanged | 2 | First parameter is a string |
| | | naming the system |
| | | variable.Second parameter is |
| | | an integer indicating whether |
| | | the change was successful (1 = |
| | | success, 0 = failed). |
+------------------------------+-------------+---------------------------------+
-------------------------------------------------------------------------------
vlr-insert-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Insert reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Insert
reactor callback data.
Return Values
The reactor_object argument.
+-----------------------+------------------------------------------------------+
| Insert reactor events |
+-----------------------+------------------------------------------------------+
| Event name | Description |
+-----------------------+------------------------------------------------------+
| :vlr-beginInsert | A block is about to be inserted into the drawing |
| | database. |
+-----------------------+------------------------------------------------------+
| :vlr-beginInsertM | A 3D transformation matrix is about to be inserted |
| | into the drawing database. |
+-----------------------+------------------------------------------------------+
| :vlr-otherInsert | A block or matrix has been added to the drawing |
| | database. This notification is sent after the |
| | insert process completes copying the object into |
| | the database, but before ID translation or entity |
| | transformation occurs. |
+-----------------------+------------------------------------------------------+
| :vlr-endInsert | Usually indicates an insert operation on the |
| | drawing database is complete. However, in some |
| | cases, the transform has not yet happened, or the |
| | block that was created has not yet been appended. |
| | This means the objects copied are not yet |
| | graphical, and you cannot use them in selection |
| | sets until the :vlr-commandEnded notification is |
| | received. |
+-----------------------+------------------------------------------------------+
| :vlr-abortInsert | Insert operation was terminated and did not |
| | complete, leaving the database in an unstable state. |
https://www.theswamp.org/Sources/doc/avlisp/#trans 237/300
5/8/23, 12:24 PM Auto/Visual lisp help
+-----------------------+------------------------------------------------------+
+------------------------------+-------------+---------------------------------+
| Insert reactor callback data |
+------------------------------+-------------+---------------------------------+
| Name | List length | Parameters |
+------------------------------+-------------+---------------------------------+
| :vlr-beginInsert | 3 | First parameter is a |
| | | VLA-object pointing to the |
| | | database in which the block is |
| | | being inserted.Second |
| | | parameter is a string naming |
| | | the block to be inserted.Third |
| | | parameter is a VLA-object |
| | | identifying the source |
| | | database of the block. |
+------------------------------+-------------+---------------------------------+
| :vlr-beginInsertM | 3 | First parameter is a |
| | | VLA-object pointing to the |
| | | database in which the 3D |
| | | transformation matrix is being |
| | | inserted.Second parameter is |
| | | the 3D transformation matrix |
| | | to be inserted.Third parameter |
| | | is a VLA-object identifying |
| | | the source database of the |
| | | matrix. |
+------------------------------+-------------+---------------------------------+
| :vlr-otherInsert | 2 | First parameter is a |
| | | VLA-object pointing to the |
| | | database in which the block or |
| | | matrix is being |
| | | inserted.Second parameter is a |
| | | VLA-object identifying the |
| | | source database of the block |
| | | or matrix. |
+------------------------------+-------------+---------------------------------+
| :vlr-endInsert | 1 | VLA-object pointing to target |
| :vlr-abortInsert | | database. |
+------------------------------+-------------+---------------------------------+
-------------------------------------------------------------------------------
vlr-linker-reactor
Arguments
data
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the table Linker reactor
events, and callback_function is a symbol representing a function to be called
when the event fires. Each callback function accepts two arguments:
list A list containing the name of the ObjectARX program that was loaded or
unloaded (a string).
Return Values
The reactor_object argument.
+-----------------------+------------------------------------------------------+
| Linker reactor events |
+-----------------------+------------------------------------------------------+
| Name | Event |
+-----------------------+------------------------------------------------------+
| :vlr-rxAppLoaded | The dynamic linker has loaded a new ObjectARX |
| | program. The program has finished its |
| | initialization. |
https://www.theswamp.org/Sources/doc/avlisp/#trans 238/300
5/8/23, 12:24 PM Auto/Visual lisp help
+-----------------------+------------------------------------------------------+
| :vlr-rxAppUnLoaded | The dynamic linker has unloaded an ObjectARX |
| | program. The program already has done its clean-up. |
+-----------------------+------------------------------------------------------+
Examples
_$ (vlr-linker-reactor nil
'((:vlr-rxAppLoaded . my-vlr-trace-reaction)))
#<VLR-Linker-Reactor>
-------------------------------------------------------------------------------
vlr-lisp-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Lisp reactor events table
below, and callback_function is a symbol representing a function to be called
when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Lisp reactor
callback data.
Return Values
The reactor_object argument.
+---------------------+--------------------------------------------------------+
| Lisp reactor events |
+---------------------+--------------------------------------------------------+
| Event name | Description |
+---------------------+--------------------------------------------------------+
| :vlr-lispWillStart | An AutoLISP expression is to be evaluated. |
+---------------------+--------------------------------------------------------+
| :vlr-lispEnded | Evaluation of an AutoLISP expression has completed. |
+---------------------+--------------------------------------------------------+
| :vlr-lispCancelled | Evaluation of an AutoLISP expression has been |
| | canceled. |
+---------------------+--------------------------------------------------------+
+----------------------------+-------------+-----------------------------------+
| Lisp reactor callback data |
+----------------------------+-------------+-----------------------------------+
| Name | List length | Parameters |
+----------------------------+-------------+-----------------------------------+
| :vlr-lispEnded | 0 | |
| :vlr-lispCancelled | | |
+----------------------------+-------------+-----------------------------------+
| :vlr-lispWillStart | 1 | A string containing the first |
| | | line of the AutoLISP expression |
| | | to evaluate. |
+----------------------------+-------------+-----------------------------------+
-------------------------------------------------------------------------------
vlr-miscellaneous-reactor
https://www.theswamp.org/Sources/doc/avlisp/#trans 239/300
5/8/23, 12:24 PM Auto/Visual lisp help
Constructs an editor reactor object that does not fall under any other editor
reactor types
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Miscellaneous
reactor callback data.
Return Values
The reactor_object argument.
+------------------------------+-----------------------------------------------+
| Miscellaneous reactor events |
+------------------------------+-----------------------------------------------+
| Event name | Description |
+------------------------------+-----------------------------------------------+
| :vlr-pickfirstModified | The pickfirst selection set of the current |
| | document has been modified. |
+------------------------------+-----------------------------------------------+
| :vlr-layoutSwitched | The layout was switched. |
+------------------------------+-----------------------------------------------+
+-------------------------------------+-------------+--------------------------+
| Miscellaneous reactor callback data |
+-------------------------------------+-------------+--------------------------+
| Name | List length | Parameters |
+-------------------------------------+-------------+--------------------------+
| :vlr-pickfirstModified | 0 | |
+-------------------------------------+-------------+--------------------------+
| :vlr-layoutSwitched | 1 | A string naming the |
| | | layout switched to. |
+-------------------------------------+-------------+--------------------------+
-------------------------------------------------------------------------------
vlr-mouse-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Mouse reactor events table
below, and callback_function is a symbol representing a function to be called
when the event fires. Each callback function accepts two arguments:
https://www.theswamp.org/Sources/doc/avlisp/#trans 240/300
5/8/23, 12:24 PM Auto/Visual lisp help
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Mouse reactor
callback data.
Return Values
+-----------------------+------------------------------+
| Mouse reactor events |
+-----------------------+------------------------------+
| Event name | Description |
+-----------------------+------------------------------+
| :vlr-beginDoubleClick | The user has double-clicked. |
+-----------------------+------------------------------+
| :vlr-beginRightClick | The user has right-clicked. |
+-----------------------+------------------------------+
+-----------------------------+-------------+----------------------------------+
| Mouse reactor callback data |
+-----------------------------+-------------+----------------------------------+
| Name | List length | Parameters |
+-----------------------------+-------------+----------------------------------+
| :vlr-beginDoubleClick | 1 | A 3D point list (list of 3 |
| :vlr-beginRightClick | | reals) showing the point |
| | | clicked on, in WCS. |
+-----------------------------+-------------+----------------------------------+
-------------------------------------------------------------------------------
vlr-notification
(vlr-notification reactor)
Arguments
reactor
A VLR object.
Return Values
A symbol, which can be either 'all-documents (the reactor fires whether or not
its associated document is active), or 'active-document-only (the reactor fires
only if its associated document is active).
-------------------------------------------------------------------------------
vlr-object-reactor
The reactor object is added to the drawing database, but does not become
persistent.
Arguments
owners
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the table Object events, and
https://www.theswamp.org/Sources/doc/avlisp/#trans 241/300
5/8/23, 12:24 PM Auto/Visual lisp help
callback_function is a symbol representing a function to be called when the
event fires. Each callback function accepts three arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Object events
callback data.
Return Values
+----------------------+-------------------------------------------------------+
| Object events |
+----------------------+-------------------------------------------------------+
| Name | Event |
+----------------------+-------------------------------------------------------+
| :vlr-cancelled | The modification of the object has been canceled. |
+----------------------+-------------------------------------------------------+
| :vlr-copied | The object has been copied. |
+----------------------+-------------------------------------------------------+
| :vlr-erased | Erase-flag of the object has been set. |
+----------------------+-------------------------------------------------------+
| :vlr-unerased | Erase-flag of the object has been reset. |
+----------------------+-------------------------------------------------------+
| :vlr-goodbye | The object is about to be deleted from memory. |
+----------------------+-------------------------------------------------------+
| :vlr-openedForModify | The object is about to be modified. |
+----------------------+-------------------------------------------------------+
| :vlr-modified | The object has been modified. If the modification |
| | was canceled, also :vlr-cancelled and |
| | :vlr-modifyUndone will be fired. |
+----------------------+-------------------------------------------------------+
| :vlr-subObjModified | A sub-entity of the object has been modified. This |
| | event is triggered for modifications to vertices of |
| | polylines or meshes, and for attributes owned by |
| | blockReferences. |
+----------------------+-------------------------------------------------------+
| :vlr-modifyUndone | The object's modification was undone. |
+----------------------+-------------------------------------------------------+
| :vlr-modifiedXData | The object's extended entity data have been modified. |
+----------------------+-------------------------------------------------------+
| :vlr-unappended | The object has been detached from the drawing |
| | database. |
+----------------------+-------------------------------------------------------+
| :vlr-reappended | The object has been re-attached to the drawing |
| | database. |
+----------------------+-------------------------------------------------------+
| :vlr-objectClosed | The object's modification has been finished. |
+----------------------+-------------------------------------------------------+
+-----------------------------+-------------+----------------------------------+
| Object events callback data |
+-----------------------------+-------------+----------------------------------+
| Name | List length | Parameters |
+-----------------------------+-------------+----------------------------------+
| :vlr-cancelled | 0 | |
| :vlr-erased, | | |
| :vlr-unerased | | |
| :vlr-goodbye | | |
| :vlr-openedForModify | | |
| :vlr-modified | | |
| :vlr-modifyUndone | | |
| :vlr-modifiedXData | | |
| :vlr-unappended | | |
| :vlr-reappended | | |
| :vlr-objectClosed | | |
+-----------------------------+-------------+----------------------------------+
| :vlr-copied | 1 | The object created by the copy |
| | | operation (ename). |
+-----------------------------+-------------+----------------------------------+
| :vlr-subObjModified | 1 | The sub-object (ename) that has |
| | | been modified. |
+-----------------------------+-------------+----------------------------------+
Examples
The following code attaches an object reactor to the myCircle object. It
defines the reactor to respond whenever the object is modified (:vlr-modified)
and to call the print-radius function in response to the modification event:
https://www.theswamp.org/Sources/doc/avlisp/#trans 242/300
5/8/23, 12:24 PM Auto/Visual lisp help
"Circle Reactor" '((:vlr-modified . print-radius))))
-------------------------------------------------------------------------------
vlr-owner-add
This function adds a new source of reactor events; the reactor will receive
events from the specified object.
Arguments
reactor
A VLR object.
owner
Return Values
The VLA-object to which the reactor has been added.
Examples
In the following example, an arc object named "archie" is added to the owner
list of reactor circleReactor:
See Also
-------------------------------------------------------------------------------
vlr-owner-remove
Arguments
reactor
A VLR object.
owner
Return Values
The VLA-object from which the reactor was removed.
Examples
_$ (vlr-owner-remove circleReactor archie)
See Also
-------------------------------------------------------------------------------
vlr-owners
https://www.theswamp.org/Sources/doc/avlisp/#trans 243/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vlr-owners reactor)
Arguments
reactor
A VLR object.
Return Values
A list of objects that notify the specified reactor.
Examples
_$ (vlr-owners circleReactor)
-------------------------------------------------------------------------------
vlr-pers
(vlr-pers reactor)
Arguments
reactor
A VLR object.
Return Values
The specified reactor object, if successful, nil otherwise.
Examples
Define a reactor:
#<VLR-Object-Reactor>
_$ (vlr-pers circleReactor)
#<VLR-Object-Reactor>
-------------------------------------------------------------------------------
vlr-pers-list
(vlr-pers-list [reactor])
Arguments
reactor
Return Values
A list of reactor objects.
https://www.theswamp.org/Sources/doc/avlisp/#trans 244/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
_$ (vlr-pers-list)
(#<VLR-Object-Reactor> #<VLR-Object-Reactor>
(#<VLR-Object-Reactor>)
-------------------------------------------------------------------------------
vlr-pers-p
(vlr-pers-p reactor)
Arguments
reactor
A VLR object.
Return Values
The specified reactor object, if it is persistent; nil, if the reactor is
transient.
Examples
Make a reactor persistent:
_$ (vlr-pers circleReactor)
#<VLR-Object-Reactor>
_$ (vlr-pers-p circleReactor)
#<VLR-Object-Reactor>
_$ (vlr-pers-release circleReactor)
#<VLR-Object-Reactor>
_$ (vlr-pers-p circleReactor)
nil
-------------------------------------------------------------------------------
vlr-pers-release
(vlr-pers-release reactor)
Arguments
reactor
VLR object.
Return Values
The specified reactor object, if successful, nil otherwise.
-------------------------------------------------------------------------------
vlr-reaction-name
https://www.theswamp.org/Sources/doc/avlisp/#trans 245/300
5/8/23, 12:24 PM Auto/Visual lisp help
Returns a list of all possible callback conditions for this reactor type
(vlr-reaction-names reactor-type)
Arguments
reactor-type
:VLR-AcDb-Reactor
:VLR-Command-Reactor
:VLR-DeepClone-Reactor
:VLR-DocManager-Reactor
:VLR-DWG-Reactor
:VLR-DXF-Reactor
:VLR-Editor-Reactor
:VLR-Insert-Reactor
:VLR-Linker-Reactor
:VLR-Lisp-Reactor
:VLR-Miscellaneous-Reactor
:VLR-Mouse-Reactor
:VLR-Object-Reactor
:VLR-SysVar-Reactor
:VLR-Toolbar-Reactor
:VLR-Undo-Reactor
:VLR-Wblock-Reactor
:VLR-Window-Reactor
:VLR-XREF-Reactor
Return Values
A list of symbols indicating the possible events for the specified reactor
type.
Examples
_$ (vlr-reaction-names :VLR-Editor-Reactor)
-------------------------------------------------------------------------------
vlr-reaction-set
Arguments
reactor
A VLR object.
event
A symbol denoting one of the event types available for this reactor type.
function
Return Values
Unspecified.
Examples
The following command changes the circleReactor reactor to call the print-area
function when an object is modified:
PRINT-AREA
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 246/300
5/8/23, 12:24 PM Auto/Visual lisp help
vlr-reactions
(vlr-reactions reactor)
Arguments
reactor
A VLR object.
Examples
_$ (vlr-reactions circleReactor)
((:vlr-modified . PRINT-RADIUS))
-------------------------------------------------------------------------------
vlr-reactors
(vlr-reactors [reactor-type...])
Arguments
reactor-type
:VLR-AcDb-Reactor
:VLR-Command-Reactor
:VLR-DeepClone-Reactor
:VLR-DocManager-Reactor
:VLR-DWG-Reactor
:VLR-DXF-Reactor
:VLR-Editor-Reactor
:VLR-Insert-Reactor
:VLR-Linker-Reactor
:VLR-Lisp-Reactor
:VLR-Miscellaneous-Reactor
:VLR-Mouse-Reactor
:VLR-Object-Reactor
:VLR-SysVar-Reactor
:VLR-Toolbar-Reactor
:VLR-Undo-Reactor
:VLR-Wblock-Reactor
:VLR-Window-Reactor
:VLR-XREF-Reactor
Return Values
A list of reactor lists, or nil, if there are no reactors of any specified
type. Each reactor list begins with a symbol identifying the reactor type,
followed by pointers to each reactor of that type.
Examples
List all reactors in a drawing:
_$ (vlr-reactors)
_$ (vlr-reactors :vlr-object-reactor)
((:VLR-Object-Reactor #<VLR-Object-Reactor>))
https://www.theswamp.org/Sources/doc/avlisp/#trans 247/300
5/8/23, 12:24 PM Auto/Visual lisp help
vlr-reactors returns a list containing a single reactor list.
_$ (vlr-reactors :vlr-acdb-reactor)
nil
_$ (vlr-reactors :vlr-dwg-reactor)
-------------------------------------------------------------------------------
vlr-remove
Disables a reactor
(vlr-remove reactor)
Arguments
reactor
A VLR object.
Return Values
The reactor argument, or nil, if unsuccessful.
Examples
The following command disables the circleReactor reactor:
_$ (vlr-remove circleReactor)
#<VLR-Object-reactor>
See Also
-------------------------------------------------------------------------------
vlr-remove-all
(vlr-remove-all [reactor-type])
Arguments
reactor-type
:VLR-AcDb-Reactor
:VLR-Command-Reactor
:VLR-DeepClone-Reactor
:VLR-DocManager-Reactor
:VLR-DWG-Reactor
:VLR-DXF-Reactor
:VLR-Editor-Reactor
:VLR-Insert-Reactor
:VLR-Linker-Reactor
:VLR-Lisp-Reactor
:VLR-Miscellaneous-Reactor
:VLR-Mouse-Reactor
:VLR-Object-Reactor
:VLR-SysVar-Reactor
https://www.theswamp.org/Sources/doc/avlisp/#trans 248/300
5/8/23, 12:24 PM Auto/Visual lisp help
:VLR-Toolbar-Reactor
:VLR-Undo-Reactor
:VLR-Wblock-Reactor
:VLR-Window-Reactor
:VLR-XREF-Reactor
Return Values
A list of lists. The first element of each list identifies the type of reactor,
and the remaining elements identify the disabled reactor objects. The function
returns nil if there are no reactors active.
Examples
The following function call disables all editor reactors:
_$ (vlr-remove-all :vlr-editor-reactor)
((:VLR-Editor-Reactor #<VLR-Editor-Reactor>))
_$ (vlr-remove-all)
See Also
-------------------------------------------------------------------------------
vlr-set-notification
Arguments
reactor
A VLR object.
'range
The range argument is a symbol that can be either 'all-documents (execute the
callback whether or not the reactor is associated with the active document), or
'active-document-only (execute the callback only if the reactor is associated
with the active document).
Return Values
Examples
Set a reactor to execute its callback function even if its associated namespace
is not active:
#<VLR-Object-Reactor>
-------------------------------------------------------------------------------
vlr-sysvar-reactor
https://www.theswamp.org/Sources/doc/avlisp/#trans 249/300
5/8/23, 12:24 PM Auto/Visual lisp help
(vlr-sysvar-reactor data callbacks)
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the SysVar reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table SysVar
reactor callback data.
Return Values
The reactor_object argument.
+-----------------------+------------------------------------------------------+
| SysVar reactor events |
+-----------------------+------------------------------------------------------+
| Event name | Description |
+-----------------------+------------------------------------------------------+
| :vlr-sysVarWillChange | AutoCAD is about to change the value of a system |
| | variable. |
+-----------------------+------------------------------------------------------+
| :vlr-sysVarChanged | The value of a system variable has changed. |
+-----------------------+------------------------------------------------------+
+------------------------------+-------------+---------------------------------+
| SysVar reactor callback data |
+------------------------------+-------------+---------------------------------+
| Name | List length | Parameters |
+------------------------------+-------------+---------------------------------+
| :vlr-sysVarWillChange | 1 | A string identifying the |
| | | system variable name. |
+------------------------------+-------------+---------------------------------+
| :vlr-sysVarChanged | 2 | First parameter is a string |
| | | identifying the system |
| | | variable name.Second parameter |
| | | is symbol indicating whether |
| | | or not the change was |
| | | successful (T if successful, |
| | | nil if not). |
+------------------------------+-------------+---------------------------------+
-------------------------------------------------------------------------------
vlr-toolbar-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Toolbar reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
https://www.theswamp.org/Sources/doc/avlisp/#trans 250/300
5/8/23, 12:24 PM Auto/Visual lisp help
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Toolbar
reactor callback data.
Return Values
The reactor_object argument.
+----------------------------------+-------------------------------------------+
| Toolbar reactor events |
+----------------------------------+-------------------------------------------+
| Event name | Description |
+----------------------------------+-------------------------------------------+
| :vlr-toolbarBitmapSizeWillChange | The size of the AutoCAD toolbar icons is |
| | about to change. |
+----------------------------------+-------------------------------------------+
| :vlr-toolbarBitmapSizeChanged | The size of the AutoCAD toolbar icons |
| | has changed. |
+----------------------------------+-------------------------------------------+
+----------------------------------+-------------+-----------------------------+
| Toolbar reactor callback data |
+----------------------------------+-------------+-----------------------------+
| Name | List length | Parameters |
+----------------------------------+-------------+-----------------------------+
| :vlr-toolbarBitmapSizeWillChange | 1 | T, if the toolbar is being |
| :vlr-toolbarBitmapSizeChanged | | set to large bitmaps, nil |
| | | if the toolbar is being |
| | | set to small bitmaps. |
+----------------------------------+-------------+-----------------------------+
-------------------------------------------------------------------------------
vlr-trace-reaction
(vlr-trace-reaction)
This function can be used as a debugging tool to verify that a reactor has
fired.
Examples
Define a command reactor and assign vlr-trace-reaction as the callback
function:
VLR-trace-reaction
_.LINE
Respond to the command prompts, then activate the VLISP window and open the
Trace window. You should see the following in the Trace window:
The output from vlr-trace-reaction identifies the type of trigger event, the
reactor type, and the command that triggered the reactor.
-------------------------------------------------------------------------------
vlr-type
(vlr-type reactor)
Arguments
reactor
https://www.theswamp.org/Sources/doc/avlisp/#trans 251/300
5/8/23, 12:24 PM Auto/Visual lisp help
A VLR object.
Return Values
A symbol identifying the reactor type. The following table lists the types that
may be returned by vlr-type:
+----------------------------+-------------------------------------------------+
| Reactor types |
+----------------------------+-------------------------------------------------+
| Reactor type | Description |
+----------------------------+-------------------------------------------------+
| :VLR-AcDb-Reactor | Database reactor. |
+----------------------------+-------------------------------------------------+
| :VLR-Command-Reactor | An editor reactor notifying of a command event. |
+----------------------------+-------------------------------------------------+
| :VLR-DeepClone-Reactor | An editor reactor notifying of a deep clone |
| | event. |
+----------------------------+-------------------------------------------------+
| :VLR-DocManager-Reactor | Document management reactor. |
+----------------------------+-------------------------------------------------+
| :VLR-DWG-Reactor | An editor reactor notifying of a drawing event |
| | (for example, opening or closing a drawing |
| | file). |
+----------------------------+-------------------------------------------------+
| :VLR-DXF-Reactor | An editor reactor notifying of an event |
| | related to reading or writing of a DXF file. |
+----------------------------+-------------------------------------------------+
| :VLR-Editor-Reactor | General editor reactor; maintained for |
| | backward-compatibility. |
+----------------------------+-------------------------------------------------+
| :VLR-Insert-Reactor | An editor reactor notifying of an event |
| | related to block insertion. |
+----------------------------+-------------------------------------------------+
| :VLR-Linker-Reactor | Linker reactor. |
+----------------------------+-------------------------------------------------+
| :VLR-Lisp-Reactor | An editor reactor notifying of a LISP event. |
+----------------------------+-------------------------------------------------+
| :VLR-Miscellaneous-Reactor | An editor reactor that does not fall under any |
| | of the other editor reactor types. |
+----------------------------+-------------------------------------------------+
| :VLR-Mouse-Reactor | An editor reactor notifying of a mouse event |
| | (for example, a double-click). |
+----------------------------+-------------------------------------------------+
| :VLR-Object-Reactor | Object reactor. |
+----------------------------+-------------------------------------------------+
| :VLR-SysVar-Reactor | An editor reactor notifying of a change to a |
| | system variable. |
+----------------------------+-------------------------------------------------+
| :VLR-Toolbar-Reactor | An editor reactor notifying of a change to the |
| | bitmaps in a toolbar. |
+----------------------------+-------------------------------------------------+
| :VLR-Undo-Reactor | An editor reactor notifying of an undo event. |
+----------------------------+-------------------------------------------------+
| :VLR-Wblock-Reactor | An editor reactor notifying of an event |
| | related to writing a block. |
+----------------------------+-------------------------------------------------+
| :VLR-Window-Reactor | An editor reactor notifying of an event |
| | related to moving or sizing an AutoCAD window. |
+----------------------------+-------------------------------------------------+
| :VLR-XREF-Reactor | An editor reactor notifying of an event |
| | related to attaching or modifying XREFs. |
+----------------------------+-------------------------------------------------+
Examples
_$ (vlr-type circleReactor)
:VLR-Object-Reactor
-------------------------------------------------------------------------------
vlr-types
(vlr-types)
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 252/300
5/8/23, 12:24 PM Auto/Visual lisp help
(:VLR-Linker-Reactor :VLR-Editor-Reactor :VLR-AcDb-Reactor ....)
-------------------------------------------------------------------------------
vlr-undo-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Undo reactor events table
below, and callback_function is a symbol representing a function to be called
when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Undo reactor
callback data.
Return Values
The reactor_object argument.
+----------------------------+-------------------------------------------------+
| Undo reactor events |
+----------------------------+-------------------------------------------------+
| Event name | Description |
+----------------------------+-------------------------------------------------+
| :vlr-undoSubcommandAuto | The UNDO command's Auto option has been |
| | executed. |
+----------------------------+-------------------------------------------------+
| :vlr-undoSubcommandControl | The UNDO command's Control option has been |
| | executed. |
+----------------------------+-------------------------------------------------+
| :vlr-undoSubcommandBegin | The UNDO command's BEGIN or GROUP option is |
| | being performed. BEGIN and GROUP mark the |
| | beginning of a series of commands that can be |
| | undone as one unit. |
+----------------------------+-------------------------------------------------+
| :vlr-undoSubcommandEnd | The UNDO command's END option is being |
| | performed. UNDO/END marks the end of a series |
| | of commands that can be undone as one unit. |
+----------------------------+-------------------------------------------------+
| :vlr-undoSubcommandMark | The UNDO command's MARK option is about to be |
| | executed. This places a marker in the undo |
| | file so UNDO/BACK can undo back to the marker. |
+----------------------------+-------------------------------------------------+
| :vlr-undoSubcommandBack | The UNDO command's BACK option is about to be |
| | performed. UNDO/BACK undoes everything back to |
| | the most recent MARK marker or back to the |
| | beginning of the undo file if no MARK marker |
| | exists. |
+----------------------------+-------------------------------------------------+
| :vlr-undoSubcommandNumber | The UNDO command's NUMBER option is about to |
| | be executed (the default action of the UNDO |
| | command). |
+----------------------------+-------------------------------------------------+
+----------------------------+-------------+-----------------------------------+
| Undo reactor callback data |
+----------------------------+-------------+-----------------------------------+
| Name | List length | Parameters |
+----------------------------+-------------+-----------------------------------+
| :vlr-undoSubcommandAuto | 2 | First parameter is an integer |
| | | indicating the activity. The |
| | | value is always 4, indicating |
| | | that notification occurred after |
| | | the operation was |
| | | performed.Second parameter is a |
https://www.theswamp.org/Sources/doc/avlisp/#trans 253/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | | symbol indicating the state of |
| | | Auto mode. Value is T if Auto |
| | | mode is turned on, nil if Auto |
| | | mode is turned off. |
+----------------------------+-------------+-----------------------------------+
| :vlr-undoSubcommandControl | 2 | First parameter is an integer |
| | | indicating the activity. The |
| | | value is always 4, indicating |
| | | that notification occurred after |
| | | the operation was |
| | | performed.Second parameter is an |
| | | integer indicating the Control |
| | | option selected. This can be one |
| | | of the following:0--NONE was |
| | | selected1--ONE was |
| | | selected2--ALL was selected |
+----------------------------+-------------+-----------------------------------+
| :vlr-undoSubcommandBegin | 1 | An integer value of 0, |
| :vlr-undoSubcommandEnd | | indicating that notification |
| :vlr-undoSubcommandMark | | occurs before the actual |
| :vlr-undoSubcommandBack | | operation is performed. |
+----------------------------+-------------+-----------------------------------+
| :vlr-undoSubcommandNumber | 2 | First parameter is an integer |
| | | indicating the activity. The |
| | | value is always 0, indicating |
| | | that notification occurs before |
| | | the actual operation is |
| | | performed.Second parameter is an |
| | | integer indicating the number of |
| | | steps being undone. |
+----------------------------+-------------+-----------------------------------+
-------------------------------------------------------------------------------
vlr-wblock-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Wblock reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Wblock
reactor callback data.
Return Values
The reactor_object argument.
+-------------------------+----------------------------------------------------+
| Wblock reactor events |
+-------------------------+----------------------------------------------------+
| Event name | Description |
+-------------------------+----------------------------------------------------+
| :VLR-wblockNotice | A wblock operation is about to start. |
+-------------------------+----------------------------------------------------+
| :VLR-beginWblockPt | A wblock operation is being performed on a set of |
| | entities. |
+-------------------------+----------------------------------------------------+
| :VLR-beginWblockId | A wblock operation is being performed on a |
| | specified block. |
+-------------------------+----------------------------------------------------+
| :VLR-beginWblock | A wblock operation is being performed on an |
| | entire database. Notification does not occur |
https://www.theswamp.org/Sources/doc/avlisp/#trans 254/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | until all the entities in the source database's |
| | model space are copied into the target database. |
+-------------------------+----------------------------------------------------+
| :VLR-endWblock | A wblock operation completed successfully. |
+-------------------------+----------------------------------------------------+
| :VLR-beginWblockObjects | wblock has just initialized the object ID |
| | translation map. |
+-------------------------+----------------------------------------------------+
+------------------------------+-------------+---------------------------------+
| Wblock reactor callback data |
+------------------------------+-------------+---------------------------------+
| Name | List length | Parameters |
+------------------------------+-------------+---------------------------------+
| :VLR-wblockNotice | 1 | Database object (VLA-object) |
| | | from which the block will be |
| | | created. |
+------------------------------+-------------+---------------------------------+
| :VLR-beginWblockPt | 3 | First parameter is the target |
| | | database object |
| | | (VLA-object).Second parameter |
| | | is the source database object |
| | | (VLA-object) containing the |
| | | objects being wblocked.Third |
| | | parameters is a 3D point list |
| | | (in WCS) to be used as the |
| | | base point in the target |
| | | database. |
+------------------------------+-------------+---------------------------------+
| :VLR-beginWblockId | 3 | First parameter is the target |
| | | database object |
| | | (VLA-object).Second parameter |
| | | is the source database object |
| | | (VLA-object) containing the |
| | | objects being wblocked.Third |
| | | parameter is the object ID of |
| | | the BlockTableRecord being |
| | | wblocked. |
+------------------------------+-------------+---------------------------------+
| :VLR-beginWblock | 2 | First parameter is the target |
| :VLR-otherWblock | | database object |
| | | (VLA-object).Second parameter |
| | | is the source database object |
| | | (VLA-object) containing the |
| | | objects being wblocked. |
+------------------------------+-------------+---------------------------------+
| :VLR-abortWblock | 1 | The target database object |
| :VLR-endWblock | | (VLA-object). |
+------------------------------+-------------+---------------------------------+
| :VLR-beginWblockObjects | 2 | First parameter is the source |
| | | database object (VLA-object) |
| | | containing the objects being |
| | | wblocked.Second parameter is |
| | | an ID map. |
+------------------------------+-------------+---------------------------------+
-------------------------------------------------------------------------------
vlr-window-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the Window reactor events
table below, and callback_function is a symbol representing a function to be
called when the event fires. Each callback function accepts two arguments:
https://www.theswamp.org/Sources/doc/avlisp/#trans 255/300
5/8/23, 12:24 PM Auto/Visual lisp help
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table Window
reactor callback data.
Return Values
The reactor_object argument.
+------------------------------+-----------------------------------------------+
| Window reactor events |
+------------------------------+-----------------------------------------------+
| Event name | Description |
+------------------------------+-----------------------------------------------+
| :vlr-docFrameMovedOrResized | An MDI child frame window (a document |
| | window) has been moved or resized. |
+------------------------------+-----------------------------------------------+
| :vlr-mainFrameMovedOrResized | The main AutoCAD window has been moved or |
| | resized. |
+------------------------------+-----------------------------------------------+
+------------------------------+-------------+---------------------------------+
| Window reactor callback data |
+------------------------------+-------------+---------------------------------+
| Name | List length | Parameters |
+------------------------------+-------------+---------------------------------+
| :vlr-docFrameMovedOrResized | 2 | The first parameter is an |
| :vlr-mainFrameMovedOrResized | | integer containing the HWND of |
| | | the window.The second |
| | | parameter indicates whether |
| | | the window has been moved or |
| | | resized. The value is T if the |
| | | window has been moved, nil if |
| | | the window has been resized. |
+------------------------------+-------------+---------------------------------+
-------------------------------------------------------------------------------
vlr-xref-reactor
Arguments
data
Any AutoLISP data to be associated with the reactor object, or nil, if no data.
callbacks
(event-name . callback_function)
where event-name is one of the symbols listed in the XREF reactor events table
below, and callback_function is a symbol representing a function to be called
when the event fires. Each callback function accepts two arguments:
list A list of extra data elements associated with the particular event. The
contents of this list for particular events is shown in the table XREF reactor
callback data.
Return Values
The reactor_object argument.
+--------------------------------+---------------------------------------------+
| XREF reactor events |
+--------------------------------+---------------------------------------------+
| Event name | Description |
+--------------------------------+---------------------------------------------+
| :VLR-beginAttach | An XREF is about to be attached. |
+--------------------------------+---------------------------------------------+
| :VLR-otherAttach | An external reference is being added to |
| | the drawing database. This event occurs |
| | after objects are cloned, but before any |
| | translation. This callback function is |
| | sent just after beginDeepCloneXlation |
https://www.theswamp.org/Sources/doc/avlisp/#trans 256/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | notification, but only occurs for the XREF |
| | attach process. |
+--------------------------------+---------------------------------------------+
| :VLR-abortAttach | An XREF attach operation was terminated |
| | before successful completion. |
+--------------------------------+---------------------------------------------+
| :VLR-endAttach | An XREF attach operation completed |
| | successfully. |
+--------------------------------+---------------------------------------------+
| :VLR-redirected | An object ID in the XREF drawing is being |
| | modified to point to the associated object |
| | in the drawing being XREFed into. |
+--------------------------------+---------------------------------------------+
| :VLR-comandeered | The object ID of the object is being |
| | appended to the symbol table of the |
| | drawing being XREFed into. |
+--------------------------------+---------------------------------------------+
| :VLR-beginRestore | An existing XREF is about to be resolved |
| | (typically when a drawing with XREFs is |
| | loading). |
+--------------------------------+---------------------------------------------+
| :VLR-abortRestore | An XREF unload or reload was terminated |
| | before successful completion. |
+--------------------------------+---------------------------------------------+
| :VLR-endRestore | An existing XREF has been resolved |
| | (typically when a drawing with XREFs has |
| | completed loading). |
+--------------------------------+---------------------------------------------+
| :VLR-xrefSubcommandBindItem | The BIND subcommand of XREF was invoked, |
| | or a pre-existing xref is being bound. |
| | Note that the BIND subcommand is |
| | interactive and triggers multiple events. |
+--------------------------------+---------------------------------------------+
| :VLR-xrefSubcommandAttachItem | The ATTACH subcommand of XREF was invoked, |
| | or a pre-existing xref is being |
| | resolved.Note that the ATTACH subcommand |
| | is interactive and triggers multiple |
| | events. |
+--------------------------------+---------------------------------------------+
| :VLR-xrefSubcommandOverlayItem | The OVERLAY subcommand of XREF was |
| | invoked, or a pre-existing xref is being |
| | resolved.Note that the OVERLAY subcommand |
| | is interactive and triggers multiple |
| | events. |
+--------------------------------+---------------------------------------------+
| :VLR-xrefSubcommandDetachItem | The DETACH subcommand of XREF was |
| | invoked.Note that the OVERLAY subcommand |
| | is interactive and triggers multiple |
| | events. |
+--------------------------------+---------------------------------------------+
| :VLR-xrefSubcommandPathItem | The PATH subcommand of XREF was |
| | invoked.Note that the PATH subcommand is |
| | interactive and triggers multiple events. |
+--------------------------------+---------------------------------------------+
| :VLR-xrefSubcommandReloadItem | The RELOAD subcommand of XREF was invoked, |
| | or a pre-existing xref is being |
| | reloaded.Note that the RELOAD subcommand |
| | is interactive and triggers multiple |
| | events. |
+--------------------------------+---------------------------------------------+
| :VLR-xrefSubcommandUnloadItem | The UNLOAD subcommand of XREF was invoked, |
| | or a pre-existing xref is being unloaded. |
+--------------------------------+---------------------------------------------+
+--------------------------------+-------------+-------------------------------+
| XREF reactor callback data |
+--------------------------------+-------------+-------------------------------+
| Name | List length | Parameters |
+--------------------------------+-------------+-------------------------------+
| :VLR-beginAttach | 3 | First parameter is a |
| | | VLA-object pointing to the |
| | | target drawing |
| | | database.Second parameter is |
| | | a string containing the file |
| | | name of the xref being |
| | | attached.Third parameter is |
| | | a VLA-object pointing to the |
| | | drawing database that |
| | | contains the objects being |
| | | attached. |
+--------------------------------+-------------+-------------------------------+
| :VLR-otherAttach | 2 | First parameter is a |
| | | VLA-object pointing to the |
| | | target drawing |
| | | database.Second parameter is |
https://www.theswamp.org/Sources/doc/avlisp/#trans 257/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | | a VLA-object pointing to the |
| | | drawing database that |
| | | contains the objects being |
| | | attached. |
+--------------------------------+-------------+-------------------------------+
| :VLR-abortAttach | 1 | A VLA-object pointing to the |
| | | drawing database that |
| | | contains the objects being |
| | | attached. |
+--------------------------------+-------------+-------------------------------+
| :VLR-endAttach | 1 | A VLA-object pointing to the |
| | | target drawing database. |
+--------------------------------+-------------+-------------------------------+
| :VLR-redirected | 2 | First parameter is an |
| | | integer containing the |
| | | object ID for the redirected |
| | | symbol table record (STR) in |
| | | the drawing being XREFed |
| | | to.Second parameter is an |
| | | integer containing the |
| | | object ID for the object in |
| | | the xref drawing. |
+--------------------------------+-------------+-------------------------------+
| :VLR-comandeered | 3 | First parameter is a |
| | | VLA-object pointing to the |
| | | database receiving the |
| | | XREF.Second parameter is an |
| | | integer containing the |
| | | object ID of the object |
| | | being commandeered.Third |
| | | parameter is a VLA-object |
| | | pointing to the drawing |
| | | database that contains the |
| | | objects being attached. |
+--------------------------------+-------------+-------------------------------+
| :VLR-beginRestore | 3 | First parameter is a |
| | | VLA-object pointing to the |
| | | database receiving the |
| | | XREF.Second parameter is a |
| | | string containing the XREF |
| | | block table record (BTR) |
| | | name.Third parameter is a |
| | | VLA-object pointing to the |
| | | drawing database that |
| | | contains the objects being |
| | | attached. |
+--------------------------------+-------------+-------------------------------+
| :VLR-abortRestore | 1 | A VLA-object pointing to the |
| :VLR-endRestore | | target drawing database. |
+--------------------------------+-------------+-------------------------------+
| :VLR-xrefSubcommandBindItem | 2 | First parameter is an |
| | | integer indicating the |
| | | activity the BIND is |
| | | carrying out. Possible |
| | | values are:0--BIND |
| | | subcommand invoked.2--xref |
| | | with the indicated object ID |
| | | is being bound.3--xref with |
| | | the indicated object ID was |
| | | successfully bound.4--BIND |
| | | subcommand completed.5--BIND |
| | | operation is about to either |
| | | terminate or fail to |
| | | complete on the specified |
| | | object ID.6--BIND operation |
| | | has either terminated or |
| | | failed to complete on the |
| | | specified object ID.7--Sent |
| | | for an XDep block bound by |
| | | XBind.8--Sent for all other |
| | | symbols: Layers, Linetypes, |
| | | TextStyles, and |
| | | DimStyles.Second parameter |
| | | is an integer containing the |
| | | object ID of the xref being |
| | | bound, or 0 if not |
| | | applicable. |
+--------------------------------+-------------+-------------------------------+
| :VLR-xrefSubcommandAttachItem | 2 | First parameter is an |
| | | integer indicating the |
| | | activity the ATTACH is |
| | | carrying out. Possible |
| | | values are:0--BIND |
| | | subcommand invoked.2--xref |
| | | with the indicated object ID |
https://www.theswamp.org/Sources/doc/avlisp/#trans 258/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | | is being bound.3--xref with |
| | | the indicated object ID was |
| | | successfully bound.4--BIND |
| | | subcommand completed.5--BIND |
| | | operation is about to either |
| | | terminate or fail to |
| | | complete on the specified |
| | | object ID.6--BIND operation |
| | | has either terminated or |
| | | failed to complete on the |
| | | specified object ID.Second |
| | | parameter is a string |
| | | identifying the file being |
| | | attached, or nil if not |
| | | applicable. |
+--------------------------------+-------------+-------------------------------+
| :VLR-xrefSubcommandOverlayItem | 2 | First parameter is an |
| | | integer indicating the |
| | | activity the OVERLAY is |
| | | carrying out. Possible |
| | | values are:0--BIND |
| | | subcommand invoked.2--xref |
| | | with the indicated object ID |
| | | is being bound.3--xref with |
| | | the indicated object ID was |
| | | successfully bound.4--BIND |
| | | subcommand completed.5--BIND |
| | | operation is about to either |
| | | terminate or fail to |
| | | complete on the specified |
| | | object ID.6--BIND operation |
| | | has either terminated or |
| | | failed to complete on the |
| | | specified object ID.Second |
| | | parameter is a string |
| | | identifying the file being |
| | | overlaid, or nil if not |
| | | applicable. |
+--------------------------------+-------------+-------------------------------+
| :VLR-xrefSubcommandDetachItem | 2 | First parameter is an |
| | | integer indicating the |
| | | activity the DETACH is |
| | | carrying out. Possible |
| | | values are:0--BIND |
| | | subcommand invoked.2--xref |
| | | with the indicated object ID |
| | | is being bound.3--xref with |
| | | the indicated object ID was |
| | | successfully bound.4--BIND |
| | | subcommand completed.5--BIND |
| | | operation is about to either |
| | | terminate or fail to |
| | | complete on the specified |
| | | object ID.6--BIND operation |
| | | has either terminated or |
| | | failed to complete on the |
| | | specified object ID.Second |
| | | parameter is an integer |
| | | containing the object ID of |
| | | the xref being detached, or |
| | | 0 if not applicable. |
+--------------------------------+-------------+-------------------------------+
| :VLR-xrefSubcommandPathItem | 3 | First parameter is an |
| | | integer indicating the |
| | | activity the DETACH is |
| | | carrying out. Possible |
| | | values are:0--BIND |
| | | subcommand invoked.2--xref |
| | | with the indicated object ID |
| | | is being bound.3--xref with |
| | | the indicated object ID was |
| | | successfully bound.4--BIND |
| | | subcommand completed.5--BIND |
| | | operation is about to either |
| | | terminate or fail to |
| | | complete on the specified |
| | | object ID.6--BIND operation |
| | | has either terminated or |
| | | failed to complete on the |
| | | specified object ID.Second |
| | | parameter is an integer |
| | | containing the object ID of |
| | | the xref being operated on, |
| | | or 0 if not applicable.Third |
| | | parameter is a string |
https://www.theswamp.org/Sources/doc/avlisp/#trans 259/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | | identifying the new path |
| | | name of the xref, or nil if |
| | | not applicable. |
+--------------------------------+-------------+-------------------------------+
| :VLR-xrefSubcommandReloadItem | 2 | First parameter is an |
| | | integer indicating the |
| | | activity the RELOAD is |
| | | carrying out. Possible |
| | | values are:0--BIND |
| | | subcommand invoked.2--xref |
| | | with the indicated object ID |
| | | is being bound.3--xref with |
| | | the indicated object ID was |
| | | successfully bound.4--BIND |
| | | subcommand completed.5--BIND |
| | | operation is about to either |
| | | terminate or fail to |
| | | complete on the specified |
| | | object ID.6--BIND operation |
| | | has either terminated or |
| | | failed to complete on the |
| | | specified object ID.Second |
| | | parameter is an integer |
| | | containing the object ID of |
| | | the xref being reloaded, or |
| | | 0 if not applicable. |
+--------------------------------+-------------+-------------------------------+
| :VLR-xrefSubcommandUnloadItem | 2 | First parameter is an |
| | | integer indicating the |
| | | activity the UNLOAD is |
| | | carrying out. Possible |
| | | values are:0--BIND |
| | | subcommand invoked.2--xref |
| | | with the indicated object ID |
| | | is being bound.3--xref with |
| | | the indicated object ID was |
| | | successfully bound.4--BIND |
| | | subcommand completed.5--BIND |
| | | operation is about to either |
| | | terminate or fail to |
| | | complete on the specified |
| | | object ID.6--BIND operation |
| | | has either terminated or |
| | | failed to complete on the |
| | | specified object ID.Second |
| | | parameter is an integer |
| | | containing the object ID of |
| | | the xref being unloaded, or |
| | | 0 if not applicable. |
+--------------------------------+-------------+-------------------------------+
-------------------------------------------------------------------------------
vports
(vports)
Return Values
One or more viewport descriptor lists consisting of the viewport identification
number and the coordinates of the viewport's lower-left and upper-right
corners.
If the AutoCAD TILEMODE system variable is set to 1 (on), the returned list
describes the viewport configuration created with the AutoCAD VPORTS command.
The corners of the viewports are expressed in values between 0.0 and 1.0, with
(0.0, 0.0) representing the lower-left corner of the display screen's graphics
area, and (1.0, 1.0) the upper-right corner. If TILEMODE is 0 (off), the
returned list describes the viewport objects created with the MVIEW command.
The viewport object corners are expressed in paper space coordinates. Viewport
number 1 is always paper space when TILEMODE is off.
Examples
Given a single-viewport configuration with TILEMODE on, the vports function
might return the following:
Given four equal-sized viewports located in the four corners of the screen when
https://www.theswamp.org/Sources/doc/avlisp/#trans 260/300
5/8/23, 12:24 PM Auto/Visual lisp help
TILEMODE is on, the vports function might return the following lists:
The current viewport's descriptor is always first in the list. In the previous
example, viewport number 5 is the current viewport.
wcmatch
Arguments
string
pattern
A string containing the pattern to match against string. The pattern can
contain the wild-card pattern-matching characters shown in the table Wild-card
characters. You can use commas in a pattern to enter more than one pattern
condition. Only the first 500 characters (approximately) of the string and
pattern are compared; anything beyond that is ignored.
Return Values
If string and pattern match, wcmatch returns T, otherwise, wcmatch returns nil.
+----------------------+-------------------------------------------------------+
| Wild-card characters |
+----------------------+-------------------------------------------------------+
| Character | Definition |
+----------------------+-------------------------------------------------------+
| # (pound) | Matches any single numeric digit |
+----------------------+-------------------------------------------------------+
| @ (at) | Matches any single alphabetic character |
+----------------------+-------------------------------------------------------+
| . (period) | Matches any single nonalphanumeric character |
+----------------------+-------------------------------------------------------+
| * (asterisk) | Matches any character sequence, including an empty |
| | one, and it can be used anywhere in the search |
| | pattern: at the beginning, middle, or end |
+----------------------+-------------------------------------------------------+
| ? (question mark) | Matches any single character |
+----------------------+-------------------------------------------------------+
| ~ (tilde) | If it is the first character in the pattern, it |
| | matches anything except the pattern |
+----------------------+-------------------------------------------------------+
| [...] | Matches any one of the characters enclosed |
+----------------------+-------------------------------------------------------+
| [~...] | Matches any single character not enclosed |
+----------------------+-------------------------------------------------------+
| - (hyphen) | Used inside brackets to specify a range for a single |
| | character |
+----------------------+-------------------------------------------------------+
| , (comma) | Separates two patterns |
+----------------------+-------------------------------------------------------+
| ` (reverse quote) | Escapes special characters (reads next character |
| | literally) |
+----------------------+-------------------------------------------------------+
Examples
The following command tests a string to see if it begins with the character N:
https://www.theswamp.org/Sources/doc/avlisp/#trans 261/300
5/8/23, 12:24 PM Auto/Visual lisp help
The following example performs three comparisons. If any of the three pattern
conditions is met, wcmatch returns T. In this case the tests are: does the
string contain three characters; does the string not contain an m; and does the
string begin with the letter "N." If any of the three pattern conditions is
met, wcmatch returns T:
To test for a wild-card character in a string, you can use the single
reverse-quote character (`) to escape the character. Escape means that the
character following the single reverse quote is not read as a wild-card
character; it is compared at its face value. For example, to search for a comma
anywhere in the string "Name", enter the following:
nil
Both the C and AutoLISP programming languages use the backslash (\) as an
escape character, so you need two backslashes (\\) to produce one backslash in
a string. To test for a backslash character anywhere in "Name", use the
following function call:
nil
The closing bracket character (]) is also read literally if it is the first
bracketed character or if it follows a leading tilde (as in "[ ]ABC]" or
"[~]ABC]").
-------------------------------------------------------------------------------
while
Arguments
testexpr
expr
Return Values
https://www.theswamp.org/Sources/doc/avlisp/#trans 262/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
The following code calls user function some-func ten times, with test set to 1
through 10. It then returns 11, which is the value of the last expression
evaluated:
(setq test 1)
(some-func test)
-------------------------------------------------------------------------------
write-char
Arguments
num
file-desc
Return Values
The num argument.
Examples
The following command writes the letter C to the command window, and returns
the supplied num argument:
C67
Assuming that f is the descriptor for an open file, the following command
writes the letter C to that file:
Command: (write-char 67 f)
67
Note that write-char cannot write a NULL character (ASCII code 0) to a file.
See Also
-------------------------------------------------------------------------------
write-line
Arguments
string
A string.
https://www.theswamp.org/Sources/doc/avlisp/#trans 263/300
5/8/23, 12:24 PM Auto/Visual lisp help
file-desc
Return Values
The string, quoted in the normal manner. The quotes are omitted when writing to
a file.
Examples
Open a new file:
The line is not physically written until you close the file:
Command: (close f)
nil
xdroom
Returns the amount of extended data (xdata) space that is available for an
object (entity)
(xdroom ename)
Arguments
ename
Return Values
An integer reflecting the number of bytes of available space. If unsuccessful,
xdroom returns nil.
Examples
The following example looks up the available space for extended data of a
viewport object:
16162
In this example, 16,162 bytes of the original 16,383 bytes of extended data
space are available, meaning that 221 bytes are used.
-------------------------------------------------------------------------------
xdsize
Returns the size (in bytes) that a list occupies when it is linked to an object
(entity) as extended data
https://www.theswamp.org/Sources/doc/avlisp/#trans 264/300
5/8/23, 12:24 PM Auto/Visual lisp help
(xdsize lst)
Arguments
lst
Return Values
An integer reflecting the size, in bytes. If unsuccessful, xdsize returns nil.
Brace fields (group code 1002) must be balanced. An invalid lst generates an
error and places the appropriate error code in the ERRNO variable. If the
extended data contains an unregistered application name, you see this error
message (assuming that CMDECHO is on):
Examples
The lst can start with a -3 group code (the extended data sentinel), but it is
not required. Because extended data can contain information from multiple
applications, the list must have a set of enclosing parentheses.
(1002 . "{")
(1040 . 0.0)
(1040 . 1.0)
(1002 . "}")
Here is the same example without the -3 group code. This list is just the cdr
of the first example, but it is important that the enclosing parentheses are
included:
(1002 . "{")
(1040 . 0.0)
(1040 . 1.0)
(1002 . "}")
zerop
(zerop number)
Arguments
number
A number.
Return Values
T if number evaluates to zero, otherwise nil.
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 265/300
5/8/23, 12:24 PM Auto/Visual lisp help
Command: (zerop 0)
nil
For additional information on the commands described in this appendix, see the
Command Reference.
-------------------------------------------------------------------------------
3dsin
Arguments
mode
multimat
create
An integer that specifies how to organize new objects. This mode always imports
all the objects in the .3ds file. Required if mode is set to 0. Allowable
values are:
file
A string specifying the 3DS file to import; the .3ds file extension is
required.
Examples
Open the 3D Studio file globe.3ds for import and prompt the user for import
specifics:
(c:3dsin 1 "globe.3ds")
Import all of shadow.3ds with no user input, splitting objects with multiple
materials and putting all new objects on the same layer:
Initializing Render...
Initializing preferences...done.
-------------------------------------------------------------------------------
3dsout
Arguments
sset
omode
div
An integer that specifies how to divide AutoCAD objects into 3D Studio objects.
Allowable values are:
smooth
weld
A real number that specifies the distance threshold for welding nearby
vertices. If weld is set to a value less than 0, welding is disabled; if weld
is set to a value greater than or equal to 0, AutoCAD welds vertices closer
than this value.
file
A string specifying the name of the 3D Studio file to create; the .3ds file
https://www.theswamp.org/Sources/doc/avlisp/#trans 267/300
5/8/23, 12:24 PM Auto/Visual lisp help
extension is required.
Examples
Export all of a drawing, creating 3D Studio objects based on drawing layer,
using a smoothing threshold of 30 degrees and a welding distance of 0.1:
-------------------------------------------------------------------------------
align
Translates and rotates objects, allowing them to be aligned with other objects
(Externally-defined: geom3d ARX application)
Arguments
arg1 arg2...
Arguments to the AutoCAD align command. The order, number, and type of
arguments for the align function are the same as if you were entering ALIGN at
the command line.
Return Values
T if successful, otherwise nil.
Examples
The following example specifies two pairs of source and destination points,
which perform a 2D move:
(setq ss (ssget))
-------------------------------------------------------------------------------
cal
Invokes the on-line geometry calculator and returns the value of the evaluated
expression (Externally-defined: geomcal ARX application)
(c:cal expression)
Arguments
expression
Return Values
The result of the expression.
Examples
The following example uses cal in an AutoLISP expression with the trans
function:
-------------------------------------------------------------------------------
fog
https://www.theswamp.org/Sources/doc/avlisp/#trans 268/300
5/8/23, 12:24 PM Auto/Visual lisp help
Arguments
enabled
A string that turns fog on and off without affecting other settings. Default is
ON.
color
near_dist
far_dist
near_percent
A real number defining the percentage of fog at the start of the bank. Default
is 0.0.
far_percent
A real number defining the percentage of fog at the end of the bank. Default is
1.0.
background
A string that applies fog to the background as well as to the geometry. Default
is OFF (do not apply fog to the background).
With the FOG command, you can provide visual information about the distance of
objects from the view's eye. To maximize fog, add white to an image; to
maximize depth cueing, add black.
-------------------------------------------------------------------------------
light
Arguments
mode
options
The options allowed depend on the mode and are listed separately for each mode.
https://www.theswamp.org/Sources/doc/avlisp/#trans 269/300
5/8/23, 12:24 PM Auto/Visual lisp help
A--Ambient Light
Arguments
intensity
color
A list that specifies any RGB triplet; if omitted, it defaults to (1.0 1.0
1.0).
Examples
To set ambient light intensity to 0.6, issue the following:
To retrieve the current ambient light intensity, omit the intensity argument:
The intensity returned is 0.6, and the color is 1.0 1.0 1.0.
D--Delete Lights
Arguments
name
Examples
L--List Lights
List all lights in the drawing or return a definition of the specified light.
Arguments
name
A string specifying the name of the light to list. If you omit the name
argument, c:light returns a list of all the lights defined in the drawing.
Examples
The following command lists all lights defined in the current drawing:
("BUDLIGHT" "LIGHT01")
("P" <Entity name: 4cf3ae8> 1.0 (26.5609 43.423 48.6995) (0.0 0.0 0.0)
M--Modify Lights
https://www.theswamp.org/Sources/doc/avlisp/#trans 270/300
5/8/23, 12:24 PM Auto/Visual lisp help
(c:light "M" name [intensity [from [to [color [shadowmapsize [hotspot [falloff
[shadowsoftness [shadow [shadowobjects [month [day [hour [minute [daylight
[latitude [longitude [attenuation]]]]]]]]]]]]]]]]]])
Arguments
The arguments for the Modify mode are described in the following table:
+-----------------------+-----------+----------------------+-------------------+
| LIGHT--"M" mode arguments |
+-----------------------+-----------+----------------------+-------------------+
| Argument | Data type | Description | Default |
+-----------------------+-----------+----------------------+-------------------+
| name | STR | Unique light name | None |
+-----------------------+-----------+----------------------+-------------------+
| intensity | REAL | A real number from | Based on |
| | | 0.0 to the default | attenuation |
| | | maximum | |
+-----------------------+-----------+----------------------+-------------------+
| from | LIST | Light location | Current |
| | | | look-from point |
+-----------------------+-----------+----------------------+-------------------+
| to | LIST | Light target | Current look-at |
| | | | point |
+-----------------------+-----------+----------------------+-------------------+
| color | LIST | Any RGB triplet | 1.0, 1.0, 1.0 |
+-----------------------+-----------+----------------------+-------------------+
| shadowmapsize | INT | Integer from 0 to | 0 |
| | | 4096 (the size, in | |
| | | pixels, of one side | |
| | | of the shadow map) | |
+-----------------------+-----------+----------------------+-------------------+
| hotspot | REAL | Angle of the | 44.0 |
| | | brightness beam in | |
| | | degrees (must be in | |
| | | the range of 1-160) | |
+-----------------------+-----------+----------------------+-------------------+
| falloff | REAL | Angle that includes | 45.0 |
| | | the rapid decay | |
| | | area, in degrees | |
| | | (must be in the | |
| | | range 0-160 and | |
| | | greater than the | |
| | | hotspot value) | |
+-----------------------+-----------+----------------------+-------------------+
| shadowsoftness | REAL | Real number in the | 0.0 |
| | | range 0.0-10.0 | |
+-----------------------+-----------+----------------------+-------------------+
| shadow | STR | Shadow-casting | 0.0 |
| | | toggle. Valid | |
| | | values are: "off" | |
| | | (no shadows) and | |
| | | "on" (cast shadows) | |
+-----------------------+-----------+----------------------+-------------------+
| shadowobjects | ENAME | A selection of | 0.0 |
| | | objects that bound | |
| | | the shadow maps | |
+-----------------------+-----------+----------------------+-------------------+
| month | INT | Integer from 1 to 12 | 9 |
+-----------------------+-----------+----------------------+-------------------+
| day | INT | Integer from 1 to 31 | 21 |
+-----------------------+-----------+----------------------+-------------------+
| hour | INT | Integer from 0 to 24 | 15 |
+-----------------------+-----------+----------------------+-------------------+
| minute | INT | Integer from 0 to 59 | 0 |
+-----------------------+-----------+----------------------+-------------------+
| daylight | STR | Daylight savings | "off" |
| | | toggle. Valid | |
| | | values are: "off" | |
| | | (no daylight | |
| | | savings) and "on" | |
| | | (daylight savings) | |
+-----------------------+-----------+----------------------+-------------------+
| latitude | REAL | Real number in the | 37.62 |
| | | range 0-90 | |
+-----------------------+-----------+----------------------+-------------------+
| longitude | REAL | Real number in the | 122.37 |
| | | range 0-180 | |
+-----------------------+-----------+----------------------+-------------------+
| timezone | INT | Integer from -12 to | 8 (PST) |
| | | 12, representing | |
| | | the hours behind | |
https://www.theswamp.org/Sources/doc/avlisp/#trans 271/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | | Greenwich Mean Time | |
| | | (GMT) | |
+-----------------------+-----------+----------------------+-------------------+
| attenuation | INT | 0 = no attenuation | 1 |
| | | 1 = inverse linear | |
| | | attenuation | |
| | | 2 = inverse square | |
| | | attenuation | |
+-----------------------+-----------+----------------------+-------------------+
The hotspot and falloff arguments apply only to spotlights. You must pass them
as nil when you create a new distant light.
You can specify nil for any argument that does not apply to the type of light
you are modifying, or if you want the property affected by the argument to
retain its current value. You can omit any arguments located at the end of the
argument list (for example, attenuation, or attenuation and timezone, or
attenuation, timezone, and longitude...).
Examples
The following code changes the color of the distant light named "D1" to blue:
(c:light "ND" name [intensity [from [to [color [shadowmapsize [ nil [ nil
[shadowsoftness [shadow [month [day [hour [minute [daylightsavings [latitude
[longitude [timezone [attenuation [shadowobjects]]]]]]]]]]]]]]]]]]])
Arguments
The arguments for the New Distant Light mode are described in the following
table:
+-----------------------+-----------+----------------------+-------------------+
| LIGHT--"ND" mode arguments |
+-----------------------+-----------+----------------------+-------------------+
| Argument | Data type | Description | Default |
+-----------------------+-----------+----------------------+-------------------+
| name | STR | Unique light name | None |
+-----------------------+-----------+----------------------+-------------------+
| intensity | REAL | A real number from | Based on |
| | | 0.0 to the default | attenuation |
| | | maximum | |
+-----------------------+-----------+----------------------+-------------------+
| from | LIST | Light location | Current |
| | | | look-from point |
+-----------------------+-----------+----------------------+-------------------+
| to | LIST | Light target | Current look-at |
| | | | point |
+-----------------------+-----------+----------------------+-------------------+
| color | LIST | Any RGB triplet | 1.0, 1.0, 1.0 |
+-----------------------+-----------+----------------------+-------------------+
| shadowmapsize | INT | Integer from 0 to | 0 |
| | | 4096 (the size, in | |
| | | pixels, of one side | |
| | | of the shadow map) | |
+-----------------------+-----------+----------------------+-------------------+
| hotspot | REAL | Angle of the | 44.0 |
| | | brightness beam in | |
| | | degrees (must be in | |
| | | the range of 1-160) | |
+-----------------------+-----------+----------------------+-------------------+
| falloff | REAL | Angle that includes | 45.0 |
| | | the rapid decay | |
| | | area, in degrees | |
| | | (must be in the | |
| | | range 0-160 and | |
| | | greater than the | |
| | | hotspot value) | |
+-----------------------+-----------+----------------------+-------------------+
| shadowsoftness | REAL | Real number in the | 0.0 |
| | | range 0.0-10.0 | |
+-----------------------+-----------+----------------------+-------------------+
| shadow | STR | Shadow-casting | 0.0 |
| | | toggle. Valid | |
| | | values are: "off" | |
| | | (no shadows) and | |
| | | "on" (cast shadows) | |
+-----------------------+-----------+----------------------+-------------------+
| month | INT | Integer from 1 to 12 | 9 |
https://www.theswamp.org/Sources/doc/avlisp/#trans 272/300
5/8/23, 12:24 PM Auto/Visual lisp help
+-----------------------+-----------+----------------------+-------------------+
| day | INT | Integer from 1 to 31 | 21 |
+-----------------------+-----------+----------------------+-------------------+
| hour | INT | Integer from 0 to 24 | 15 |
+-----------------------+-----------+----------------------+-------------------+
| minute | INT | Integer from 0 to 59 | 0 |
+-----------------------+-----------+----------------------+-------------------+
| daylight | STR | Daylight savings | "off" |
| | | toggle. Valid | |
| | | values are: "off" | |
| | | (no daylight | |
| | | savings) and "on" | |
| | | (daylight savings) | |
+-----------------------+-----------+----------------------+-------------------+
| latitude | REAL | Real number in the | 37.62 |
| | | range 0-90 | |
+-----------------------+-----------+----------------------+-------------------+
| longitude | REAL | Real number in the | 122.37 |
| | | range 0-180 | |
+-----------------------+-----------+----------------------+-------------------+
| timezone | INT | Integer from -12 to | 8 (PST) |
| | | 12, representing | |
| | | the hours behind | |
| | | Greenwich Mean Time | |
| | | (GMT) | |
+-----------------------+-----------+----------------------+-------------------+
| shadowobjects | ENAME | A selection of | 0.0 |
| | | objects that bound | |
| | | the shadow maps | |
+-----------------------+-----------+----------------------+-------------------+
NP--New Point Light
Arguments
The arguments for the New Point Light mode are described in the following
table:
+-----------------------+-----------+----------------------+-------------------+
| LIGHT-- "NP" mode arguments |
+-----------------------+-----------+----------------------+-------------------+
| Argument | Data type | Description | Default |
+-----------------------+-----------+----------------------+-------------------+
| name | STR | Unique light name | None |
+-----------------------+-----------+----------------------+-------------------+
| intensity | REAL | A real number from | Based on |
| | | 0.0 to the default | attenuation |
| | | maximum | |
+-----------------------+-----------+----------------------+-------------------+
| from | LIST | Light location | Current |
| | | | look-from point |
+-----------------------+-----------+----------------------+-------------------+
| color | LIST | Any RGB triplet | 1.0, 1.0, 1.0 |
+-----------------------+-----------+----------------------+-------------------+
| shadowmapsize | INT | Integer from 0 to | 0 |
| | | 4096 (the size, in | |
| | | pixels, of one side | |
| | | of the shadow map) | |
+-----------------------+-----------+----------------------+-------------------+
| shadowsoftness | REAL | Real number in the | 0.0 |
| | | range 0.0-10.0 | |
+-----------------------+-----------+----------------------+-------------------+
| shadow | STR | Shadow-casting | 0.0 |
| | | toggle. Valid | |
| | | values are: "off" | |
| | | (no shadows) and | |
| | | "on" (cast shadows) | |
+-----------------------+-----------+----------------------+-------------------+
| attenuation | INT | 0 = no attenuation | 1 |
| | | 1 = inverse linear | |
| | | attenuation | |
| | | 2 = inverse square | |
| | | attenuation | |
+-----------------------+-----------+----------------------+-------------------+
| shadowobjects | ENAME | A selection of | 0.0 |
| | | objects that bound | |
| | | the shadow maps | |
+-----------------------+-----------+----------------------+-------------------+
Three arguments--to (after from), hotspot, and falloff (after
shadowmapsize)--do not apply to point lights. You must pass them as nil when
https://www.theswamp.org/Sources/doc/avlisp/#trans 273/300
5/8/23, 12:24 PM Auto/Visual lisp help
you create a new point light.
Examples
For example, the following code creates a new point light named NEWPT1.
NEWPT1 would have the default intensity, the current attenuation setting, the
default location looking at the current view, and the default color of white.
Note: For point lights, the default maximum intensity depends on the current
point/spotlight attenuation setting. With no attenuation, it is 1.00; with
inverse linear attenuation, it is twice the drawing's maximum extents distance;
and with inverse square attenuation, it is the square of twice the maximum
extents distance.
NS--New Spotlight
(c:light "NS" name [intensity [from [to [color [shadowmapsize [hotspot [falloff
[shadowsoftness [shadow [attenuation [shadowobjects]]]]]]]]]]])
Arguments
The arguments for the New Spotlight mode are described in the following table:
+-----------------------+-----------+----------------------+-------------------+
| LIGHT-- "NS" mode arguments |
+-----------------------+-----------+----------------------+-------------------+
| Argument | Data type | Description | Default |
+-----------------------+-----------+----------------------+-------------------+
| name | STR | Unique light name | None |
+-----------------------+-----------+----------------------+-------------------+
| intensity | REAL | A real number from | Based on |
| | | 0.0 to the default | attenuation |
| | | maximum | |
+-----------------------+-----------+----------------------+-------------------+
| from | LIST | Light location | Current |
| | | | look-from point |
+-----------------------+-----------+----------------------+-------------------+
| to | LIST | Light target | Current look-at |
| | | | point |
+-----------------------+-----------+----------------------+-------------------+
| color | LIST | Any RGB triplet | 1.0, 1.0, 1.0 |
+-----------------------+-----------+----------------------+-------------------+
| shadowmapsize | INT | Integer from 0 to | 0 |
| | | 4096 (the size, in | |
| | | pixels, of one side | |
| | | of the shadow map) | |
+-----------------------+-----------+----------------------+-------------------+
| hotspot | REAL | Angle of the | 44.0 |
| | | brightness beam in | |
| | | degrees (must be in | |
| | | the range of 1-160) | |
+-----------------------+-----------+----------------------+-------------------+
| falloff | REAL | Angle that includes | 45.0 |
| | | the rapid decay | |
| | | area, in degrees | |
| | | (must be in the | |
| | | range 0-160 and | |
| | | greater than the | |
| | | hotspot value) | |
+-----------------------+-----------+----------------------+-------------------+
| shadowsoftness | REAL | Real number in the | 0.0 |
| | | range 0.0-10.0 | |
+-----------------------+-----------+----------------------+-------------------+
| shadow | STR | Shadow-casting | 0.0 |
| | | toggle. Valid | |
| | | values are: "off" | |
| | | (no shadows) and | |
| | | "on" (cast shadows) | |
+-----------------------+-----------+----------------------+-------------------+
| attenuation | INT | 0 = no attenuation | 1 |
| | | 1 = inverse linear | |
| | | attenuation | |
| | | 2 = inverse square | |
| | | attenuation | |
+-----------------------+-----------+----------------------+-------------------+
| shadowobjects | ENAME | A selection of | 0.0 |
| | | objects that bound | |
| | | the shadow maps | |
+-----------------------+-----------+----------------------+-------------------+
https://www.theswamp.org/Sources/doc/avlisp/#trans 274/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
Command: (c:light "NS" "GSPOT" 43.82 '(12.0 6.0 24.0) '(78.0 78.0
24.0) nil nil 30.0 32.0)
Note: For spotlights, the default maximum intensity depends on the current
point/spotlight attenuation setting. With no attenuation, it is 1.00; with
inverse linear attenuation, it is twice the drawing's maximum extents distance;
and with inverse square attenuation, it is the square of twice the maximum
extents distance.
R--Rename Light
Rename a light.
Arguments
old_name
new_name
The following function call changes the light named "GSPOT" to "HOTSPOT":
Examples
Command: (c:light "R" "GSPOT" "HOTSPOT")
-------------------------------------------------------------------------------
lsedit
This form of c:lsedit lists the attributes of the specified landscape object.
The list returned identifies the name, height, position, and view alignment of
the specified object.
Arguments
The arguments for the LSEDIT command are described in the following table:
+------------------+-----------------+-------------------------------+---------+
| LSEDIT arguments |
+------------------+-----------------+-------------------------------+---------+
| Argument | Data type | Description | Default |
+------------------+-----------------+-------------------------------+---------+
| object | ENAME | Handle of the landscape | None |
| | | object | |
+------------------+-----------------+-------------------------------+---------+
| height | REAL | Height of the object in | None |
| | | drawing units. If nil, the | |
| | | current value is unchanged. | |
https://www.theswamp.org/Sources/doc/avlisp/#trans 275/300
5/8/23, 12:24 PM Auto/Visual lisp help
+------------------+-----------------+-------------------------------+---------+
| position | LIST (of reals) | The position of the base of | None |
| | | the object. If nil, the | |
| | | current value is unchanged. | |
+------------------+-----------------+-------------------------------+---------+
| alignment | INT | Specifies the geometry and | None |
| | | alignment of the | |
| | | entry:0--view-aligned single | |
| | | face | |
| | | 1--non-view-aligned single | |
| | | face | |
| | | 2--non-view-aligned crossing | |
| | | faces | |
| | | 3--view-aligned crossing | |
| | | facesIf nil, the current | |
| | | value is unchanged. | |
+------------------+-----------------+-------------------------------+---------+
Examples
Modify a landscape object, where <ename> is the AutoCAD name (entsel) of the
object to modify; leave alignment unchanged:
-------------------------------------------------------------------------------
lslib
Arguments
mode
options
The allowable options arguments vary depending on mode. See the description of
each mode to determine the allowable options.
ADD
Arguments
name
texture-map
opacity-map
alignment
An integer specifying the geometry and alignment of the entry. Can be one of
the following:
https://www.theswamp.org/Sources/doc/avlisp/#trans 276/300
5/8/23, 12:24 PM Auto/Visual lisp help
0 view-aligned single face
Examples
Add an entry called "Maple tree" to the current landscape library:
DELETE
Arguments
name
Examples
Remove the entry called "Maple tree" from the current landscape library:
MODIFY
Arguments
name
texture-map
opacity-map
alignment
An integer specifying the geometry and alignment of the entry. Can be one of
the following:
Examples
Change the "Maple tree" to be non-view-aligned with crossing faces:
OPEN
Arguments
https://www.theswamp.org/Sources/doc/avlisp/#trans 277/300
5/8/23, 12:24 PM Auto/Visual lisp help
name
Examples
Open the TREES.LLI file and make it the current landscape library:
SAVE
Arguments
name
Examples
LIST
Lists all the elements in the current library. This command takes no arguments.
The list includes landscape entries of the form '("NAME" "TEX-MAP" "OP-MAP"
ALIGN).
(c:lslib "LIST")
Examples
The following illustrates output from the LIST option:
-------------------------------------------------------------------------------
lsnew
Arguments
object-type
height
position
alignment
An integer specifying the geometry and alignment of the entry. Can be one of
the following:
https://www.theswamp.org/Sources/doc/avlisp/#trans 278/300
5/8/23, 12:24 PM Auto/Visual lisp help
2 non-view-aligned crossing faces
Examples
Create a new instance of "Cactus" that is 25 units tall, located at 0, 1, 3,
and has a single non-view-aligned face.
-------------------------------------------------------------------------------
matlib
Arguments
mode
A string that specifies the action that this function performs. Can be one of
the following:
L List materials
name
A string that specifies the name of the material to import, export, or delete.
file
A string that specifies the name of the materials library. file. The file
argument must include the .mli extension
Examples
Imports the material BRASS from the standard AutoCAD Render materials library,
render.mli:
-------------------------------------------------------------------------------
mirror3d
Arguments
The order, number, and type of arguments for the mirror3d function are the same
as if you were entering the MIRROR3D AutoCAD command. To signify a user
pressing ENTER without typing any values, use nil or an empty string ("").
https://www.theswamp.org/Sources/doc/avlisp/#trans 279/300
5/8/23, 12:24 PM Auto/Visual lisp help
Return Values
T if successful, otherwise nil.
Examples
The following example mirrors the selected objects about the XY plane that
passes through the point 0,0,5, and then deletes the old objects:
(setq ss (ssget))
-------------------------------------------------------------------------------
render
Arguments
filename
point1
point1
The rendering is controlled by the current settings; set these by using the
c:rpref function. For example:
Note: When the current rendering preferences specify Query for Selection and
the PICKFIRST system variable is turned on, and when a selection set is current
as you invoke c:render, the objects in the set are rendered with no further
prompting.
Arguments
The following table describes the c:rfileopt arguments.
+--------------------+-----------+---------------------------------------------+
| RFILEOPT arguments |
+--------------------+-----------+---------------------------------------------+
| Argument | Data type | Description |
+--------------------+-----------+---------------------------------------------+
| fileformat | STR | Identifier for the requested |
| | | format:TGA--Targa format |
| | | PCX--Z-Soft bitmap format |
| | | BMP--Microsoft Windows format |
| | | PS--PostScript |
| | | TIFF--Tagged Image File Format |
+--------------------+-----------+---------------------------------------------+
| xres | INT | X resolution of the output file (valid |
| | | values range from 1 to 4096) |
+--------------------+-----------+---------------------------------------------+
| yres | INT | Y resolution of the output file (valid |
| | | values range from 1 to 4096) |
https://www.theswamp.org/Sources/doc/avlisp/#trans 280/300
5/8/23, 12:24 PM Auto/Visual lisp help
+--------------------+-----------+---------------------------------------------+
| aratio | REAL | Pixel aspect ratio |
+--------------------+-----------+---------------------------------------------+
| colormode | STR | Each file format accepts a subset of the |
| | | following values:MONO--Monochrome |
| | | G8--256 gray levels |
| | | C8--256 colors |
| | | C16--16-bit color |
| | | C24--24-bit color |
| | | C32--24-bit color with 8 bits of alpha |
+--------------------+-----------+---------------------------------------------+
TGA
Arguments
+----------------------+-----------+-------------------------------------------+
| TGA format arguments |
+----------------------+-----------+-------------------------------------------+
| Argument | Data type | Description |
+----------------------+-----------+-------------------------------------------+
| colormode | STR | Color mode: G8, C8, C24, or C32 |
+----------------------+-----------+-------------------------------------------+
| interlace | INT | Interlace mode: 1--no interlace |
| | | 2--2:1 interlace |
| | | 4--4:1 interlace |
+----------------------+-----------+-------------------------------------------+
| compress | STR | Compression (default = |
| | | "COMP"):COMP--Compression on |
| | | nil--No compression |
+----------------------+-----------+-------------------------------------------+
| bottomup | STR | Bottom up (default = "UP"): UP--bottom up |
| | | nil--top down |
+----------------------+-----------+-------------------------------------------+
Examples
(C:RFILEOPT "TGA" 640 480 1.0 "C32" 1 "COMP" "UP")
PCX
Arguments
+----------------------+-----------+-----------------------------+
| PCX format arguments |
+----------------------+-----------+-----------------------------+
| Argument | Data type | Description |
+----------------------+-----------+-----------------------------+
| colormode | STR | Color mode: MONO, G8, or C8 |
+----------------------+-----------+-----------------------------+
Examples
(C:RFILEOPT "PCX" 640 480 1.0 "G8")
BMP
Arguments
+----------------------+-----------+-----------------------------+
| BMP format arguments |
+----------------------+-----------+-----------------------------+
| Argument | Data type | Description |
+----------------------+-----------+-----------------------------+
| colormode | STR | Color mode: MONO, G8, or C8 |
+----------------------+-----------+-----------------------------+
Examples
(C:RFILEOPT "BMP" 640 480 1.0 "C8")
PS
https://www.theswamp.org/Sources/doc/avlisp/#trans 281/300
5/8/23, 12:24 PM Auto/Visual lisp help
(c:rfileopt "PS" xres yres aratio colormode portrait imagesize [size])
Arguments
+---------------------+-----------+--------------------------------------------+
| PS format arguments |
+---------------------+-----------+--------------------------------------------+
| Argument | Data type | Description |
+---------------------+-----------+--------------------------------------------+
| colormode | STR | Color mode: MONO, G8, C8, or C24 |
+---------------------+-----------+--------------------------------------------+
| portrait | STR | Landscape or portrait (default = "L"): |
| | | P--Portrait |
| | | L--Landscape |
+---------------------+-----------+--------------------------------------------+
| imagesize | STR | Type (default = "A")A--Auto |
| | | I--Image |
| | | C--Custom |
+---------------------+-----------+--------------------------------------------+
| size | INT | Size of the image |
+---------------------+-----------+--------------------------------------------+
Examples
(C:RFILEOPT "PS" 640 480 1.0 "C24" "P" "C" 640)
TIFF
Arguments
+-----------------------+-----------+---------------------------------------+
| TIFF format arguments |
+-----------------------+-----------+---------------------------------------+
| Argument | Data type | Description |
+-----------------------+-----------+---------------------------------------+
| colormode | STR | Color mode: MONO, G8, C8, C24, or C32 |
+-----------------------+-----------+---------------------------------------+
Examples
(C:RFILEOPT "TIFF" 640 480 1.0 "C24")
-------------------------------------------------------------------------------
renderupdate
(c:renderupdate [RU_value])
Use the renderupdate command with no arguments to regenerate the en2face file
on the next rendering.
Arguments
RU_value
-------------------------------------------------------------------------------
rpref
The c:rpref function determines which rendering parameters will be used, and
https://www.theswamp.org/Sources/doc/avlisp/#trans 282/300
5/8/23, 12:24 PM Auto/Visual lisp help
which rendering behavior will be the default.
Arguments
mode
option
Depends on mode.
setting
Depends on mode.
DEST--Destination Preference
Arguments
option
A string that specifies the rendering destination. Can be one of the following:
Examples
The following call specifies rendering to a file:
ICON--Icon Preference
Arguments
option
A real that specifies the size of the icon block. The default value is 1.00.
Examples
The following function call changes the icon scale to 50 percent:
Arguments
option
A string that specifies the rendering type. Can be one of the following:
https://www.theswamp.org/Sources/doc/avlisp/#trans 283/300
5/8/23, 12:24 PM Auto/Visual lisp help
ARENDER Basic rendering
Examples
The following code specifies that the next rendering will be generated by the
basic AutoCAD renderer.
SELECT--Selection Preference
Arguments
option
Examples
The following call sets rendering to prompt for object selection:
TOGGLE--Toggle Preference
Arguments
option
setting
A string that specifies the state of the toggle. Possible values for setting
are "ON" and "OFF".
Examples
The following calls turn off Merge rendering and turn on shadows:
-------------------------------------------------------------------------------
replay
https://www.theswamp.org/Sources/doc/avlisp/#trans 284/300
5/8/23, 12:24 PM Auto/Visual lisp help
(c:replay filename type [xoff yoff xsize ysize])
With the REPLAY command, you can display BMP, TGA, or TIFF files on the AutoCAD
rendering display. Use this command's function to replay the image file at
various offsets and sizes.
Arguments
filename
type
xoff
yoff
xsize
ysize
Examples
The following call replays an image named test.tga, displaying pixels starting
from the lower left of the image (zero offset) out to 500 pixels wide and 400
pixels in height:
-------------------------------------------------------------------------------
rotate3d
Arguments
args
The order, number, and type of arguments for the rotate3d function are the same
as if you were entering them at the command line; see ROTATE3D in the Command
Reference for more information.
Return Values
Examples
The following example rotates the selected objects 30 degrees about the axis
specified by points p1 and p2.
(setq ss (ssget))
(rotate3d ss p1 p2 30)
AutoLISP support for the rotate3d function is implemented with the use of the
SAGET library.
-------------------------------------------------------------------------------
scene
https://www.theswamp.org/Sources/doc/avlisp/#trans 285/300
5/8/23, 12:24 PM Auto/Visual lisp help
Creates new scenes and modifies or deletes existing scenes in paper space only
(Externally-defined: render ARX application)
Arguments
mode
options
D--Delete Scene
Arguments
name
the deleted scene is the current scene, NONE becomes the current scene.
Examples
(c:scene "D" "PLANVIEW")
L--List Scene
Lists all scenes in the drawing or returns a definition of the specified scene.
Arguments
name
A string that specifies the name of the scene to list. If the name argument is
omitted, c:scene returns a list of all the scenes defined in the drawing.
Return Values
When you specify name, c:scene returns the definition of the named scene.
Examples
The following code returns a list of scene names defined in the drawing.
The empty string ("") is the default scene, *NONE*, which can't be modified.
(T T)
("VIEW1" nil)
https://www.theswamp.org/Sources/doc/avlisp/#trans 286/300
5/8/23, 12:24 PM Auto/Visual lisp help
M--Modify Scene
The options for the Modify mode are the same as those for the New mode, except
that you can pass view as nil to modify only the lights.
Note: You must pass the lights argument as a list even when you specify only
one light.
For example, the following call modifies a scene named SCENE1 to use the named
view FRONT and all the lights in the drawing:
The following call modifies SCENE1 to use the named view BACK and only the
lights P1 and P2:
N--New Scene
Arguments
name
view
lights
+------------+------+-------------+---------+--------+----------+------------+---------------------+
| * SCENE--"N" mode argument | | | | |
+------------+------+-------------+---------+--------+----------+------------+---------------------+
| * Argument | * | * | * | | | | |
| | Data | Description | Default | | | | |
| | type | | | | | | |
+------------+------+-------------+---------+--------+----------+------------+---------------------+
| | | | | * | * LIST | * List of | * ALL lights in |
| | | | | lights | (of | light | the drawing |
| | | | | | strings) | names. | |
| | | | | | | Must use | An |
| | | | | | T (SYM) | a list | "over-the-shoulder" |
| | | | | | nil | even if | distant light |
| | | | | | | specifying | |
| | | | | | | a single | |
| | | | | | | light. | |
| | | | | | | Use ALL | |
| | | | | | | lights in | |
| | | | | | | the | |
| | | | | | | drawing | |
| | | | | | | Use no | |
| | | | | | | lights in | |
| | | | | | | the | |
| | | | | | | drawing | |
+------------+------+-------------+---------+--------+----------+------------+---------------------+
Examples
To create a new scene named DEFAULT using the CURRENT view and ALL lights,
issue the following function call:
To create a new scene named DULL using the CURRENT view and the default,
"over-the-shoulder" lighting, use the following call:
https://www.theswamp.org/Sources/doc/avlisp/#trans 287/300
5/8/23, 12:24 PM Auto/Visual lisp help
To create a new scene named SPECIAL using the named view MY_VIEW and the SUN,
LAMP, and SPOT lights, issue the following function call:
R--Rename Scene
Renames a scene.
Arguments
old_name
new_name
Examples
Rename a scene from "SPECIAL" to "BRIGHT":
S--Set Scene
Arguments
old_name
Return Values
If you omit the name argument, c:scene returns the name of the currently
selected scene.
Examples
Obtain the name of the currently selected scene:
"PLAN"
To make SCENE3 the current scene, issue the following function call:
-------------------------------------------------------------------------------
stats
Arguments
filename | nil
A string specifying the name of the file to save the rendering information in,
or nil to tell RENDER to stop saving statistics. If you omit the file name,
c:stats displays the Statistics dialog box.
Examples
https://www.theswamp.org/Sources/doc/avlisp/#trans 288/300
5/8/23, 12:24 PM Auto/Visual lisp help
The following command writes statistics from your last rendering to the
figures.txt file:
(c:stats "figures.txt")
The following command saves the information associated with the last rendering
to the stats.txt file, and also saves the information associated with the
following renderings to this file:
(c:stats "stats.txt")
(c:stats nil)
-------------------------------------------------------------------------------
setuv
Assigns material mapping coordinates to selected objects. Its function has two
modes, specified by a string argument (Externally-defined: render ARX
application)
The SETUV command lets you assign material mapping coordinates to selected
objects.
Arguments
mode
options
A--Assign
Arguments
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| SETUV--"A" mode arguments for projection mapping | | | | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| Argument | Data | Description | Default | | | | |
| | type | | | | | | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| | | | | ssname | PICKSET | The | None |
| | | | | | | selection | |
| | | | | | | set that | |
| | | | | | | contains | |
| | | | | | | the | |
| | | | | | | entities | |
| | | | | | | to which | |
| | | | | | | you want | |
| | | | | | | to assign | |
| | | | | | | mapping | |
| | | | | | | coordinates | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| mapping | STR | Type of projection | None | | | | |
| type | | mapping:P--planarD--cylindricalF--spherical | | | | | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| pt1, pt2, | LIST | Three points that define the mapping | None | | | | |
| pt3 | | geometry:Planar--lower-left corner, | | | | | |
| | | lower-right corner, upper-left corner | | | | | |
| | | Cylindrical--center bottom, center top, | | | | | |
| | | direction toward the seam | | | | | |
| | | Spherical--center of the sphere, radius | | | | | |
https://www.theswamp.org/Sources/doc/avlisp/#trans 289/300
5/8/23, 12:24 PM Auto/Visual lisp help
| | | (north), direction toward the seam | | | | | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| rep | INT | Tiling:0--no tiling (crop) | 1 | | | | |
| | | 1--tile (repeat pattern) | | | | | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| scale | LIST | The U and V scale factors | (1.0 | | | | |
| | (of | | 1.0) | | | | |
| | reals) | | | | | | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
| offset | LIST | The U and V offsets | (0.0 | | | | |
| | (of | | 0.0) | | | | |
| | reals) | | | | | | |
+------------+--------+---------------------------------------------+---------+--------+---------+-------------+------+
For solid mapping, the option arguments specify only the mapping points. These
implicitly define the scale in the UVW dimensions. The assign arguments for
solid mapping are described in the following table:
+------------+------+-------------+---------+--------+---------+-------------+------+
| SETUV--"A" mode arguments for solid | | | | |
| mapping | | | | |
+------------+------+-------------+---------+--------+---------+-------------+------+
| Argument | Data | Description | Default | | | | |
| | type | | | | | | |
+------------+------+-------------+---------+--------+---------+-------------+------+
| | | | | ssname | PICKSET | The | None |
| | | | | | | selection | |
| | | | | | | set that | |
| | | | | | | contains | |
| | | | | | | the | |
| | | | | | | objects to | |
| | | | | | | which you | |
| | | | | | | want to | |
| | | | | | | assign | |
| | | | | | | mapping | |
| | | | | | | coordinates | |
+------------+------+-------------+---------+--------+---------+-------------+------+
| mapping | STR | R--solid | None | | | | |
| type | | | | | | | |
+------------+------+-------------+---------+--------+---------+-------------+------+
| pt1 | LIST | Point to | None | | | | |
| | | define the | | | | | |
| | | origin | | | | | |
+------------+------+-------------+---------+--------+---------+-------------+------+
| pt1 | LIST | Point to | None | | | | |
| | | define the | | | | | |
| | | U axis | | | | | |
+------------+------+-------------+---------+--------+---------+-------------+------+
| pt1 | LIST | Point to | None | | | | |
| | | define the | | | | | |
| | | V axis | | | | | |
+------------+------+-------------+---------+--------+---------+-------------+------+
| pt1 | LIST | Point to | None | | | | |
| | | define the | | | | | |
| | | W axis | | | | | |
+------------+------+-------------+---------+--------+---------+-------------+------+
Examples
The following function call assigns cylindrical mapping coordinates to an
object the user chooses, using tiling and the default scale and offset:
(c:setuv "A" (ssget) "C" '(5.0 5.0 5.0) '(5.0 5.0 10.0)
D--Detach
The "D" (detach) mode detaches the UV mapping assigned to the objects in the
selection set. These objects will now be mapped with the default mapping
coordinates until you assign mapping coordinates again.
Arguments
ssname
The selection set that contains the objects from which you want to detach
mapping coordinates
Examples
The following call prompts the user for entities that will be detached from
their mapping coordinates:
https://www.theswamp.org/Sources/doc/avlisp/#trans 290/300
5/8/23, 12:24 PM Auto/Visual lisp help
-------------------------------------------------------------------------------
saveimg
Arguments
The arguments to saveimg are described in the following table:
+-------------+------+--------------------+---------+----------+-----+-------+------+
| SAVEIMG function arguments | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| Argument | Data | Description | Default | | | | |
| | type | | | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| | | | | filename | STR | Image | None |
| | | | | | | file | |
| | | | | | | name | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| type | STR | File type: BMP, | None | | | | |
| | | TGA, or TIFF | | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| portion | STR | Portion of the | "A" | | | | |
| | | screen to | | | | | |
| | | save:A--active | | | | | |
| | | viewportD--drawing | | | | | |
| | | areaF--full | | | | | |
| | | screen NOTE This | | | | | |
| | | argument is now | | | | | |
| | | ignored, but is | | | | | |
| | | provided for | | | | | |
| | | script | | | | | |
| | | compatibility. | | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| xoff | INT | X offset in pixels | 0 | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| yoff | INT | Y offset in pixels | 0 | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| xsize | INT | X size in pixels | Actual | | | | |
| | | | X size | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| ysize | INT | Y size in pixels | Actual | | | | |
| | | | Y size | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
| compression | STR | Compression | None | | | | |
| | | scheme:NONE | | | | | |
| | | PACK (TIFF files | | | | | |
| | | only) | | | | | |
| | | RLE (TGA files | | | | | |
| | | only) | | | | | |
+-------------+------+--------------------+---------+----------+-----+-------+------+
Examples
The following example saves a full-screen TIFF image named test.tif, without
compressing the file:
-------------------------------------------------------------------------------
showmat
Lists the material type and attachment method for a selected object
(Externally-defined: render ARX application)
(c:showmat arg1)
https://www.theswamp.org/Sources/doc/avlisp/#trans 291/300
5/8/23, 12:24 PM Auto/Visual lisp help
This function lists the material type and attachment method based on arg1.
Arguments
arg1
-------------------------------------------------------------------------------
rmat
Arguments
mode
A Attaches material
C Copies material
D Detaches material
M Modifies material
options
A--Attach Material
The "A" (attach) mode lets you attach a material to selected objects or an ACI
(AutoCAD Color Index) value, depending on whether the third argument
(layer-name) is an integer or a selection set.
Arguments
The following table describes the attach arguments.
+------------------+-----------+-----------------------------------------------+
| Attach arguments |
+------------------+-----------+-----------------------------------------------+
| Argument | Data type | Description |
+------------------+-----------+-----------------------------------------------+
| name | STR | Name of the material to attach |
+------------------+-----------+-----------------------------------------------+
| aci | INT | ACI number in the range of 0 through 255 |
+------------------+-----------+-----------------------------------------------+
| selection-set | INT | Selection set that contains the entities to |
| | | attach |
+------------------+-----------+-----------------------------------------------+
| layer-name | STR | Name of the layer |
+------------------+-----------+-----------------------------------------------+
Examples
If you omit the third argument, the "A" mode returns a list of three items:
https://www.theswamp.org/Sources/doc/avlisp/#trans 292/300
5/8/23, 12:24 PM Auto/Visual lisp help
The following example illustrates the values returned when the third argument
is omitted:
A material index value in the range 1-255 is an ACI number; an index greater
than 255 indicates an AutoCAD Render material not assigned by ACI.
C--Copy Material
Arguments
cur_name
new_name
Examples
Modify a material to change its definition:
D--Detach Material
The "D" (detach) mode lets you detach a material from selected objects, an ACI
(AutoCAD Color Index) value, or layers, depending on whether the second
argument (selection-set) is an integer, a selection set, or a string.
Arguments
The following table describes the detach arguments.
+------------------+-----------+-------------------------------------+---------+
| Detach arguments |
+------------------+-----------+-------------------------------------+---------+
| Argument | Data type | Description | Default |
+------------------+-----------+-------------------------------------+---------+
| name | STR | Name of the material to detach | None |
+------------------+-----------+-------------------------------------+---------+
| aci | INT | ACI number in the range of 0 | None |
| | | through 255 | |
+------------------+-----------+-------------------------------------+---------+
| selection-set | INT | Selection set that contains the | None |
| | | entities to detach | |
+------------------+-----------+-------------------------------------+---------+
| layer-name | STR | Name of the layer | None |
+------------------+-----------+-------------------------------------+---------+
Examples
Prompt the user to select objects, and then detach each object from its
material:
L--List Material
Arguments
name
A string that specifies the material definition to list. If the name argument
is omitted, c:rmat lists all materials in the drawing.
https://www.theswamp.org/Sources/doc/avlisp/#trans 293/300
5/8/23, 12:24 PM Auto/Visual lisp help
Examples
List all materials in the drawing:
The first string in the list specifies the default global material, *GLOBAL*.
You can pass this string to c:rmat just as you can pass the names of library or
user-defined materials, as demonstrated in the following example:
("*GLOBAL*" "STANDARD" (-1.0 -1.0 -1.0) 0.7 ("" 0.0 0 (1.0 1.0) (0.0
0.0) 0.0 0 0) (-1.0 -1.0 -1.0) 0.1 (-1.0 -1.0 -1.0) 0.2 ("" 0.0 0)
0.5 0.0 ("" 0.0 0 (1.0 1.0) (0.0 0.0) 0.0 0 0) 1.0 ("" 0.0 0 (1.0
1.0) (0.0 0.0) 0.0 0 0))
The list items in a material definition are the same as the arguments to the
Modify or New modes.
M--Modify Material
The options for the "M" (modify) mode are the same as for the "N" (new) mode.
If an argument is nil, or is omitted from the end of the argument list, the
property affected by the argument retains its current value.
For example, the following call changes BLUE MARBLE to have a medium blue stone
(matrix) color and black veins:
(c:rmat "M" "BLUE MARBLE" "marble" '(0.5 0.5 1.0) '(0.0 0.0 0.0))
N--New Material
The "N" (new) mode creates a new material. The arguments to this function
depend not only on the mode, but also on the type of material you're creating.
The procedural materials--marble, granite, and wood--have a unique set of
arguments, each of which differs from the standard material arguments.
Arguments
The following table describes the new arguments:
+---------------+-----------+---------------------------------------+----------+
| New arguments |
+---------------+-----------+---------------------------------------+----------+
| Argument | Data type | Description | Default |
+---------------+-----------+---------------------------------------+----------+
| name | STR | Name of the material to create | None |
+---------------+-----------+---------------------------------------+----------+
| material-type | STR | Type of new material. The options | None |
| | | are:STANDARD--standard material | |
| | | MARBLE--marble material | |
| | | GRANITE--granite material | |
| | | WOOD--wood material | |
+---------------+-----------+---------------------------------------+----------+
| description | (Varies) | Arguments depend on the type of | (Varies) |
| | | material you're creating | |
+---------------+-----------+---------------------------------------+----------+
| selection-set | INT | Selection set that contains the | None |
| | | entities to detach | |
+---------------+-----------+---------------------------------------+----------+
| layer-name | STR | Name of the layer | None |
+---------------+-----------+---------------------------------------+----------+
In addition, the arguments for each kind of bitmap are specified in a sublist
as described under Bitmap Arguments.
Standard
The material type string "STANDARD" indicates you're creating a new standard
material.
Arguments
The following table describes the standard arguments:
+-------------------+-------------+----------------------------+---------------+
| Standard arguments |
+-------------------+-------------+----------------------------+---------------+
https://www.theswamp.org/Sources/doc/avlisp/#trans 294/300
5/8/23, 12:24 PM Auto/Visual lisp help
| Argument | Data type | Description | Default |
+-------------------+-------------+----------------------------+---------------+
| color | LIST (or | Material color as an RGB | (-1.0 -1.0 |
| | reals) | triple; (-1.0 - 1.0 -1.0) | -1.0)--By ACI |
| | | means derive the color | |
| | | from an object's ACI | |
| | | (diffuse color) | |
+-------------------+-------------+----------------------------+---------------+
| color-weight | REAL | Weight factor (color | 0.7 |
| | | Value)--the amount of | |
| | | diffuse color | |
+-------------------+-------------+----------------------------+---------------+
| pattern | LIST | Pattern/texture map | None |
| | | arguments | |
+-------------------+-------------+----------------------------+---------------+
| ambient | LIST (or | Ambient (shadow) color as | (-1.0 -1.0 |
| | reals) | an RGB triple | -1.0)--By ACI |
+-------------------+-------------+----------------------------+---------------+
| amb-weight | REAL | Weight factor (ambient | 0.1 |
| | | Value)--the amount of | |
| | | specular color | |
+-------------------+-------------+----------------------------+---------------+
| refl | LIST (or | Reflection (specular) | (-1.0 -1.0 |
| | reals) | color as an RGB triple | -1.0)--By ACI |
+-------------------+-------------+----------------------------+---------------+
| refl-weight | REAL | Weight factor (reflection | 0.2 |
| | | Value)--the amount of | |
| | | specular color | |
+-------------------+-------------+----------------------------+---------------+
| refl-map | LIST | Reflection/environment | None |
| | | map arguments | |
+-------------------+-------------+----------------------------+---------------+
| roughness | REAL | Roughness--the size of a | 0.5 |
| | | specular highlight | |
+-------------------+-------------+----------------------------+---------------+
| transparency | REAL | Transparency of the | 0.0 |
| | | material | |
+-------------------+-------------+----------------------------+---------------+
| opacity-map | LIST | Opacity map arguments | None |
+-------------------+-------------+----------------------------+---------------+
| refraction | REAL | Index of refraction | 1.0 |
+-------------------+-------------+----------------------------+---------------+
| bumpmap | LIST | Bump map arguments | None |
+-------------------+-------------+----------------------------+---------------+
Examples
The following call creates a shiny red material with a pattern map:
'(1.0 0.0 0.0) (1.0) ; Color (red), weight, and texture map
'(1.0 0.0 0.0) 1.0 ; Ambient color and its weight (same as diffuse)
'(1.0 0.0 0.0) 1.0 ; Reflection color (white) and its weight
The next call creates a material, MAPS, that uses multiple bitmaps:
0.5
0.0
'("hole.tga")
https://www.theswamp.org/Sources/doc/avlisp/#trans 295/300
5/8/23, 12:24 PM Auto/Visual lisp help
1.0
'("ridges.tga")
The following call creates a material with no bitmaps and default values, with
reflections that are generated by ray tracing when rendered with Photo Raytrace
or with environment map with Photo Real:
(c:rmat "N" "SHINE" "STANDARD" nil nil nil nil nil nil nil
'(nil nil 1))
Marble
The material type string "MARBLE" indicates that you are creating a new marble
material.
Arguments
The following table describes the marble arguments:
+------------------+------------+----------------------------+-----------------+
| RMAT--Marble arguments |
+------------------+------------+----------------------------+-----------------+
| Argument | Data type | Description | Default |
+------------------+------------+----------------------------+-----------------+
| stone-color | LIST (of | RGB value specifying the | (-1.0 -1.0 |
| | reals) | main matrix color of the | -1.0)--white |
| | | marble | |
+------------------+------------+----------------------------+-----------------+
| vein-color | LIST (of | RGB value specifying the | (-1.0 -1.0 |
| | reals) | vein color of the marble | -1.0)--black |
+------------------+------------+----------------------------+-----------------+
| refl | LIST (of | Reflection (specular) | (-1.0 -1.0 |
| | reals) | color as an RGB value | -1.0)--By ACI |
+------------------+------------+----------------------------+-----------------+
| refl-wgt | REAL | Weight factor (reflection | 0.2 |
| | | Value)--the amount of | |
| | | specular color | |
+------------------+------------+----------------------------+-----------------+
| refl-map | LIST | Reflection/environment | None |
| | | map arguments | |
+------------------+------------+----------------------------+-----------------+
| roughness | REAL | Roughness--the size of a | 0.5 |
| | | specular highlight | |
+------------------+------------+----------------------------+-----------------+
| turbulence | INT | Turbulence | 3 |
| | | factor--swirliness of the | |
| | | veins | |
+------------------+------------+----------------------------+-----------------+
| sharpness | REAL | Sharpness factor--the | 1.0 |
| | | amount of blur | |
+------------------+------------+----------------------------+-----------------+
| scale | REAL | Overall scale factor | 0.16 |
+------------------+------------+----------------------------+-----------------+
| bumpmap | LIST | Bumpmap arguments | None |
+------------------+------------+----------------------------+-----------------+
Examples
The following call creates a marble with a pink matrix and black veins:
Granite
The material type string "GRANITE" indicates that you're creating a new granite
material.
Arguments
The following table describes the granite arguments:
+-------------------+------------+---------------------------+-----------------+
| RMAT--Granite arguments |
+-------------------+------------+---------------------------+-----------------+
| Argument | Data type | Description | Default |
+-------------------+------------+---------------------------+-----------------+
https://www.theswamp.org/Sources/doc/avlisp/#trans 296/300
5/8/23, 12:24 PM Auto/Visual lisp help
| first-color | LIST (of | RGB value | (-1.0 -1.0 |
| | reals) | | -1.0)--white |
+-------------------+------------+---------------------------+-----------------+
| amount1 | REAL | Weight factor (color | 1.0 |
| | | Value) for first color | |
+-------------------+------------+---------------------------+-----------------+
| second-color | LIST (of | RGB value | (0.5 0.5 |
| | reals) | | 0.5)--dark gray |
+-------------------+------------+---------------------------+-----------------+
| amount2 | REAL | Weight factor (color | 1.0 |
| | | Value) for second color | |
+-------------------+------------+---------------------------+-----------------+
| third-color | LIST (of | RGB value | (0.0 0.0 |
| | reals) | | 0.0)--black |
+-------------------+------------+---------------------------+-----------------+
| amount3 | REAL | Weight factor (color | 1.0 |
| | | Value) for third color | |
+-------------------+------------+---------------------------+-----------------+
| fourth-color | LIST (of | RGB value | (0.7 0.7 |
| | reals) | | 0.7)--light |
| | | | gray |
+-------------------+------------+---------------------------+-----------------+
| amount4 | REAL | Weight factor (color | 1.0 |
| | | Value) for fourth color | |
+-------------------+------------+---------------------------+-----------------+
| refl | LIST (of | Reflection (specular) | (-1.0 -1.0 |
| | reals) | color as an RGB value | -1.0)--By ACI |
+-------------------+------------+---------------------------+-----------------+
| refl-weight | REAL | Weight factor | 0.2 |
| | | (reflection Value)--the | |
| | | amount of specular color | |
+-------------------+------------+---------------------------+-----------------+
| refl-map | LIST | Reflection/environment | None |
| | | map arguments | |
+-------------------+------------+---------------------------+-----------------+
| roughness | REAL | Roughness--the size of a | 0.5 |
| | | specular highlight | |
+-------------------+------------+---------------------------+-----------------+
| sharpness | REAL | Sharpness factor--the | 1.0 |
| | | amount of blur | |
+-------------------+------------+---------------------------+-----------------+
| scale | REAL | Overall scale factor | 0.16 |
+-------------------+------------+---------------------------+-----------------+
| bumpmap | LIST | Bumpmap arguments | None |
+-------------------+------------+---------------------------+-----------------+
Examples
Create a granite without dark gray, with more black, and with yellow instead of
light gray:
nil 0.5 nil 0.0 nil 0.85 '(1.0 1.0 0.0) 0.6)
Wood
The material type string "WOOD" indicates that you're creating a new wood
material.
Arguments
The following table describes the wood arguments:
+------------------+------------+----------------------------+-----------------+
| RMAT--Wood arguments |
+------------------+------------+----------------------------+-----------------+
| Argument | Data type | Description | Default |
+------------------+------------+----------------------------+-----------------+
| light-color | LIST (of | RGB value specifying the | (0.6 0.4 0.3) |
| | reals) | color of the light rings | |
+------------------+------------+----------------------------+-----------------+
| dark-color | LIST (of | RGB value specifying the | (0.3 0.2 |
| | reals) | color of the dark rings | 0.2)--black |
+------------------+------------+----------------------------+-----------------+
| refl | LIST (of | Reflection (specular) | (-1.0 -1.0 |
| | reals) | color as an RGB value | -1.0)--By ACI |
+------------------+------------+----------------------------+-----------------+
| refl-weight | REAL | Weight factor (reflection | 0.2 |
| | | Value)--the amount of | |
| | | specular color | |
+------------------+------------+----------------------------+-----------------+
https://www.theswamp.org/Sources/doc/avlisp/#trans 297/300
5/8/23, 12:24 PM Auto/Visual lisp help
| refl-map | LIST | Reflection/environment | None |
| | | map arguments | |
+------------------+------------+----------------------------+-----------------+
| roughness | REAL | Roughness--the size of a | 0.5 |
| | | specular highlight | |
+------------------+------------+----------------------------+-----------------+
| ratio | REAL | Ratio of light to dark | 0.5 |
| | | rings | |
+------------------+------------+----------------------------+-----------------+
| density | REAL | Density of the rings | 6.0 |
+------------------+------------+----------------------------+-----------------+
| width | REAL | Ring width variation | 0.2 |
+------------------+------------+----------------------------+-----------------+
| shape | REAL | Ring shape variation | 0.2 |
+------------------+------------+----------------------------+-----------------+
| scale | REAL | Overall scale factor | 0.16 |
+------------------+------------+----------------------------+-----------------+
| bumpmap | LIST | Bumpmap arguments | None |
+------------------+------------+----------------------------+-----------------+
Examples
Create a wood with an irregular grain:
(c:rmat "N" "CRYPTO" "WOOD" nil nil nil nil nil nil nil nil nil 0.56)
Bitmap Arguments
The arguments to specify a bitmap are passed to a list, which you can include
as a sublist in the c:rmat call (this is the form shown at the beginning of
each of the following sections) or assign to a symbol before you call c:rmat.
Pattern/Texture
Arguments
The following table describes the pattern/texture arguments:
+--------------------+-----------+---------------------------------+-----------+
| Pattern/texture arguments |
+--------------------+-----------+---------------------------------+-----------+
| Argument | Data type | Description | Default |
+--------------------+-----------+---------------------------------+-----------+
| name | STR | Name of the bitmap file | None |
+--------------------+-----------+---------------------------------+-----------+
| blend | REAL | Amount of map color to use | 1.0 |
+--------------------+-----------+---------------------------------+-----------+
| repeat | INT | Whether to repeat (tile) the | 0 |
| | | bitmap:0--no tiling (crop) | |
| | | 1--tile (repeat pattern) | |
+--------------------+-----------+---------------------------------+-----------+
| scale | LIST (of | U and V scale factors | (1.0 1.0) |
| | reals) | | |
+--------------------+-----------+---------------------------------+-----------+
| offset | LIST (of | U and V offsets | (0.0 0.0) |
| | reals) | | |
+--------------------+-----------+---------------------------------+-----------+
| reserved | REAL | Reserved placeholder | None |
+--------------------+-----------+---------------------------------+-----------+
| map-style | INT | Whether the map style | 0 |
| | | is:0--fixed scale1--fit to | |
| | | entity | |
+--------------------+-----------+---------------------------------+-----------+
| auto-axis | INT | Whether or not Auto Axis is | 1 |
| | | enabled:0--disabled1--enabled | |
+--------------------+-----------+---------------------------------+-----------+
Reflection/Environment
Arguments
+------------------------------+-----------+-------------------------+---------+
| Reflection/environment arguments |
+------------------------------+-----------+-------------------------+---------+
| Argument | Data type | Description | Default |
+------------------------------+-----------+-------------------------+---------+
| name | STR | Name of the bitmap file | None |
+------------------------------+-----------+-------------------------+---------+
| blend | REAL | Amount of map color to | 1.0 |
| | | use | |
https://www.theswamp.org/Sources/doc/avlisp/#trans 298/300
5/8/23, 12:24 PM Auto/Visual lisp help
+------------------------------+-----------+-------------------------+---------+
| mirror | REAL | Whether to generate | 0 |
| | | mirrored | |
| | | reflections:0--no | |
| | | mirror | |
| | | 1--mirrorDuring | |
| | | mirror, generates | |
| | | raytraced reflections; | |
| | | during scanline, uses | |
| | | environment map for | |
| | | reflections | |
+------------------------------+-----------+-------------------------+---------+
Opacity
Arguments
The following table describes the opacity arguments:
+----------------+-------------+-----------------------------------+-----------+
| Opacity arguments |
+----------------+-------------+-----------------------------------+-----------+
| Argument | Data type | Description | Default |
+----------------+-------------+-----------------------------------+-----------+
| name | STR | Name of the bitmap file | None |
+----------------+-------------+-----------------------------------+-----------+
| blend | REAL | Amount of map color to use | 1.0 |
+----------------+-------------+-----------------------------------+-----------+
| repeat | INT | Whether to repeat (tile) the | 0 |
| | | bitmap:0--no tiling (crop) | |
| | | 1--tile (repeat pattern) | |
+----------------+-------------+-----------------------------------+-----------+
| scale | LIST (of | U and V scale factors | (1.0 1.0) |
| | reals) | | |
+----------------+-------------+-----------------------------------+-----------+
| offset | LIST (of | U and V offsets | (0.0 0.0) |
| | reals) | | |
+----------------+-------------+-----------------------------------+-----------+
| reserved | REAL | Reserved placeholder | None |
+----------------+-------------+-----------------------------------+-----------+
| map-style | INT | Whether the map style | 0 |
| | | is:0--fixed scale1--fit to entity | |
+----------------+-------------+-----------------------------------+-----------+
| auto-axis | INT | Whether or not Auto Axis is | 1 |
| | | enabled:0--disabled1--enabled | |
+----------------+-------------+-----------------------------------+-----------+
Bump Map
+----------------+-------------+-----------------------------------+-----------+
| Bump arguments |
+----------------+-------------+-----------------------------------+-----------+
| Argument | Data type | Description | Default |
+----------------+-------------+-----------------------------------+-----------+
| name | STR | Name of the bitmap file | None |
+----------------+-------------+-----------------------------------+-----------+
| amplitude | REAL | Degree of bumpiness | 1.0 |
+----------------+-------------+-----------------------------------+-----------+
| repeat | INT | Whether to repeat (tile) the | 0 |
| | | bitmap:0--no tiling (crop) | |
| | | 1--tile (repeat pattern) | |
+----------------+-------------+-----------------------------------+-----------+
| scale | LIST (of | U and V scale factors | (1.0 1.0) |
| | reals) | | |
+----------------+-------------+-----------------------------------+-----------+
| offset | LIST (of | U and V offsets | (0.0 0.0) |
| | reals) | | |
+----------------+-------------+-----------------------------------+-----------+
| reserved | REAL | Reserved placeholder | None |
+----------------+-------------+-----------------------------------+-----------+
| map-style | INT | Whether the map style | 0 |
| | | is:0--fixed scale1--fit to entity | |
+----------------+-------------+-----------------------------------+-----------+
| auto-axis | INT | Whether or not Auto Axis is | 1 |
| | | enabled:0--disabled1--enabled | |
+----------------+-------------+-----------------------------------+-----------+
-------------------------------------------------------------------------------
https://www.theswamp.org/Sources/doc/avlisp/#trans 299/300
5/8/23, 12:24 PM Auto/Visual lisp help
solprof
Arguments
args
The order, number, and type of arguments are the same as those specified when
issuing SOLPROF at the Command prompt.
https://www.theswamp.org/Sources/doc/avlisp/#trans 300/300