Sie sind auf Seite 1von 297

Auto/VisualLispHelp

Creator:JohnKaul
Maintainer:theswamp.org
LastUpdated:04.12.128:57:47AM
==========
Operators
==========
(add)
(subtract)
(*)
(divide)
(equalto)
(notequalto)
(lessthan)
(lessthanorequalto)
(greaterthan)
(greaterthanorequalto)
(bitwiseNOT)
(increment)
(decrement)
============
AFunctions
============
abs
acad_colordlg
acad_helpdlg
acad_strlsort
acdimenableupdate
acetattsync
acetlayerpmode
acetlayerpmark
acetlaytrans
acetmstops
acetpstoms
action_tile
add_list
alert
alloc
and
angle
angtof
angtos
append
apply
arx
arxload
arxunload
ascii
assoc
atan
atof
atoi
atom
atomsfamily
autoarxload
autoload
============
BFunctions
============
Boole
boundp
============
CFunctions
============
caddr
cadr
car
cdr
chr
client_data_tile
close
command
cond
cons
cos
cvunit
============
DFunctions
============
defun
defunq
defunqlistref

defunqlistset
dictadd
dictnext
dictremove
dictrename
dictsearch
dimx_tile
dimy_tile
distance
distof
done_dialog
============
EFunctions
============
end_image
end_list
entdel
entget
entlast
entmake
entmakex
entmod
entnext
entsel
entupd
eq
equal
error_function(*error*)
eval
exit
exp
expand
expt
============
FFunctions
============
fill_image
findfile
fix
float
foreach
function
============
GFunctions
============
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
============
HFunctions
============
handent
help
============
IFunctions
============
if
initdia
initget
inters
itoa
============
LFunctions
============

lambda
last
layoutlist
length
list
listp
load
load_dialog
log
logand
logior
lsh
============
MFunctions
============
mapcar
max
mem
member
menucmd
menugroup
min
minusp
mode_tile
============
NFunctions
============
namedobjdict
nentsel
nentselp
new_dialog
not
nth
null
numberp
============
OFunctions
============
open
or
osnap
============
PFunctions
============
polar
prin1
princ
print
progn
prompt
============
QFunctions
============
quit
quote
============
RFunctions
============
read
readchar
readline
redraw
regapp
rem
repeat
reverse
rtos
============
SFunctions
============
set
set_tile
setcfg
setenv
setfunhelp
setq
setvar
setview
sin
slide_image
snvalid
sqrt
ssadd
ssdel
ssget

ssgetfirst
sslength
ssmemb
ssname
ssnamex
sssetfirst
startapp
start_dialog
start_image
start_list
strcase
strcat
strlen
subst
substr
============
TFunctions
============
tablet
tblnext
tblobjname
tblsearch
term_dialog
terpri
textbox
textpage
textscr
trace
trans
type
============
UFunctions
============
unload_dialog
untrace
============
VFunctions
============
vector_image
ver
vlacaddefun
vlacadundefun
vlarximport
vlbbref
vlbbset
vlcatchallapply
vlcatchallerrormessage
vlcatchallerrorp
vlcmdf
vlconsp
vlcopyobjects
vldirectoryfiles
vldocexport
vldocimport
vldocref
vldocset
vlevery
vlexitwitherror
vlexitwithvalue
vlfilecopy
vlfiledelete
vlfiledirectoryp
vlfilerename
vlfilesize
vlfilesystime
vlfilenamebase
vlfilenamedirectory
vlfilenameextension
vlfilenamemktemp
vlgetresource
vllist_star(vllist*)
vllist>string
vllistexportedfunctions
vllistlength
vllistloadedvlx
vlloadall
vlloadcom
vlloadreactors
vlmemberif
vlmemberifnot
vlposition
vlprin1tostring
vlprinctostring
vlpropagate
vlregistrydelete

vlregistrydescendents
vlregistryread
vlregistrywrite
vlremove
vlremoveif
vlremoveifnot
vlsome
vlsort
vlsorti
vlstring>list
vlstringelt
vlstringlefttrim
vlstringmismatch
vlstringposition
vlstringrighttrim
vlstringsearch
vlstringsubst
vlstringtranslate
vlstringtrim
vlsymbolname
vlsymbolvalue
vlsymbolp
vlunloadvlx
vlvbaload
vlvbarun
vlvlxloadedp
vlax3Dpoint
vlaxaddcmd
vlaxcreateobject
vlaxcurvegetArea
vlaxcurvegetClosestPointTo
vlaxcurvegetClosestPointToProjection
vlaxcurvegetDistAtParam
vlaxcurvegetDistAtPoint
vlaxcurvegetEndParam
vlaxcurvegetEndPoint
vlaxcurvegetFirstDeriv
vlaxcurvegetParamAtDist
vlaxcurvegetParamAtPoint
vlaxcurvegetPointAtDist
vlaxcurvegetPointAtParam
vlaxcurvegetSecondDeriv
vlaxcurvegetStartParam
vlaxcurvegetStartPoint
vlaxcurveisClosed
vlaxcurveisPeriodic
vlaxcurveisPlanar
vlaxdumpobject
vlaxename>vlaobject
vlaxerasedp
vlaxfor
vlaxgetacadobject
vlaxgetobject
vlaxgetorcreateobject
vlaxgetproperty
vlaximporttypelibrary
vlaxinvokemethod
vlaxldatadelete
vlaxldataget
vlaxldatalist
vlaxldataput
vlaxldatatest
vlaxmakesafearray
vlaxmakevariant
vlaxmapcollection
vlaxmethodapplicablep
vlaxobjectreleasedp
vlaxproductkey
vlaxpropertyavailablep
vlaxputproperty
vlaxreadenabledp
vlaxreleaseobject
vlaxremovecmd
vlaxsafearrayfill
vlaxsafearraygetdim
vlaxsafearraygetelement
vlaxsafearraygetlbound
vlaxsafearraygetubound
vlaxsafearrayputelement
vlaxsafearraytype
vlaxsafearray>list
vlaxtmatrix
vlaxtypeinfoavailablep
vlaxvariantchangetype
vlaxvarianttype

vlaxvariantvalue
vlaxvlaobject>ename
vlaxwriteenabledp
vlispcompile
vlracdbreactor
vlradd
vlraddedp
vlrbeepreaction
vlrcommandreactor
vlrcurrentreactionname
vlrdata
vlrdataset
vlrdeepclonereactor
vlrdocmanagerreactor
vlrdwgreactor
vlrdxfreactor
vlreditorreactor
vlrinsertreactor
vlrlinkerreactor
vlrlispreactor
vlrmiscellaneousreactor
vlrmousereactor
vlrnotification
vlrobjectreactor
vlrowneradd
vlrownerremove
vlrowners
vlrpers
vlrperslist
vlrpersp
vlrpersrelease
vlrreactionname
vlrreactionset
vlrreactions
vlrreactors
vlrremove
vlrremoveall
vlrsetnotification
vlrsysvarreactor
vlrtoolbarreactor
vlrtracereaction
vlrtype
vlrtypes
vlrundoreactor
vlrwblockreactor
vlrwindowreactor
vlrxrefreactor
vports
============
WFunctions
============
wcmatch
while
writechar
writeline
============
XFunctions
============
xdroom
xdsize
============
ZFunctions
============
zerop
===========================
ExternallyDefinedCommands
===========================
3dsin
3dsout
align
cal
fog
light
lsedit
lslib
lsnew
matlib
mirror3d
render
renderupdate
replay
rmat
rotate3d
rpref
saveimg

scene
setuv
showmat
solprof
stats
==================================Operators==================================

+(add)
Returnsthesumofallnumbers
(+[numbernumber]...)

Arguments
number
Anumber.

ReturnValues
Theresultoftheaddition.Ifyousupplyonlyonenumberargument,this
functionreturnstheresultofaddingittozero.Ifyousupplynoarguments,
thefunctionreturns0.

Examples
(+12)returns3
(+1234.5)returns10.5
(+1234.0)returns10.0

(subtract)
Subtractsthesecondandfollowingnumbersfromthefirstandreturnsthe
difference
([numbernumber]...)

Arguments
number
Anumber.

ReturnValues
Theresultofthesubtraction.Ifyousupplymorethantwonumberarguments,
thisfunctionreturnstheresultofsubtractingthesumofthesecondthrough
thelastnumbersfromthefirstnumber.Ifyousupplyonlyonenumberargument,
thisfunctionsubtractsthenumberfromzero,andreturnsanegativenumber.
Supplyingnoargumentsreturns0.

Examples
(5040)returns10
(5040.0)returns10.0
(5040.02.5)returns7.5
(8)returns8

multiply
Returnstheproductofallnumbers

(*[numbernumber]...)

Arguments
number
Anumber.

ReturnValues
Theresultofthemultiplication.Ifyousupplyonlyonenumberargument,this
functionreturnstheresultofmultiplyingitbyoneitreturnsthenumber.
Supplyingnoargumentsreturns0.

Examples
(*23)returns6
(*23.0)returns6.0
(*234.0)returns24.0
(*34.5)returns13.5
(*3)returns3

/(divide)
Dividesthefirstnumberbytheproductoftheremainingnumbersandreturns
thequotient
(/[numbernumber]...)

Arguments
number
Anumber.

ReturnValues
Theresultofthedivision.Ifyousupplymorethantwonumberarguments,this
functiondividesthefirstnumberbytheproductofthesecondthroughthelast
numbers,andreturnsthefinalquotient.Ifyousupplyonenumberargument,
thisfunctionreturnstheresultofdividingitbyoneitreturnsthenumber.
Supplyingnoargumentsreturns0.

Examples
(/1002)returns50
(/1002.0)returns50.0
(/10020.02)returns2.5
(/100202)returns2
(/4)returns4

=(equalto)
Comparesargumentsfornumericalequality
(=numstr[numstr]...)

Arguments
numstr
Anumberorastring.

ReturnValues

T,ifallargumentsarenumericallyequal,nilotherwise.Ifonlyoneargument
issupplied,=returnsT.

Examples
(=44.0)returnsT
(=20388)returnsnil
(=2.42.42.4)returnsT
(=499499500)returnsnil
(="me""me")returnsT
(="me""you")returnsnil
SeeAlso
Theeqandequalfunctions.

/=(notequalto)
Comparesargumentsfornumericalinequality
(/=numstr[numstr]...)

Arguments
numstr
Anumberorastring.

ReturnValues
T,ifnotwosuccessiveargumentsarethesameinvalue,nilotherwise.Ifonly
oneargumentissupplied,/=returnsT.

Notethatthebehaviorof/=doesnotquiteconformtootherLISPdialects.The
standardbehavioristoreturnTifnotwoargumentsinthelisthavethesame
value.InAutoLISP,/=returnsTifnosuccessiveargumentshavethesame
valueseetheexamplesthatfollow.

Examples
(/=1020)returnsT
(/="you""you")returnsnil
(/=5.435.44)returnsT
(/=1020102020)returnsnil
(/=10201020)returnsT

Noteinthelastexamplethatalthoughtherearetwoargumentsinthelistwith
thesamevalue,theydonotfollowoneanother,andthus/=evaluatestoT.

<(lessthan)
ReturnsTifeachargumentisnumericallylessthantheargumenttoitsright,
andreturnsnilotherwise
(<numstr[numstr]...)

Arguments
numstr
Anumberorastring.

ReturnValues

T,ifeachargumentisnumericallylessthantheargumenttoitsright,and
returnsnilotherwise.Ifonlyoneargumentissupplied,<returnsT.

Examples
(<1020)returnsT
(<"b""c")returnsT
(<35733.2)returnsnil
(<2388)returnsT
(<2344)returnsnil

<=(lessthanorequalto)
ReturnsTifeachargumentisnumericallylessthanorequaltotheargumentto
itsright,andreturnsnilotherwise
(<=numstr[numstr]...)

Arguments
numstr
Anumberorastring.

ReturnValues
T,ifeachargumentisnumericallylessthanorequaltotheargumenttoits
right,andreturnsnilotherwise.Ifonlyoneargumentissupplied,<=returns
T.

Examples
(<=1020)returnsT
(<="b""b")returnsT
(<=35733.2)returnsnil
(<=299)returnsT
(<=2945)returnsnil

>(greaterthan)
ReturnsTifeachargumentisnumericallygreaterthantheargumenttoits
right,andreturnsnilotherwise
(>numstr[numstr]...)

Arguments
numstr
Anumberorastring.

ReturnValues
T,ifeachargumentisnumericallygreaterthantheargumenttoitsright,and
nilotherwise.Ifonlyoneargumentissupplied,>returnsT.

Examples
(>12017)returnsT
(>"c""b")returnsT
(>3.51792)returnsnil
(>7742)returnsT

(>7744)returnsnil

>=
(greaterthanorequalto)
ReturnsTifeachargumentisnumericallygreaterthanorequaltotheargument
toitsright,andreturnsnilotherwise
(>=numstr[numstr]...)

Arguments
numstr
Anumberorastring.

ReturnValues
T,ifeachargumentisnumericallygreaterthanorequaltotheargumenttoits
right,andnilotherwise.Ifonlyoneargumentissupplied,>=returnsT.

Examples
(>=12017)returnsT
(>="c""c")returnsT
(>=3.51792)returnsnil
(>=7744)returnsT
(>=7749)returnsnil

~(bitwiseNOT)
ReturnsthebitwiseNOT(1'scomplement)oftheargument
(~int)

Arguments
int
Aninteger.

ReturnValues
ThebitwiseNOT(1'scomplement)oftheargument.

Examples
(~3)returns4
(~100)returns101
(~4)returns3

1+(increment)
Incrementsanumberby1
(1+number)

Arguments
number

Anynumber.

ReturnValues
Theargument,increasedby1.

Examples
(1+5)returns6
(1+17.5)returns16.5

1(decrement)
Decrementsanumberby1
(1number)

Arguments
number
Anynumber.

ReturnValues
Theargument,reducedby1.

Examples
(15)returns4
(117.5)returns18.5
================================AFunctions===================================

abs
Returnstheabsolutevalueofanumber
(absnumber)

Arguments
number
Anynumber.

ReturnValues
Theabsolutevalueoftheargument.

Examples
(abs100)returns100
(abs100)returns100
(abs99.25)returns99.25

acad_colordlg
DisplaysthestandardAutoCADcolorselectiondialogbox
(acad_colordlgcolornum[flag])

Arguments

colornum
Anintegerintherange0256(inclusive),specifyingtheAutoCADcolornumber
todisplayastheinitialdefault.
flag
Ifsettonil,disablestheByLayerandByBlockbuttons.Omittingtheflag
argumentorsettingittoanonnilvalueenablestheByLayerandByBlock
buttons.
Acolornumvalueof0defaultstoByBlock,andavalueof256defaultsto
ByLayer.

ReturnValues
Theuserselectedcolornumber,ornil,iftheusercancelsthedialogbox.

Examples
Prompttheusertoselectacolor,anddefaulttogreenifnoneisselected:
(acad_colordlg3)

acad_helpdlg
Invokesthehelpfacility(obsolete)
(acad_helpdlghelpfiletopic)
Thisexternallydefinedfunctionhasbeenreplacedbythebuiltinfunction
help.ItisprovidedforcompatibilitywithpreviousreleasesofAutoCAD.
SeeAlso
Thehelpfunctionforacompletedescriptionofthisfunction.

acad_strlsort
Sortsalistofstringsbyalphabeticalorder
(acad_strlsortlist)

Arguments
list
Thelistofstringstobesorted.

ReturnValues
Thelistinalphabeticalorder.Ifthelistisinvalidorifthereisnot
enoughmemorytodothesort,acad_strlsortreturnsnil.

Examples
Sortalistofabbreviatedmonthnames:
Command:(setqmos'("Jan""Feb""Mar""Apr""May""Jun""Jul""Aug"
"Sep""Oct""Nov""Dec"))
("Jan""Feb""Mar""Apr""May""Jun""Jul""Aug""Sep""Oct""Nov""Dec")
Command:(acad_strlsortmos)
("Apr""Aug""Dec""Feb""Jan""Jul""Jun""Mar""May""Nov""Oct""Sep")

acdimenableupdate

Controlstheautomaticupdatingofassociativedimensions
(acdimenableupdatenil|T)
Theacdimenableupdatefunctionisintendedfordeveloperswhoareediting
geometryanddon'twantthedimensiontobeupdateduntilaftertheeditsare
complete.

Arguments
nil
Associativedimensionswillnotupdate(evenifthegeometryismodified)until
theDIMREGENcommandisentered.
T
Enableautomaticupdatingofassociativedimensionswhenthegeometryis
modified.

ReturnValues
nil

Examples
Disabletheautomaticupdateofassociativedimensionsinthedrawing:
Command:(acdimenableupdatenil)
Enabletheautomaticupdateofassociativedimensionsinthedrawing:
Command:(acdimenableupdateT)

acetattsync
Updatesallinstancesofaspecifiedblockwiththecurrentattribute
definitionoftheblock
(acetattsyncblockname)
ThisfunctionisequivalenttotheAutoCADATTSYNCcommand.

Arguments
blockname
Astringnamingtheblocktobeupdated.Thestringcancontainwildcard
characters.

ReturnValues
T,ifsuccessful,otherwisenil.

Examples
UpdatetheattributedefinitionsofallProductInfoblockinstancesinthe
currentdrawing:
Command:(acetattsync"ProductInfo")
T
Updatetheattributesofallblockswhosenamesbeginwith"Prod:"
Command:(acetattsync"Prod*")
T
Updatetheattributesofallblockswhosenamesbeginwith"Pix:"
Command:(acetattsync"Pix*")
BlocktablecontainsnoattributedblocknamedPix*.nil
SeeAlso

TheATTSYNCcommand.

acetlayerpmode
QueriesandsetstheLAYERPMODEsetting
(acetlayerpmode[status])

Arguments
status
SpecifyingTturnsLAYERPMODEon,enablinglayerchangetracking.Nilturns
LAYERPMODEoff.
Ifthisargumentisnotpresent,acetlayerpmodereturnsthecurrentstatusof
LAYERPMODE.

ReturnValues
TifcurrentstatusofLAYERPMODEison,nilifLAYERPMODEisoff.

Examples
CheckthecurrentstatusofLAYERPMODE:
Command:(acetlayerpmode)
T
TurnLAYERPMODEoff:
Command:(acetlayerpmodenil)
nil
CheckthecurrentstatusofLAYERPMODE:
Command:(acetlayerpmode)
nil
SeeAlso
Thelayerpandlayerpmodecommands.

acetlayerpmark
PlacesbeginningandendingmarksforLayerPreviousrecording
(acetlayerpmark[status])
Theacetlayerpmarkfunctionallowsyoutogroupmultiplelayercommandsinto
asingletransactionsothattheycanbeundonebyissuingLAYERPasingle
time.LAYERPMODEmustbeoninordertosetmarks.

Arguments
status
SpecifyingTsetsabeginmark.Specifyingnilsetsanendmark,clearingthe
beginmark.
Ifstatusisomitted,acetlayerpmarkreturnsthecurrentmarkstatusfor
layersettings.

ReturnValues
Tifabeginmarkisineffect,otherwisenil.

Examples
Thefollowingcodechangeslayer0toblue,andthenmakesseveraladditional

layerchangesbetweenasetofbeginandendmarks.IfyouissueLAYERPafter
runningthiscode,layer0revertsbacktoblue.
(defunTestLayerP()
TurnLAYERPMODEon,ifitisn'talready
(if(not(acetlayerpmode))
(acetlayerpmodeT)
)
Setlayer0tothecolorblue
(command"_.layer""_color""blue""0""")
Setabeginmark
(acetlayerpmarkT)
Issueaseriesoflayercommands,andthensetanendmark
(command"_.layer""_color""green""0""")
(command"_.layer""_thaw""*""")
(command"_.layer""_unlock""*""")
(command"_.layer""_ltype""hidden""0""")
(command"_.layer""_color""red""0""")
Setanendmark
(acetlayerpmarknil)
)
SeeAlso
TheLAYERPcommand.

acetlaytrans
Translatesdrawinglayerstostandardsdefinedinanotherdrawingorstandards
file
(acetlaytrans"filename"[settings])

Arguments
filename
Astringspecifyingafilecontaininglayermappingstobeusedfor
translation.
settings
AbitcodedintegerspecifyingLayerTranslatorprocessingoptions.Thebits
canbeaddedtogetherinanycombinationtoformavaluebetween0and15.If
thesettingsargumentisomitted,avalueof15(alloptionsselected)is
assumed.Thebitvaluesareasfollows:
0Nooptions
1ForceentitycolortoBYLAYER
2ForceentitylinetypetoBYLAYER
4Translateobjectsinblocks
8Writetransactionlog

ReturnValues
Tiftranslationissuccessful,otherwisenil.

Examples

Thefollowingcommandtranslatesthecurrentdrawingusinglayermappingssaved
inLayMap.dwg.Notransactionlogwillbeproduced,butallotherprocessing
optionswillbeineffect.
Command:(acetlaytrans"c:/mydocuments/caddrawings/LayMap.dwg"7)
T

acetmstops
Convertsarealvaluefrommodelspaceunitstopaperspaceunits.
(acetmstops[value][viewport])
Ifboththevalueandviewportargumentsarespecified,thevalueisconverted
tomodelspaceunitsusingthespecifiedviewport.Nouserinputisrequired.
Ifonlythevalueargumentisspecified,thecurrentviewportisassumedandno
userinputisrequired.However,ifthecurrentspaceismodelspace,thereis
nocurrentviewportandthefunctionwillfail(returningnil).Ifpaperspace
isthecurrentspace,thefunctionwilleitherpromptforaviewportifmore
thanoneviewportexistsinthecurrentpaperspacelayout,orusethesingle
existingviewport.
Ifnoargumentsarespecified,thefunctionpromptsforavalueandconvertsit
ifpossible.

Arguments
value
Arealvaluetobeconverted.
viewport
Aviewportentityname(ads_name).

ReturnValues
Theconvertedrealvalueonsuccess,nilonfailure.

acetpstoms
Convertsarealvaluefrompaperspaceunitstomodelspaceunits.
(acetpstoms[value][viewport])
Ifboththevalueandviewportargumentsarespecified,thevalueisconverted
tomodelspaceunitsusingthespecifiedviewport.Nouserinputisrequired.
Ifonlythevalueargumentisspecified,thecurrentviewportisassumedandno
userinputisrequired.However,ifthecurrentspaceismodelspace,thereis
nocurrentviewportandthefunctionwillfail(returningnil).Ifpaperspace
isthecurrentspace,thefunctionwilleitherpromptforaviewportifmore
thanoneviewportexistsinthelayout,orusethesingleexistingviewport.
Ifnoargumentsarespecified,thefunctionpromptsforavalueandconvertsit
ifpossible.

Arguments
value
Arealvaluetobeconverted.
viewport
Aviewportentityname(ads_name).

ReturnValues

Theconvertedrealvalueonsuccess,nilonfailure.

action_tile
Assignsanactiontoevaluatewhentheuserselectsthespecifiedtileina
dialogbox
(action_tilekeyactionexpression)
Theactionassignedbyaction_tilesupersedesthedialogbox'sdefaultaction
(assignedbynew_dialog)orthetile'sactionattribute,iftheseare
specified.Theexpressioncanrefertothetile'scurrentvalueas$value,its
nameas$key,itsapplicationspecificdata(assetbyclient_data_tile)as
$data,itscallbackreasonas$reason,anditsimagecoordinates(ifthetile
isanimagebutton)as$xand$y.

Arguments
key
Astringthatnamesthetilethattriggerstheaction(specifiedasitskey
attribute).Thisargumentiscasesensitive.
actionexpression
Astringnamingtheexpressionevaluatedwhenthetileisselected.

Note:YoucannotcalltheAutoLISPcommandfunctionfromtheaction_tile
function.

ReturnValues
T

Examples
Ifedit1isatextbox,theactionexpressioninthefollowingaction_tilecall
isevaluatedwhentheuserexitsthetextbox:
(action_tile"edit1""(setqns$value)")
SeeAlso
TheDefaultandDCLActionstopicintheVisualLISPDeveloper'sGuide.

add_list
Addsormodifiesastringinthecurrentlyactivedialogboxlist
(add_liststring)
Beforeusingadd_list,youmustopenthelistandinitializeitwithacallto
start_list.Dependingontheoperationspecifiedinstart_list,thestringis
eitheraddedtothecurrentlistorreplacesthecurrentlistitem.

Arguments
string
Astring.

ReturnValues
Returnsthestringaddedtothelist,ifsuccessful,nilotherwise.

Examples
AssumingthecurrentlyactiveDCLfilehasapopup_listorlist_boxwithakey
oflonglist,thefollowingcodefragmentinitializesthelistandaddstoit
thetextstringsinllist.
(setqllist'("firstline""secondline""thirdline"))

(start_list"longlist")
(mapcar'add_listllist)
(end_list)
Afterthelisthasbeendefined,thefollowingcodefragmentchangesthetext
inthesecondlineto"2ndline".
(start_list"longlist"10)
(add_list"2ndline")
(end_list)
SeeAlso
Thestart_listandend_listfunctions.

alert
Displaysadialogboxcontaininganerrororwarningmessage
(alertstring)

Arguments
string
Thestringtoappearinthealertbox.

ReturnValues
nil

Examples
Displayamessageinanalertbox:
(alert"Thatfunctionisnotavailable.")
Displayamultiplelinemessage,byusingthenewlinecharacterinstring:
(alert"Thatfunction\nisnotavailable.")

Note:Linelengthandthenumberoflinesinanalertboxareplatform,
device,andwindowdependent.AutoCADtruncatesanystringthatistoolongto
fitinsideanalertbox.

alloc
Setsthesizeofthesegmenttobeusedbytheexpandfunction
(allocnalloc)

Arguments
nalloc
Anintegerindicatingtheamountofmemorytobeallocated.Theinteger
representsthenumberofsymbols,strings,usubrs,reals,andconscells.

ReturnValues
Theprevioussettingofnalloc.

Examples
_$(alloc100)
1000
SeeAlso

Theexpandfunction.

and
ReturnsthelogicalANDofthesuppliedarguments
(and[expr...])

Arguments
expr
Anyexpression.

ReturnValues
Nil,ifanyoftheexpressionsevaluatetonil,otherwiseT.Ifandisissued
withoutarguments,itreturnsT.

Examples
Command:(setqa103bnilc"string")
"string"
Command:(and1.4ac)
T
Command:(and1.4abc)
nil

angle
Returnsanangleinradiansofalinedefinedbytwoendpoints
(anglept1pt2)

Arguments
pt1
Anendpoint.
pt2
Anendpoint.

ReturnValues
Anangle,inradians.
TheangleismeasuredfromtheXaxisofthecurrentconstructionplane,in
radians,withanglesincreasinginthecounterclockwisedirection.If3Dpoints
aresupplied,theyareprojectedontothecurrentconstructionplane.

Examples
Command:(angle'(1.01.0)'(1.04.0))
1.5708
Command:(angle'(5.01.33)'(2.41.33))
3.14159
SeeAlso
TheAngularConversiontopicintheVisualLISPDeveloper'sGuide.

angtof
Convertsastringrepresentinganangleintoareal(floatingpoint)valuein
radians
(angtofstring[units])

Arguments
string
Astringdescribingananglebasedontheformatspecifiedbythemode
argument.Thestringmustbeastringthatangtofcanparsecorrectlytothe
specifiedunit.Itcanbeinthesameformthatangtosreturns,orinaform
thatAutoCADallowsforkeyboardentry.
units
Specifiestheunitsinwhichthestringisformatted.Thevalueshould
correspondtovaluesallowedfortheAutoCADsystemvariableAUNITS.Ifunitis
omitted,angtofusesthecurrentvalueofAUNITS.Thefollowingunitsmaybe
specified:
0Degrees
1Degrees/minutes/seconds
2Grads
3Radians
4Surveyor'sunits

ReturnValues
Arealvalue,ifsuccessful,otherwisenil.
Theangtofandangtosfunctionsarecomplementary:ifyoupassangtofastring
createdbyangtos,angtofisguaranteedtoreturnavalidvalue,andviceversa
(assumingtheunitvaluesmatch).

Examples
Command:(angtof"45.0000")
0.785398
Command:(angtof"45.0000"3)
1.0177
SeeAlso
Theangtosfunction.

angtos
Convertsanangularvalueinradiansintoastring
(angtosangle[unit[precision]])

Arguments
angle
Arealnumber,inradians.
unit
Anintegerthatspecifiestheangularunits.Ifunitisomitted,angtosuses
thecurrentvalueoftheAutoCADsystemvariableAUNITS.Thefollowingunits
maybespecified:
0Degrees
1Degrees/minutes/seconds

2Grads
3Radians
4Surveyor'sunits
precision
Anintegerspecifyingthenumberofdecimalplacesofprecisiontobereturned.
Ifomitted,angtosusesthecurrentsettingoftheAutoCADsystemvariable
AUPREC.
Theangtosfunctiontakesangleandreturnsiteditedintoastringaccording
tothesettingsofunit,precision,theAutoCADUNITMODEsystemvariable,and
theDIMZINdimensioningvariable.
Theangtosfunctionacceptsanegativeangleargument,butalwaysreducesitto
apositivevaluebetweenzeroand2piradiansbeforeperformingthespecified
conversion.
TheUNITMODEsystemvariableaffectsthereturnedstringwhensurveyor'sunits
areselected(aunitvalueof4).IfUNITMODE=0,spacesareincludedinthe
string(forexample,"N45dE")ifUNITMODE=1,nospacesareincludedinthe
string(forexample,"N45dE").

ReturnValues
Astring,ifsuccessful,otherwisenil.

Examples
Command:(angtos0.78539804)
"45.0000"
Command:(angtos0.78539804)
"315.0000"
Command:(angtos0.7853984)
"S45dE"

Note:Routinesthatusetheangtosfunctiontodisplayarbitraryangles(those
notrelativetothevalueofANGBASE)shouldcheckandconsiderthevalueof
ANGBASE.
SeeAlso
Theangtoffunction,andStringConversionsintheVisualLISPDeveloper's
Guide.

append
Takesanynumberoflistsandappendsthemtogetherasonelist
(append[list...])

Arguments
list
Alist.

ReturnValues
Alistwithallargumentsappendedtotheoriginal.Ifnoargumentsare
supplied,appendreturnsnil.

Examples
Command:(append'(ab)'(cd))
(ABCD)
Command:(append'((a)(b))'((c)(d)))
((A)(B)(C)(D))

apply
Passesalistofargumentsto,andexecutes,aspecifiedfunction
(apply'functionlist)

Arguments
'function
Afunction.Thefunctionargumentcanbeeitherasymbolidentifyingadefun,
oralambdaexpression.
list
Alist.Canbenil,ifthefunctionacceptsnoarguments.

ReturnValues
Theresultofthefunctioncall.

Examples
Command:(apply'+'(123))
6
Command:(apply'strcat'("a""b""c"))
"abc"

arx
ReturnsalistofthecurrentlyloadedObjectARXapplications
(arx)

ReturnValues
AlistofObjectARX(R)applicationfilenamesthepathisnotincludedinthe
filename.

Examples
Command:(arx)
("acadapp.arx""acmted.arx""oleaprot.arx")
SeeAlso
Thearxloadandarxunloadfunctions.

arxload
LoadsanObjectARXapplication
(arxloadapplication[onfailure])

Arguments
application
Aquotedstringoravariablethatcontainsthenameofanexecutablefile.You
canomitthe.arxextensionfromthefilename.
YoumustsupplythefullpathnameoftheObjectARXexecutablefile,unlessthe

fileisinadirectorythatisintheAutoCADSupportFileSearchPath.
onfailure
Anexpressiontobeexecutediftheloadfails.

ReturnValues
Theapplicationname,ifsuccessful.Ifunsuccessfulandtheonfailureargument
issupplied,arxloadreturnsthevalueofthisargument,otherwise,failure
resultsinanerrormessage.
Ifyouattempttoloadanapplicationthatisalreadyloaded,arxloadissuesan
errormessage.YoumaywanttocheckthecurrentlyloadedObjectARX
applicationswiththearxfunctionbeforeusingarxload.

Examples
Loadtheacbrowse.arxfilesuppliedintheAutoCADinstalldirectory:
Command:(arxload"c:/programfiles/AutoCAD/acbrowse.arx")
"c:/programfiles/AutoCAD/acbrowse.arx"
SeeAlso
Thearxunloadfunction.

arxunload
UnloadsanObjectARXapplication
(arxunloadapplication[onfailure])

Arguments
application
Aquotedstringoravariablethatcontainsthenameofafilethatwasloaded
withthearxloadfunction.Youcanomitthe.arxextensionandthepathfrom
thefilename.
onfailure
Anexpressiontobeexecutediftheunloadfails.

ReturnValues
Theapplicationname,ifsuccessful.Ifunsuccessfulandtheonfailureargument
issupplied,arxunloadreturnsthevalueofthisargument,otherwise,failure
resultsinanerrormessage.

NotethatlockedObjectARXapplicationscannotbeunloaded.ObjectARX
applicationsarelockedbydefault.

Examples
Unloadtheacbrowseapplicationthatwasloadedinthearxloadfunction
example:
Command:(arxunload"acbrowse")
"acbrowse"
SeeAlso
Thearxloadfunction.

ascii
ReturnstheconversionofthefirstcharacterofastringintoitsASCII
charactercode(aninteger)

(asciistring)

Arguments
string
Astring.

ReturnValues
Aninteger.

Examples
Command:(ascii"A")
65
Command:(ascii"a")
97
Command:(ascii"BIG")
66

assoc
Searchesanassociationlistforanelementandreturnsthatassociationlist
entry
(assocelementalist)

Arguments
element
Keyofanelementinanassociationlist.
alist
Anassociationlisttobesearched.

ReturnValues
Thealistentry,ifsuccessful.Ifassocdoesnotfindelementasakeyin
alist,itreturnsnil.

Examples
Command:(setqal'((namebox)(width3)(size4.7263)(depth5)))
((NAMEBOX)(WIDTH3)(SIZE4.7263)(DEPTH5))
Command:(assoc'sizeal)
(SIZE4.7263)
Command:(assoc'weightal)
nil

atan
Returnsthearctangentofanumberinradians
(atannum1[num2])

Arguments
num1
Anumber.

num2
Anumber.

ReturnValues
Thearctangentofnum1,inradians,ifonlynum1issupplied.Ifyousupply
bothnum1andnum2arguments,atanreturnsthearctangentofnum1/num2,in
radians.Ifnum2iszero,itreturnsanangleofplusorminus1.570796radians
(+90degreesor90degrees),dependingonthesignofnum1.Therangeof
anglesreturnedispi/2to+pi/2radians.

Examples
Command:(atan1)
0.785398
Command:(atan1.0)
0.785398
Command:(atan0.5)
0.463648
Command:(atan1.0)
0.785398
Command:(atan1.0)
0.785398
Command:(atan2.03.0)
0.588003
Command:(atan2.03.0)
2.55359
Command:(atan1.00.0)
1.5708

atof
Convertsastringintoarealnumber
(atofstring)

Arguments
string
Astringtobeconvertedintoarealnumber.

ReturnValues
Arealnumber.

Examples
Command:(atof"97.1")
97.1
Command:(atof"3")
3.0
Command:(atof"3.9")
3.9

atoi
Convertsastringintoaninteger
(atoistring)

Arguments
string
Astringtobeconvertedintoaninteger.

ReturnValues
Aninteger.

Examples
Command:(atoi"97")
97
Command:(atoi"3")
3
Command:(atoi"3.9")
3
SeeAlso
Theitoafunction.

atom
Verifiesthatanitemisanatom
(atomitem)

Arguments
item
AnyAutoLISPelement.
SomeversionsofLISPdifferintheirinterpretationofatom,sobecareful
whenconvertingfromnonAutoLISPcode.

ReturnValues
Nilifitemisalist,otherwiseT.Anythingthatisnotalistisconsidered
anatom.

Examples
Command:(setqa'(xyz))
(XYZ)
Command:(setqb'a)
A
Command:(atom'a)
T
Command:(atoma)
nil
Command:(atom'b)
T

Command:(atomb)
T
Command:(atom'(abc))
nil

atomsfamily
Returnsalistofthecurrentlydefinedsymbols
(atomsfamilyformat[symlist])

Arguments
format
Anintegervalueof0or1thatdeterminestheformatinwhichatomsfamily
returnsthesymbolnames:
0Returnthesymbolnamesasalist
1Returnthesymbolnamesasalistofstrings
symlist
Alistofstringsthatspecifythesymbolnamesyouwantatomsfamilytosearch
for.

ReturnValues
Alistofsymbols.Ifyouspecifysymlist,thenatomsfamilyreturnsthe
specifiedsymbolsthatarecurrentlydefined,andreturnsnilforthosesymbols
thatarenotdefined.

Examples
Command:(atomsfamily0)
(BNS_PRE_SELFITSTR2LENC:AI_SPHEREALERTDEFUNC:BEXTENDREM_GROUP
B_RESTORE_SYSVARSBNS_CMD_EXITLISPEDFNSPLITL...
ThefollowingcodeverifiesthatthesymbolsCAR,CDR,andXYZaredefined,and
returnsthelistasstrings:
Command:(atomsfamily1'("CAR""CDR""XYZ"))
("CAR""CDR"nil)
ThereturnvalueshowsthatthesymbolXYZisnotdefined.

autoarxload
PredefinescommandnamestoloadanassociatedObjectARXfile
(autoarxloadfilenamecmdlist)
Thefirsttimeauserentersacommandspecifiedincmdlist,AutoCADloadsthe
ObjectARXapplicationspecifiedinfilename,thencontinuesthecommand.
Ifyouassociateacommandwithfilenameandthatcommandisnotdefinedinthe
specifiedfile,AutoCADalertsyouwithanerrormessagewhenyouenterthe
command.

Arguments
filename
Astringspecifyingthe.arxfiletobeloadedwhenoneofthecommandsdefined
bythecmdlistargumentisenteredattheCommandprompt.Ifyouomitthepath

fromfilename,AutoCADlooksforthefileintheSupportFileSearchPath.
cmdlist
Alistofstrings.

ReturnValues
nil

Examples
ThefollowingcodedefinestheC:APP1,C:APP2,andC:APP3functionstoloadthe
bonusapp.arxfile:
(autoarxload"BONUSAPP"'("APP1""APP2""APP3"))

autoload
PredefinescommandnamestoloadanassociatedAutoLISPfile
(autoloadfilenamecmdlist)
Thefirsttimeauserentersacommandspecifiedincmdlist,AutoCADloadsthe
applicationspecifiedinfilename,thencontinuesthecommand.

Arguments
filename
Astringspecifyingthe.lspfiletobeloadedwhenoneofthecommandsdefined
bythecmdlistargumentisenteredattheCommandprompt.Ifyouomitthepath
fromfilename,AutoCADlooksforthefileintheSupportFileSearchPath.
cmdlist
Alistofstrings.

ReturnValues
nil
Ifyouassociateacommandwithfilenameandthatcommandisnotdefinedinthe
specifiedfile,AutoCADalertsyouwithanerrormessagewhenyouenterthe
command.

Examples
ThefollowingcausesAutoCADtoloadthebonusapp.lspfilethefirsttimethe
APP1,APP2,orAPP3commandsareenteredattheCommandprompt:
(autoload"BONUSAPP"'("APP1""APP2""APP3"))
================================BFunctions===================================

Boole
ServesasageneralbitwiseBooleanfunction
(Booleoperatorint1[int2...])

Arguments
operator
Anintegerbetween0and15representingoneofthe16possibleBoolean
functionsintwovariables.
int1,int2...
Integers.

NotethatBoolewillacceptasingleintegerargument,buttheresultis
unpredictable.

Successiveintegerargumentsarebitwise(logically)combinedbasedonthis
functionandonthefollowingtruthtable:
++++
|Booleantruthtable|
++++
|Int1|Int2|operatorbit|
++++
|0|0|8|
++++
|0|1|4|
++++
|1|0|2|
++++
|1|1|1|
++++
Eachbitofint1ispairedwiththecorrespondingbitofint2,specifyingone
horizontalrowofthetruthtable.Theresultingbitiseither0or1,
dependingonthesettingoftheoperatorbitthatcorrespondstothisrowof
thetruthtable.
Iftheappropriatebitissetinoperator,theresultingbitis1otherwise
theresultingbitis0.Someofthevaluesforoperatorareequivalenttothe
standardBooleanoperationsAND,OR,XOR,andNOR.
++++
|Boolefunctionbitvalues|
++++
|Operator|Operation|Resultingbitis1if|
++++
|1|AND|Bothinputbitsare1|
++++
|6|XOR|Onlyoneofthetwoinputbitsis1|
++++
|7|OR|Eitherorbothoftheinputbits|
|||are1|
++++
|8|NOR|Bothinputbitsare0(1's|
|||complement)|
++++

ReturnValues
Aninteger.

Examples
ThefollowingspecifiesalogicalANDofthevalues12and5:
Command:(Boole1125)
4
ThefollowingspecifiesalogicalXORofthevalues6and5:
Command:(Boole665)
3
YoucanuseothervaluesofoperatortoperformotherBooleanoperationsfor
whichtherearenostandardnames.Forexample,ifoperatoris4,theresulting
bitsaresetifthecorrespondingbitsaresetinint2butnotinint1:
Command:(Boole4314)
12

boundp
Verifiesifavalueisboundtoasymbol
(boundpsym)

Arguments
sym
Asymbol.

ReturnValues
Tifsymhasavalueboundtoit.Ifnovalueisboundtosym,orifithas
beenboundtonil,boundpreturnsnil.Ifsymisanundefinedsymbol,itis
automaticallycreatedandisboundtonil.

Examples
Command:(setqa2bnil)
nil
Command:(boundp'a)
T
Command:(boundp'b)
nil
Theatomsfamilyfunctionprovidesanalternativemethodofdeterminingthe
existenceofasymbolwithoutautomaticallycreatingthesymbol.
SeeAlso
Theatomsfamilyfunction.
================================CFunctions===================================

caddr
Returnsthethirdelementofalist
(caddrlist)
InAutoLISP,caddrisfrequentlyusedtoobtaintheZcoordinateofa3Dpoint
(thethirdelementofalistofthreereals).

Arguments
list
Alist.

ReturnValues
Thethirdelementinlistornil,ifthelistisemptyorcontainsfewerthan
threeelements.

Examples
Command:(setqpt3'(5.251.03.0))
(5.251.03.0)
Command:(caddrpt3)
3.0
Command:(caddr'(5.251.0))
nil
SeeAlso
ThePointListstopicintheVisualLISPDeveloper'sGuide.

cadr
Returnsthesecondelementofalist
(cadrlist)
InAutoLISP,cadrisfrequentlyusedtoobtaintheYcoordinateofa2Dor3D

point(thesecondelementofalistoftwoorthreereals).

Arguments
list
Alist.

ReturnValues
Thesecondelementinlist,ornil,ifthelistisemptyorcontainsonlyone
element.

Examples
Command:(setqpt2'(5.251.0))
(5.251.0)
Command:(cadrpt2)
1.0
Command:(cadr'(4.0))
nil
Command:(cadr'(5.251.03.0))
1.0
SeeAlso
ThePointListstopicintheVisualLISPDeveloper'sGuide.

car
Returnsthefirstelementofalist
(carlist)

Arguments
list
Alist.

ReturnValues
Thefirstelementinlistornil,ifthelistisempty.

Examples
Command:(car'(abc))
A
Command:(car'((ab)c))
(AB)
Command:(car'())
nil
SeeAlso
ThePointListstopicintheVisualLISPDeveloper'sGuide.

cdr
Returnsalistcontainingallbutthefirstelementofthespecifiedlist

(cdrlist)

Arguments
list
Alist.

ReturnValues
Alistcontainingalltheelementsoflist,exceptthefirstelement(butsee
Notebelow).Ifthelistisempty,cdrreturnsnil.

Note:Whenthelistargumentisadottedpair,cdrreturnsthesecondelement
withoutenclosingitinalist.

Examples
Command:(cdr'(abc))
(BC)
Command:(cdr'((ab)c))
(C)
Command:(cdr'())
nil
Command:(cdr'(a.b))
B
Command:(cdr'(1."Text"))
"Text"
SeeAlso
ThePointListstopicintheVisualLISPDeveloper'sGuide.

chr
ConvertsanintegerrepresentinganASCIIcharactercodeintoa
singlecharacterstring
(chrinteger)

Arguments
list
Aninteger.

ReturnValues
AstringcontainingtheASCIIcharactercodeforinteger.Iftheintegerisnot
intherangeof1255,thereturnvalueisunpredictable.

Examples
Command:(chr65)
"A"
Command:(chr66)
"B"
Command:(chr97)
"a"

client_data_tile

Associatesapplicationmanageddatawithadialogboxtile
(client_data_tilekeyclientdata)

Arguments
key
Astringthatspecifiesatile.Thisargumentiscasesensitive.
clientdata
Astringtobeassociatedwiththekeytile.Anactionexpressionorcallback
functioncanrefertothestringas$data.

ReturnValues
nil

close
Closesanopenfile
(closefiledesc)

Arguments
filedesc
Afiledescriptorobtainedfromtheopenfunction.

ReturnValues
Niliffiledescisvalid,otherwiseresultsinanerrormessage.
Afteraclose,thefiledescriptorisunchangedbutisnolongervalid.Data
addedtoanopenfileisnotactuallywrittenuntilthefileisclosed.

Examples
Thefollowingcodecountsthenumberoflinesinthefilesomefile.txtandsets
thevariablectequaltothatnumber:
(setqfil"SOMEFILE.TXT")
(setqx(openfil"r")ct0)
(while(readlinex)
(setqct(1+ct))
)
(closex)

command
ExecutesanAutoCADcommand
(command[arguments]...)

Arguments
arguments
AutoCADcommandsandtheiroptions.
Theargumentstothecommandfunctioncanbestrings,reals,integers,or
points,asexpectedbythepromptsequenceoftheexecutedcommand.Anull
string("")isequivalenttopressingENTERonthekeyboard.Invokingcommand
withnoargumentisequivalenttopressingESCandcancelsmostAutoCAD

commands.
ThecommandfunctionevaluateseachargumentandsendsittoAutoCADin
responsetosuccessiveprompts.Itsubmitscommandnamesandoptionsas
strings,2Dpointsaslistsoftworeals,and3Dpointsaslistsofthree
reals.AutoCADrecognizescommandnamesonlywhenitissuesaCommandprompt.

NotethatifyouissuecommandfromVisualLISP,focusdoesnotchangetothe
AutoCADwindow.Ifthecommandrequiresuserinput,you'llseethereturnvalue
(nil)intheConsolewindow,butAutoCADwillbewaitingforinput.Youmust
manuallyactivatetheAutoCADwindowandrespondtotheprompts.Untilyoudo
so,anysubsequentcommandswillfail.

ReturnValues
nil

Examples
Thefollowingexamplesetstwovariablespt1andpt2equaltotwopointvalues
1,1and1,5.ItthenusesthecommandfunctiontoissuetheLINEcommandand
passthetwopointvalues.
Command:(setqpt1'(11)pt2'(15))
(15)
Command:(command"line"pt1pt2"")
lineFrompoint:
Topoint:
Topoint:
Command:nil

RestrictionsandNotes
TheAutoCADSKETCHcommandreadsthedigitizerdirectlyandthereforecannotbe
usedwiththeAutoLISPcommandfunction.IftheSCRIPTcommandisusedwiththe
commandfunction,itshouldbethelastfunctioncallintheAutoLISProutine.
Also,ifyouusethecommandfunctioninanacad.lspor.mnlfile,itshouldbe
calledonlyfromwithinadefunstatement.UsetheS::STARTUPfunctionto
definecommandsthatneedtobeissuedimmediatelywhenyoubeginadrawing
session.
ForAutoCADcommandsthatrequiretheselectionofanobject(liketheBREAK
andTRIMcommands),youcansupplyalistobtainedwithentselinsteadofa
pointtoselecttheobject.Forexamples,seePassingPickPointstoAutoCAD
CommandsintheVisualLISPDeveloper'sGuide.
Commandsexecutedfromthecommandfunctionarenotechoedtothecommandline
iftheCMDECHOsystemvariable(accessiblefromsetvarandgetvar)issetto0.
SeeAlso
ThevlcmdffunctioninthisreferenceandCommandSubmissionintheVisual
LISPDeveloper'sGuide.

cond
ServesastheprimaryconditionalfunctionforAutoLISP
(cond[(testresult...)...])
Thecondfunctionacceptsanynumberoflistsasarguments.Itevaluatesthe
firstitemineachlist(intheordersupplied)untiloneoftheseitems
returnsavalueotherthannil.Itthenevaluatesthoseexpressionsthatfollow
thetestthatsucceeded.

ReturnValues
Thevalueofthelastexpressioninthesublist.Ifthereisonlyone
expressioninthesublist(thatis,ifresultismissing),thevalueofthe
testexpressionisreturned.Ifnoargumentsaresupplied,condreturnsnil.

Examples

Thefollowingexampleusescondtoperformanabsolutevaluecalculation:
(cond
((minuspa)(a))
(ta)
)
Ifthevariableaissettothevalue10,thisreturns10.
Asshown,condcanbeusedasacasetypefunction.ItiscommontouseTas
thelast(default)testexpression.Here'sanothersimpleexample.Givenauser
responsestringinthevariables,thisfunctionteststheresponseandreturns
1ifitisYory,0ifitisNorn,andnilotherwise.
(cond
((=s"Y")1)
((=s"y")1)
((=s"N")0)
((=s"n")0)
(tnil)
)

cons
Addsanelementtothebeginningofalist,orconstructsadottedlist
(consnewfirstelementlistoratom)

Arguments
newfirstelement
Elementtobeaddedtothebeginningofalist.Thiselementcanbeanatomor
alist.
listoratom
Alistoranatom.

ReturnValues
Thevaluereturneddependsonthedatatypeoflistoratom.Iflistoratomis
alist,consreturnsthatlistwithnewfirstelementaddedasthefirstitem
inthelist.Iflistoratomisanatom,consreturnsadottedpairconsisting
ofnewfirstelementandlistoratom.

Examples
Command:(cons'a'(bcd))
(ABCD)
Command:(cons'(a)'(bcd))
((A)BCD)
Command:(cons'a2)
(A.2)
SeeAlso
TheListHandlingtopicintheVisualLISPDeveloper'sGuide.

cos

Returnsthecosineofanangleexpressedinradians
(cosang)

Arguments
ang
Anangle,inradians.

ReturnValues
Thecosineofang,inradians.

Examples
Command:(cos0.0)
1.0
Command:(cospi)
1.0

cvunit
Convertsavaluefromoneunitofmeasurementtoanother
(cvunitvaluefromunittounit)

Arguments
value
Thenumericvalueorpointlist(2Dor3Dpoint)tobeconverted.
fromunit
Theunitthatvalueisbeingconvertedfrom.
tounit
Theunitthatvalueisbeingconvertedto.
Thefromunitandtounitargumentscannameanyunittypefoundinthe
acad.untfile.

ReturnValues
Theconvertedvalue,ifsuccessful,ornil,ifeitherunitnameisunknown(not
foundintheacad.untfile),orifthetwounitsareincompatible(forexample,
tryingtoconvertgramsintoyears).

Examples
Command:(cvunit1"minute""second")
60.0
Command:(cvunit1"gallon""furlong")
nil
Command:(cvunit1.0"inch""cm")
2.54
Command:(cvunit1.0"acre""sqyard")
4840.0
Command:(cvunit'(1.02.5)"ft""in")
(12.030.0)
Command:(cvunit'(123)"ft""in")

(12.024.036.0)

Note:Ifyouhaveseveralvaluestoconvertinthesamemanner,itismore
efficienttoconvertthevalue1.0onceandthenapplytheresultingvalueasa
scalefactorinyourownfunctionorcomputation.Thisworksforallpredefined
unitsexcepttemperature,whereanoffsetisinvolvedaswell.
SeeAlso
TheUnitConversiontopicintheVisualLISPDeveloper'sGuide.
================================DFunctions===================================

defun
Definesafunction
(defunsym([arguments][/variables...])expr...)

Arguments
sym
Asymbolnamingthefunction.
arguments
Thenamesofargumentsexpectedbythefunction.
/variables
Thenamesofoneormorelocalvariablesforthefunction.
Theslashprecedingthevariablenamesmustbeseparatedfromthefirstlocal
nameandfromthelastargument,ifany,byatleastonespace.
expr
AnynumberofAutoLISPexpressionstobeevaluatedwhenthefunctionexecutes.
Ifyoudonotdeclareanyargumentsorlocalsymbols,youmustsupplyanempty
setofparenthesesafterthefunctionname.
Ifduplicateargumentorsymbolnamesarespecified,AutoLISPusesthefirst
occurrenceofeachnameandignoresthefollowingoccurrences.

ReturnValues
Theresultofthelastexpressionevaluated.
Warning!Neverusethenameofabuiltinfunctionorsymbolforthesym
argumenttodefun.Thisoverwritestheoriginaldefinitionandmakesthe
builtinfunctionorsymbolinaccessible.Togetalistofbuiltinand
previouslydefinedfunctions,usetheatomsfamilyfunction.

Examples
(defunmyfunc(xy)...)Functiontakestwoarguments
(defunmyfunc(/ab)...)Functionhastwolocalvariables
(defunmyfunc(x/temp)...)Oneargument,onelocalvariable
(defunmyfunc()...)Noargumentsorlocalvariables
SeeAlso
TheSymbolandFunctionHandlingtopicintheVisualLISPDeveloper'sGuide.

defunq
Definesafunctionasalist
(defunqsym([arguments][/variables...])expr...)

Thedefunqfunctionisprovidedstrictlyforbackwardcompatibilitywith
previousversionsofAutoLISP,andshouldnotbeusedforotherpurposes.You
canusedefunqinsituationswhereyouneedtoaccessafunctiondefinitionas
aliststructure,whichisthewaydefunwasimplementedinprevious,
noncompiledversionsofAutoLISP.

Arguments
sym
Asymbolnamingthefunction.
arguments
Thenamesofargumentsexpectedbythefunction.
/variables
Thenamesofoneormorelocalvariablesforthefunction.
Theslashprecedingthevariablenamesmustbeseparatedfromthefirstlocal
nameandfromthelastargument,ifany,byatleastonespace.
expr
AnynumberofAutoLISPexpressionstobeevaluatedwhenthefunctionexecutes.
Ifyoudonotdeclareanyargumentsorlocalsymbols,youmustsupplyanempty
setofparenthesesafterthefunctionname.
Ifduplicateargumentorsymbolnamesarespecified,AutoLISPusesthefirst
occurrenceofeachnameandignoresthefollowingoccurrences.

ReturnValues
Theresultofthelastexpressionevaluated.

Examples
_$(defunqmystartup(x)(print(listx)))
MYSTARTUP
_$(mystartup5)
(5)(5)
Usedefunqlistreftodisplaytheliststructureofmystartup:
_$(defunqlistref'mystartup)
((X)(PRINT(LISTX)))
SeeAlso
Thedefunqlistrefanddefunqlistset">defunqlistreffunctions.

defunqlistref
Displaystheliststructureoffunctiondefinedwithdefunq
(defunqlistref'function)

Arguments
function
Asymbolnamingthefunction.

ReturnValues
Thelistdefinitionofthefunction,ornil,iftheargumentisnotalist.

Examples
Defineafunctionusingdefunq:
_$(defunqmystartup(x)(print(listx)))

MYSTARTUP
Usedefunqlistreftodisplaytheliststructureofmystartup:
_$(defunqlistref'mystartup)
((X)(PRINT(LISTX)))
SeeAlso
Thedefunqanddefunqlistsetfunctions.

defunqlistset
Setsthevalueofasymboltobeafunctiondefinedbyalist
(defunqlistset'symlist)

Arguments
sym
Asymbolnamingthefunction
list
Alistcontainingtheexpressionstobeincludedinthefunction.

ReturnValues
Thesymdefined.

Examples
_$(defunqlistset'foo'((x)x))
FOO
_$(foo3)
3
Thefollowingexampleillustratestheuseofdefunqlistsettocombinetwo
functionsintoasinglefunction.First,fromtheVisualLISPConsolewindow,
definetwofunctionswithdefunq:
_$(defunqs::startup(x)(printx))
S::STARTUP
_$(defunqmystartup(x)(print(listx)))
MYSTARTUP
Usedefunqlistsettocombinethefunctionsintoasinglefunction:
_$(defunqlistset's::startup(append
(defunqlistref's::startup)
(cdr(defunqlistref'mystartup))))
S::STARTUP
Thefollowingillustrateshowthefunctionsrespondindividually,andhowthe
functionsworkafterbeingcombinedusingdefunqlistset:
_$(defunqfoo(x)(print(list'foox)))
FOO
_$(foo1)
(FOO1)(FOO1)
_$(defunqbar(x)(print(list'barx)))
BAR

_$(bar2)
(BAR2)(BAR2)
_$(defunqlistset
'foo
(append(defunqlistref'foo)
(cdr(defunqlistref'bar))
))
FOO
_$(foo3)
(FOO3)
(BAR3)(BAR3)
SeeAlso
Thedefunqanddefunqlistreffunctions.

dictadd
Addsanongraphicalobjecttothespecifieddictionary
(dictaddenamesymbolnewobj)

Arguments
ename
Nameofthedictionarytheobjectisbeingaddedto.
symbol
Thekeynameoftheobjectbeingaddedtothedictionarysymbolmustbea
uniquenamethatdoesnotalreadyexistinthedictionary.
newobj
Anongraphicalobjecttobeaddedtothedictionary.
Asageneralrule,eachobjectaddedtoadictionarymustbeuniquetothat
dictionary.Thisisspecificallyaproblemwhenaddinggroupobjectstothe
groupdictionary.Addingthesamegroupobjectusingdifferentkeynames
resultsinduplicategroupnames,whichcansendthedictnextfunctionintoan
infiniteloop.

ReturnValues
Theentitynameoftheobjectaddedtothedictionary.

Examples
Theexamplesthatfollowcreateobjectsandaddthemtothenamedobject
dictionary.
Createadictionaryentrylist:
Command:(setqdictionary(list'(0."DICTIONARY")'(100."AcDbDictionary")))
((0."DICTIONARY")(100."AcDbDictionary"))
Createadictionaryobjectusingtheentmakexfunction:
Command:(setqxname(entmakexdictionary))
<Entityname:1d98950>
Addthedictionarytothenamedobjectdictionary:
Command:(setqnewdict(dictadd(namedobjdict)"MY_WAY_COOL_DICTIONARY"xname))

<Entityname:1d98950>
CreateanXrecordlist:
Command:(setqdatalist(append(list'(0."XRECORD")'(100."AcDbXrecord"))
'((1."Thisismydata")(101.2.3.)(70.33))))
((0."XRECORD")(100."AcDbXrecord")(1."Thisismydata")(101.02.03.0)
(70.33))
MakeanXrecordobject:
Command:(setqxname(entmakexdatalist))
<Entityname:1d98958>
AddtheXrecordobjecttothedictionary:
Command:(dictaddnewdict"DATA_RECORD_1"xname)
<Entityname:1d98958>
SeeAlso
Thedictnext,dictremove,dictrename,dictsearch,andnamedobjdictfunctions.

dictnext
Findsthenextiteminadictionary
(dictnextename[rewind])

Arguments
ename
Nameofthedictionarybeingviewed.
rewind
Ifthisargumentispresentandisnotnil,thedictionaryisrewoundandthe
firstentryinitisretrieved.

ReturnValues
Thenextentryinthespecifieddictionary,ornil,whentheendofthe
dictionaryisreached.Entriesarereturnedaslistsofdottedpairsof
DXFtypecodesandvalues.Deleteddictionaryentriesarenotreturned.
Thedictsearchfunctionspecifiestheinitialentryretrieved.
Usenamedobjdicttoobtainthemasterdictionaryentityname.

Note:Onceyoubeginsteppingthroughthecontentsofadictionary,passinga
differentdictionarynametodictnextwillcausetheplacetobelostinthe
originaldictionary.Inotherwords,onlyoneglobaliteratorismaintainedfor
useinthisfunction.

Examples
Createadictionaryandanentryasshownintheexamplefordictadd.Thenmake
anotherXrecordobject:
Command:(setqxname(entmakexdatalist))
<Entityname:1b62d60>
AddthisXrecordobjecttothedictionary,asthesecondrecordinthe
dictionary:
Command:(dictaddnewdict"DATA_RECORD_2"xname)
<Entityname:1b62d60>
Returntheentitynameofthenextentryinthedictionary:
Command:(cdr(car(dictnextnewdict)))
<Entityname:1bac958>

dictnextreturnsthenameofthefirstentityaddedtothedictionary.
Returntheentitynameofthenextentryinthedictionary:
Command:(cdr(car(dictnextnewdict)))
<Entityname:1bac960>
dictnextreturnsthenameofthesecondentityaddedtothedictionary.
Returntheentitynameofthenextentryinthedictionary:
Command:(cdr(car(dictnextnewdict)))
nil
Therearenomoreentriesinthedictionary,sodictnextreturnsnil.
Rewindtothefirstentryinthedictionaryandreturntheentitynameofthat
entry:
Command:(cdr(car(dictnextnewdictT)))
<Entityname:1bac958>
SpecifyingTfortheoptionalrewindargumentcausesdictnexttoreturnthe
firstentryinthedictionary.
SeeAlso
Thedictadd,dictremove,dictrename,dictsearch,dictnext,andnamedobjdictfunctions.

dictremove
Removesanentryfromthespecifieddictionary
(dictremoveenamesymbol)
Bydefault,removinganentryfromadictionarydoesnotdeleteitfromthe
database.Thismustbedonewithacalltoentdel.Currentlytheexceptionsto
thisrulearegroupsandmlinestyles.Thecodethatimplementsthesefeatures
requiresthatthedatabaseandthesedictionariesbeuptodate,andtherefore
automaticallydeletestheentitywhenitisremoved(withdictremove)fromthe
dictionary.

Arguments
ename
Nameofthedictionarybeingmodified.
symbol
Theentrytoberemovedfromename.
Thedictremovefunctiondoesnotallowtheremovalofanmlinestylefromthe
mlinestyledictionaryifitisactivelyreferencedbyanmlineinthedatabase.

ReturnValues
Theentitynameoftheremovedentry.Ifenameisinvalidorsymbolisnot
found,dictremovereturnsnil.

Examples
Thefollowingexampleremovesthedictionarycreatedinthedictaddexample:
Command:(dictremove(namedobjdict)"my_way_cool_dictionary")
<Entityname:1d98950>
SeeAlso

Thedictadd,dictnext,dictrename,dictsearch,andnamedobjdictfunctions.

dictrename
Renamesadictionaryentry
(dictrenameenameoldsymnewsym)

Arguments
ename
Nameofthedictionarybeingmodified.
oldsym
Originalkeynameoftheentry.
newsym
Newkeynameoftheentry.

ReturnValues
Thenewsymvalue,iftherenameissuccessful.Ifeithertheoldnameisnot
presentinthedictionary,orenameisinvalid,ornewnameisinvalid,or
newnameisalreadypresentinthedictionary,dictrenamereturnsnil.

Examples
Thefollowingexamplerenamesthedictionarycreatedinthedictaddsample:
Command:(dictrename(namedobjdict)"my_way_cool_dictionary""Anevencooler
dictionary")
"Anevencoolerdictionary"
SeeAlso

Thedictadd,dictnext,dictremove,dictsearch,andnamedobjdictfunctions.

dictsearch
Searchesadictionaryforanitem
(dictsearchenamesymbol[setnext])

Arguments
ename
Nameofthedictionarybeingsearched.
symbol
Astringthatspecifiestheitemtobesearchedforwithinthedictionary.
setnext
Ifpresentandnotnil,thedictnextentrycounterisadjustedsothefollowing
dictnextcallreturnstheentryaftertheonereturnedbythisdictsearchcall.

ReturnValues
Theentryforthespecifieditem,ifsuccessful,ornil,ifnoentryisfound.

Examples
Thefollowingexampleillustratestheuseofdictsearchtoobtainthe
dictionaryaddedinthedictaddexample:
Command:(setqnewdictlist(dictsearch(namedobjdict)
"my_way_cool_dictionary"))
((1.<Entityname:1d98950>)(0."DICTIONARY")(5."52")(102.
"{ACAD_REACTORS")(330.<Entityname:1d98860>)(102."}")(330.<Entity

name:1d98860>)(100."AcDbDictionary")(280.0)(281.1)(3.
"DATA_RECORD_1")(350.<Entityname:1d98958>))
SeeAlso
Thedictnext,dictremove,dictsearch,andnamedobjdictfunctions.

dimx_tile
Retrievesthewidthofatileindialogboxunits
(dimx_tilekey)

Arguments
key
Astringspecifyingthetiletobequeried.Thekeyargumentiscasesensitive.

ReturnValues
Thewidthofthetile.
Thecoordinatesreturnedarethemaximumallowedwithinthetile.Because
coordinatesarezerobased,thisfunctionreturnonelessthanthetotalX
dimension(X1).Thedimx_tileanddimy_tilefunctionsareprovidedforuse
withvector_image,fill_image,andslide_image,whichrequireyoutospecify
absolutetilecoordinates.

Examples
(setqtile_width(dimx_tile"my_tile"))

dimy_tile
Retrievestheheightofatileindialogboxunits
(dimy_tilekey)

Arguments
key
Astringspecifyingthetiletobequeried.Thekeyargumentiscasesensitive.

ReturnValues
Theheightofthetile.
Thecoordinatesreturnedarethemaximumallowedwithinthetile.Because
coordinatesarezerobased,thisfunctionreturnonelessthanthetotalY
dimension(Y1).Thedimx_tileanddimy_tilefunctionsareprovidedforuse
withvector_image,fill_image,andslide_image,whichrequireyoutospecify
absolutetilecoordinates.

Examples
(setqtile_height(dimy_tile"my_tile"))

distance
Returnsthe3Ddistancebetweentwopoints
(distancept1pt2)

Arguments

pt1
A2Dor3Dpointlist.
pt1
A2Dor3Dpointlist.

ReturnValues
Thedistance.
Ifoneorbothofthesuppliedpointsisa2Dpoint,thendistanceignoresthe
Zcoordinatesofany3Dpointssuppliedandreturnsthe2Ddistancebetweenthe
pointsasprojectedintothecurrentconstructionplane.

Examples
Command:(distance'(1.02.53.0)'(7.72.53.0))
6.7
Command:(distance'(1.02.00.5)'(3.04.00.5))
2.82843
SeeAlso
TheGeometricUtilitiestopicintheVisualLISPDeveloper'sGuide.

distof
Convertsastringthatrepresentsareal(floatingpoint)valueintoareal
value
(distofstring[mode])
Thedistofandrtosfunctionsarecomplementary.Ifyoupassdistofastring
createdbyrtos,distofisguaranteedtoreturnavalidvalue,andviceversa
(assumingthemodevaluesarethesame).

Arguments
string
Astringtobeconverted.Theargumentmustbeastringthatdistofcanparse
correctlyaccordingtotheunitsspecifiedbymode.Itcanbeinthesameform
thatrtosreturns,orinaformthatAutoCADallowsforkeyboardentry.
mode
Theunitsinwhichthestringiscurrentlyformatted.Themodecorrespondsto
thevaluesallowedfortheAutoCADsystemvariableLUNITS.Specifyoneofthe
followingnumbersformode:
1Scientific
2Decimal
3Engineering(feetanddecimalinches)
4Architectural(feetandfractionalinches)
5Fractional

ReturnValues
Arealnumber,ifsuccessful,otherwisenil.

Note:Thedistoffunctiontreatsmodes3and4thesame.Thatis,ifmode
specifies3(engineering)or4(architectural)units,andstringisineither
oftheseformats,distofreturnsthecorrectrealvalue.

done_dialog

Terminatesadialogbox
(done_dialog[status])

Arguments
status
Apositiveintegerthatstart_dialogwillreturninsteadofreturning1forOK
or0forCancel.Themeaningofanystatusvaluegreaterthan1isdetermined
byyourapplication.
Youmustcalldone_dialogfromwithinanactionexpressionorcallbackfunction
(seeaction_tile).

ReturnValues
Atwodimensionalpointlistthatisthe(X,Y)locationofthedialogboxwhen
theuserexitedit.

UsageNotes
Ifyouprovideacallbackforthebuttonwhosekeyis"accept"or"cancel"
(usuallytheOKandCancelbuttons),thecallbackmustcalldone_dialog
explicitly.Ifitdoesn't,theusercanbetrappedinthedialogbox.Ifyou
don'tprovideanexplicitcallbackforthesebuttonsandusethestandardexit
buttons,AutoCADhandlesthemautomatically.Also,anexplicitAutoLISPaction
forthe"accept"buttonmustspecifyastatusof1(oranapplicationdefined
value)otherwise,start_dialogreturnsthedefaultvalue,0,whichmakesit
appearasifthedialogboxwascanceled.
================================EFunctions===================================

end_image
Endscreationofthecurrentlyactivedialogboximage
(end_image)
Thisfunctionisthecomplementofstart_image.

ReturnValues
nil
SeeAlso
Thestart_imagefunction.

end_list
Endsprocessingofthecurrentlyactivedialogboxlist
(end_list)
Thisfunctionisthecomplementofstart_list.

ReturnValues
nil
SeeAlso
Theadd_listandstart_listfunctions.

entdel

Deletesobjects(entities)orrestorespreviouslydeletedobjects
(entdelename)
Theentityspecifiedbyenameisdeletedifitiscurrentlyinthedrawing.The
entdelfunctionrestorestheentitytothedrawingifithasbeendeleted
previouslyinthiseditingsession.Deletedentitiesarepurgedfromthe
drawingwhenthedrawingisexited.Theentdelfunctioncandeleteboth
graphicalandnongraphicalentities.

Arguments
ename
Nameoftheentitytobedeletedorrestored.

ReturnValues
Theentityname.
UsageNotes
Theentdelfunctionoperatesonlyonmainentities.Attributesandpolyline
verticescannotbedeletedindependentlyoftheirparententities.Youcanuse
thecommandfunctiontooperatetheATTEDITorPEDITcommandstomodify
subentities.
Youcannotdeleteentitieswithinablockdefinition.However,youcan
completelyredefineablockdefinition,minustheentityyouwantdeleted,with
entmake.

Examples
Getthenameofthefirstentityinthedrawingandassignittovariablee1:
Command:(setqe1(entnext))
<Entityname:2c90520>
Deletetheentitynamedbye1:
Command:(entdele1)
<Entityname:2c90520>
Restoretheentitynamedbye1:
Command:(entdele1)
<Entityname:2c90520>

entget
Retrievesanobject's(entity's)definitiondata
(entgetename[applist])

Arguments
ename
Nameoftheentitybeingqueried.Theenamecanrefertoeitheragraphicalor
nongraphicalentity.
applist
Alistofregisteredapplicationnames.

ReturnValues
Anassociationlistcontainingtheentitydefinitionofename.Ifyouspecify
theoptionalapplistargument,entgetalsoreturnstheextendeddataassociated
withthespecifiedapplications.ObjectsinthelistareassignedAutoCADDXFTM
groupcodesforeachpartoftheentitydata.

NotethattheDXFgroupcodesusedbyAutoLISPdifferslightlyfromthegroup
codesinaDXFfile.TheAutoLISPDXFgroupcodesaredocumentedintheDXF

Reference.

Examples
Assumethatthelastobjectcreatedinthedrawingisalinedrawnfrompoint
(1,2)topoint(6,5).Thefollowingexampleshowscodethatretrievesthe
entitynameofthelastobjectwiththeentlastfunction,andpassesthatname
toentget:
Command:(entget(entlast))
((1.<Entityname:1bbd1d0>)(0."LINE")(330.<Entityname:1bbd0c8>)(5.
"6A")(100."AcDbEntity")(67.0)(410."Model")(8."0")(100.
"AcDbLine")(101.02.00.0)(116.05.00.0)(2100.00.01.0))
SeeAlso
Theentdel,andentupd
functions.SeeEntityDataFunctionsintheVisualLISPDeveloper'sGuide.

entlast
Returnsthenameofthelastnondeletedmainobject(entity)inthedrawing
(entlast)
Theentlastfunctionisfrequentlyusedtoobtainthenameofanewentitythat
hasjustbeenaddedwiththecommandfunction.Tobeselected,theentityneed
notbeonthescreenoronathawedlayer.

ReturnValues
Anentityname,ornil,iftherearenoentitiesinthecurrentdrawing.

Examples
Setvariablee1tothenameofthelastentityaddedtothedrawing:
Command:(setqe1(entlast))
<Entityname:2c90538>
Ifyourapplicationrequiresthenameofthelastnondeletedentity(main
entityorsubentity),defineafunctionsuchasthefollowingandcallit
insteadofentlast.
(defunlastent(/ab)
(if(setqa(entlast))Getslastmainentity
(while(setqb(entnexta))Ifsubentitiesfollow,loops
untiltherearenomore
(setqab)subentities
)
)
aReturnslastmainentity
)orsubentity
SeeAlso
Theentdel,andentselfunctions.

entmake
Createsanewentityinthedrawing
(entmake[elist])

Theentmakefunctioncandefinebothgraphicalandnongraphicalentities.

Arguments
elist
Alistofentitydefinitiondatainaformatsimilartothatreturnedbythe
entgetfunction.Theelistargumentmustcontainalloftheinformation
necessarytodefinetheentity.Ifanyrequireddefinitiondataisomitted,
entmakereturnsnilandtheentityisrejected.Ifyouomitoptionaldefinition
data(suchasthelayer),entmakeusesthedefaultvalue.
Theentitytype(forexample,CIRCLEorLINE)mustbethefirstorsecondfield
oftheelist.Ifentitytypeisthesecondfield,itcanbeprecededonlyby
theentityname.Theentmakefunctionignorestheentitynamewhencreatingthe
newentity.Iftheelistcontainsanentityhandle,entmakeignoresthattoo.

ReturnValues
Ifsuccessful,entmakereturnstheentity'slistofdefinitiondata.Ifentmake
isunabletocreatetheentity,itreturnsnil.
Completionofablockdefinition(entmakeofanendblk)returnstheblock's
nameratherthantheentitydatalistnormallyreturned.

Examples
Thefollowingcodecreatesaredcircle(color62),centeredat(4,4)witha
radiusof1.Theoptionallayerandlinetypefieldshavebeenomittedand
thereforeassumedefaultvalues.
Command:(entmake'((0."CIRCLE")(62.1)(104.04.00.0)(40.1.0)))
((0."CIRCLE")(62.1)(104.04.00.0)(40.1.0))

NotesonUsingentmake
Youcannotcreateviewportobjectswithentmake.
Agroup66codeishonoredonlyforinsertobjects(meaningattributesfollow).
Forpolylineentities,thegroup66codeisforcedtoavalueof1(meaning
verticesfollow),andforallotherentitiesittakesadefaultof0.Theonly
entitythatcanfollowapolylineentityisavertexentity.
Thegroupcode2(blockname)ofadimensionentityisoptionalfortheentmake
function.Iftheblocknameisomittedfromtheentitydefinitionlist,AutoCAD
createsanewone.Otherwise,AutoCADcreatesthedimensionusingthename
provided.
Forlegacyreasons,entmakeignoresDXFgroupcode100dataforthefollowing
entitytypes:
*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
SeeAlso

Theendtdelandentmodfunctions.IntheVisualLISPDeveloper's
Guide,refertoEntityDataFunctionsforadditionalinformationoncreating
entitiesinadrawing,AddinganEntitytoaDrawingforspecificsonusing
entmake,andCreatingComplexEntitiesforinformationoncreatingcomplex
entities.

entmakex
Makesanewobjectorentity,givesitahandleandentityname(but,doesnot
assignanowner),andthenreturnsthenewentityname
(entmakex[elist])
Theentmakexfunctioncandefinebothgraphicalandnongraphicalentities.

Arguments
elist
Alistofentitydefinitiondatainaformatsimilartothatreturnedbythe
entgetfunction.Theelistargumentmustcontainalloftheinformation
necessarytodefinetheentity.Ifanyrequireddefinitiondataisomitted,
entmakexreturnsnilandtheentityisrejected.Ifyouomitoptional
definitiondata(suchasthelayer),entmakexusesthedefaultvalue.

ReturnValues
Ifsuccessful,entmakexreturnsthenameoftheentitycreated.Ifentmakexis
unabletocreatetheentity,thefunctionreturnsnil.

Examples
_$(entmakex'((0."CIRCLE")(62.1)(104.03.00.0)(40.1.0)))
<Entityname:1d45558>
Warning!ObjectsandentitieswithoutownersarenotwrittenouttoDWGorDXF
files.Besuretosetanowneratsomepointafterusingentmakex.Forexample,
youcanusedictaddtosetadictionarytoownanobject.
SeeAlso
Theentmakefunction.

entmod
Modifiesthedefinitiondataofanobject(entity)
(entmodelist)
Theentmodfunctionupdatesdatabaseinformationfortheentitynamespecified
bythe1groupinelist.TheprimarymechanismthroughwhichAutoLISPupdates
thedatabaseisbyretrievingentitieswithentget,modifyingthelistdefining
anentity,andupdatingtheentityinthedatabasewithentmod.Theentmod
functioncanmodifybothgraphicalandnongraphicalobjects.

Arguments
elist
Alistofentitydefinitiondatainaformatsimilartothatreturnedbythe
entgetfunction.
Forentityfieldswithfloatingpointvalues(suchasthickness),entmod
acceptsintegervaluesandconvertsthemtofloatingpoint.Similarly,ifyou
supplyafloatingpointvalueforanintegerentityfield(suchascolor
number),entmodtruncatesitandconvertsittoaninteger.

ReturnValues
Ifsuccessful,entmodreturnstheelistsuppliedtoit.Ifentmodisunableto
modifythespecifiedentity,thefunctionreturnsnil.

Examples
Thefollowingsequenceofcommandsobtainsthepropertiesofanentity,then
modifiestheentity.
Settheen1variabletothenameofthefirstentityinthedrawing:
Command:(setqen1(entnext))
<Entityname:2c90520>
Setavariablenamededtotheentitydataofentityen1:
Command:(setqed(entgeten1))
((1.<Entityname:2c90520>)(0."CIRCLE")(5."4C")(100."AcDbEntity")
(67.0)(8."0")(100."AcDbCircle")(103.453736.216350.0)(40.2.94827)
(2100.00.01.0))
Changesthelayergroupinedfromlayer0tolayer1:
Command:(setqed(subst(cons8"1")(assoc8ed)ed))
((1.<Entityname:2c90520>)(0."CIRCLE")(5."4C")(100."AcDbEntity")
(67.0)(8."1")(100."AcDbCircle")(103.453736.216350.0)(40.2.94827)
(2100.00.01.0))
Modifythelayeroftheen1entityinthedrawing:
Command:(entmoded)
((1.<Entityname:2c90520>)(0."CIRCLE")(5."4C")(100."AcDbEntity")
(67.0)(8."1")(100."AcDbCircle")(103.453736.216350.0)(40.2.94827)
(2100.00.01.0))
RestrictionsonUsingentmod
Therearerestrictionsonthechangestheentmodfunctioncanmake:
*Anentity'stypeandhandlecannotbechanged.Ifyouwanttodothis,use
entdeltodeletetheentity,thenmakeanewentitywiththecommandor
entmakefunctions.
*Theentmodfunctioncannotchangeinternalfieldssuchastheentityname
inthe2groupofaseqendentityattemptstochangesuchfieldsare
ignored.
*Youcannotusetheentmodfunctiontomodifyaviewportentity.
Youcanchangeanentity'sspacevisibilityfieldto0or1(exceptfor
viewportobjects).Ifyouuseentmodtomodifyanentitywithinablock
definition,themodificationaffectsallinstancesoftheblockinthedrawing.
Beforeperforminganentmodonvertexentities,youshouldreadorwritethe
polylineentity'sheader.Ifthemostrecentlyprocessedpolylineentityis
differentfromtheonetowhichthevertexbelongs,widthinformation(the40
and41groups)canbelost.
Warning!Youcanuseentmodtomodifyentitieswithinablockdefinition,but
doingsocancreateaselfreferencingblock,whichwillcauseAutoCADtostop.
SeeAlso
Theentdel,andentnextfunctions.IntheVisual
LISPDeveloper'sGuide,refertoModifyinganEntityandEntityDataFunctions
andtheGraphicsScreen.

entnext
Returnsthenameofthenextobject(entity)inthedrawing
(entnext[ename])

Arguments
ename
Thenameofanexistingentity.

ReturnValues
Ifentnextiscalledwithnoarguments,itreturnstheentitynameofthefirst
nondeletedentityinthedatabase.Ifanenameargumentissuppliedtoentnext,
thefunctionreturnstheentitynameofthefirstnondeletedentityfollowing
enameinthedatabase.Ifthereisnonextentityinthedatabase,itreturns
nil.Theentnextfunctionreturnsbothmainentitiesandsubentities.

Examples
(setqe1(entnext))Setse1tothenameofthefirstentityinthedrawing
(setqe2(entnexte1))Setse2tothenameoftheentityfollowinge1

Notes
Theentitiesselectedbyssgetaremainentities,notattributesofblocksor
verticesofpolylines.Youcanaccesstheinternalstructureofthesecomplex
entitiesbywalkingthroughthesubentitieswithentnext.Onceyouobtaina
subentity'sname,youcanoperateonitlikeanyotherentity.Ifyouobtain
thenameofasubentitywithentnext,youcanfindtheparententityby
steppingforwardwithentnextuntilaseqendentityisfound,thenextracting
the2groupfromthatentity,whichisthemainentity'sname.
SeeAlso
Theentdel,andentnextfunctions.

entsel
Promptstheusertoselectasingleobject(entity)byspecifyingapoint
(entsel[msg])

Arguments
msg
Apromptstringtobedisplayedtousers.Ifomitted,entselpromptswiththe
message,"Selectobject".

ReturnValues
Alistwhosefirstelementistheentitynameofthechosenobjectandwhose
secondelementisthecoordinates(intermsofthecurrentUCS)ofthepoint
usedtopicktheobject.
Thepickpointreturnedbyentseldoesnotrepresentapointthatliesonthe
selectedobject.Thepointreturnedisthelocationofthecrosshairsatthe
timeofselection.Therelationshipbetweenthepickpointandtheobjectwill
varydependingonthesizeofthepickboxandthecurrentzoomscale.

Examples
ThefollowingAutoCADcommandsequenceillustratestheuseoftheentsel
functionandthelistreturned:
Command:line
Frompoint:1,1
Topoint:6,6
Topoint:ENTER
Command:(setqe(entsel"Pleasechooseanobject:"))
Pleasechooseanobject:3,3
(<Entityname:60000014>(3.03.00.0))
Sometimeswhenoperatingonobjects,youwillwanttosimultaneouslyselectan
objectandspecifythepointbywhichitwasselected.Examplesofthisin
AutoCADcanbefoundinObjectSnapandintheBREAK,TRIM,andEXTEND
commands.TheentselfunctionallowsAutoLISPprogramstoperformthis
operation.Itselectsasingleobject,requiringtheselectiontobeapoint
pick.ThecurrentOsnapsettingisignoredbythisfunctionunlessyou
specificallyrequestitwhileyouareinthefunction.Theentselfunction

honorskeywordsfromaprecedingcalltoinitget.
SeeAlso
Theentget,andentnextfunctions.

entupd
Updatesthescreenimageofanobject(entity)
(entupdename)

Arguments
ename
Thenameoftheentitytobeupdatedonthescreen.

ReturnValues
Theentity(ename)updated,ornil,ifnothingwasupdated.

Examples
Assumingthatthefirstentityinthedrawingisa3Dpolylinewithseveral
vertices,thefollowingcodemodifiesandredisplaysthepolyline:
(setqe1(entnext))Setse1tothepolyline'sentityname
(setqe2(entnexte1))Setse2toitsfirstvertex
(setqed(entgete2))Setsedtothevertexdata
(setqed
(subst'(101.02.0)
(assoc10ed)Changesthevertex'slocationined
edtopoint(1,2)
)
)
(entmoded)Movesthevertexinthedrawing
(entupde1)Regeneratesthepolylineentitye1
UpdatingPolylinesandBlocks
Whena3D(oroldstyle)polylinevertexorblockattributeismodifiedwith
entmod,theentirecomplexentityisnotupdatedonthescreen.Theentupd
functioncanbeusedtocauseamodifiedpolylineorblocktobeupdatedonthe
screen.Thisfunctioncanbecalledwiththeentitynameofanypartofthe
polylineorblockitneednotbetheheadentity.Whileentupdisintendedfor
polylinesandblockswithattributes,itcanbecalledforanyentity.It
alwaysregeneratestheentityonthescreen,includingallsubentities.

Note:Ifentupdisusedonanestedentity(anentitywithinablock)orona
blockthatcontainsnestedentities,someoftheentitiesmightnotbe
regenerated.Toensurecompleteregeneration,youmustinvoketheREGEN
command.
SeeAlso
Theentget,andentnextfunctions.

eq
Determineswhethertwoexpressionsareidentical
(eqexpr1expr2)

Theeqfunctiondetermineswhetherexpr1andexpr2areboundtothesameobject
(bysetq,forexample).

Arguments
expr1
Theexpressiontobecompared.
expr2
Theexpressiontocomparewithexpr1.

ReturnValues
Tifthetwoexpressionsareidentical,nilotherwise.

Examples
Giventhefollowingassignments:
(setqf1'(abc))
(setqf2'(abc))
(setqf3f2)
Comparef1andf3:
Command:(eqf1f3)
nil
eqreturnsnilbecausef1andf3,whilecontainingthesamevalue,donotrefer
tothesamelist.
Comparef3andf2:
Command:(eqf3f2)
T
eqreturnsTbecausef3andf2refertothesamelist.
SeeAlso
The(equalto)andequalfunctions.

equal
Determineswhethertwoexpressionsareequal
(equalexpr1expr2[fuzz])

Arguments
expr1
Theexpressiontobecompared.
expr2
Theexpressiontocomparewithexpr1.
fuzz
Arealnumberdefiningthemaximumamountbywhichexpr1andexpr2candiffer
andstillbeconsideredequal.
Whencomparingtworealnumbers(ortwolistsofrealnumbers,asinpoints),
thetwoidenticalnumberscandifferslightlyifdifferentmethodsareusedto
calculatethem.Youcanspecifyafuzzamounttocompensateforthedifference
thatmayresultfromthedifferentmethodsofcalculation.

ReturnValues
Tifthetwoexpressionsareequal(evaluatetothesamevalue),nilotherwise.

Examples
Giventhefollowingassignments:
(setqf1'(abc))
(setqf2'(abc))
(setqf3f2)
(setqa1.123456)
(setqb1.123457)
Comparef1tof3:
Command:(equalf1f3)
T
Comparef3tof2:
Command:(equalf3f2)
T
Compareatob:
Command:(equalab)
nil
Theaandbvariablesdifferby.000001.
Compareatob:,withfuzzargumentof.000001:
Command:(equalab0.000001)
T
Theaandbvariablesdifferbyanamountequaltothespecifiedfuzzfactor,
soequalconsidersthevariablesequal.
ComparingtheeqandequalFunctions
Iftheeqfunctionfindsthattwolistsoratomsarethesame,theequal
functionalsofindsthemtobethesame.
Anyatomsthattheequalfunctiondeterminestobethesamearealsofound
equivalentbyeq.However,twoliststhatequaldeterminestobethesamemay
befoundtobedifferentaccordingtotheeqfunction.
SeeAlso
The(equalto)andeqfunctions.

error_function
NOTE:+error+=(*error*)
Auserdefinableerrorhandlingfunction
+error+string
+error+isnotnil,itisexecutedasafunctionwheneveranAutoLISPerror
exists.AutoCADpassesoneargumentto+error+,whichisastring
containingadescriptionoftheerror.
+error+functioncanincludecallstothecommandfunctionwithout
arguments(forexample,(command)).ThiswillcancelapreviousAutoCADcommand
calledwiththecommandfunction.

ReturnValues
Thisfunctiondoesnotreturn,exceptwhenusingvlexitwithvalue.

Examples
ThefollowingfunctiondoesthesamethingthattheAutoLISPstandarderror
handlerdoes.Itprintstheword"error,"followedbyadescription:
(defun+error+(msg)

(princ"error:")
(princmsg)
(princ)
)
SeeAlso
Thevlexitwitherror,vlcatchallapply,
vlcatchallerrormessage,andvlcatchallerrorpfunctions.

eval
ReturnstheresultofevaluatinganAutoLISPexpression
(evalexpr)

Arguments
expr
Theexpressiontobeevaluated.

ReturnValues
Theresultoftheexpression,afterevaluation.

Examples
First,setsomevariables:
Command:(setqa123)
123
Command:(setqb'a)
A
Nowevaluatesomeexpressions:
Command:(eval4.0)
4.0
Command:(eval(abs10))
10
Command:(evala)
123
Command:(evalb)
123

exit
Forcesthecurrentapplicationtoquit
(exit)
Ifexitiscalled,itreturnstheerrormessagequit/exitabortandreturnsto
theAutoCADCommandprompt.
SeeAlso
Thequitfunction.

exp
Returnstheconstante(arealnumber)raisedtoaspecifiedpower(thenatural
antilog)
(expnum)

Arguments
num
Arealnumber.

ReturnValues
Areal(num),raisedtoitsnaturalantilogarithm.

Examples
Command:(exp1.0)
2.71828
Command:(exp2.2)
9.02501
Command:(exp0.4)
0.67032

expand
AllocatesadditionalmemoryforAutoLISP
(expandnexpand)

Arguments
nexpand
Anintegerindicatingtheamountofadditionalmemorytobeallocated.Memory
isallocatedasfollows:
*nallocfreesymbols
*nallocfreestrings
*nallocfreeusubrs
*nallocfreereals
*nalloc*nexpandconscells
wherenallocisthecurrentsegmentsize.

ReturnValues
Anintegerindicatingthenumberoffreeconsesdividedbynalloc.

Examples
Setthesegmentsizeto100:
_$(alloc100)
1000
Allocatememoryfortwoadditionalsegments:
_$(expand2)
82
ThisensuresthatAutoLISPnowhasmemoryavailableforatleast200additional
symbols,strings,usubrsandrealseach,and8200freeconses.

SeeAlso
Theallocfunction.

expt
Returnsanumberraisedtoaspecifiedpower
(exptnumberpower)

Arguments
number
Anynumber.
power
Thepowertoraisenumberto.

ReturnValues
Ifbothargumentsareintegers,theresultisaninteger,otherwise,theresult
isareal.

Examples
Command:(expt24)
16
Command:(expt3.02.0)
9.0
================================FFunctions===================================

fill_image
Drawsafilledrectangleinthecurrentlyactivedialogboximagetile
(fill_imagex1y1widthheightcolor)
Thefirst(upperleft)corneroftherectangleislocatedat(x1,y1)andthe
second(lowerright)cornerislocatedtherelativedistance(width,height)
fromthefirstcorner.Theorigin(0,0)istheupperleftcorneroftheimage.
Youcanobtainthecoordinatesofthelowerrightcornerbycallingthe
dimensionfunctionsdimx_tileanddimy_tile.
Thefill_imagefunctionmustbeusedbetweenstart_imageandend_imagefunction
calls.

Arguments
x1
Xcoordinateoftheupperleftcorneroftherectanglelocatedat(x1,y1).Must
beapositivevalue.
y1
Ycoordinateofupperleftcorner.Mustbeapositivevalue.
width
Widthofthefillarea(inpixels),relativetox1.
height
Widthofthefillarea(inpixels),relativetoy1.
color
AnAutoCADcolornumber,oroneofthelogicalcolornumbersshowninthe

followingtable:
++++
|Symbolicnamesforcolorattribute|
++++
|Colornumber|ADImnemonic|Description|
++++
|2|BGLCOLOR|Currentbackgroundofthe|
|||AutoCADdrawingarea|
++++
|15|DBGLCOLOR|Currentdialogboxbackground|
|||color|
++++
|16|DFGLCOLOR|Currentdialogboxforeground|
|||color(text)|
++++
|18|LINELCOLOR|Currentdialogboxlinecolor|
++++

ReturnValues

Anintegerrepresentingthefillcolor.

Examples
(setqcolor2)colorofAutoCADdrawingarea
(fill_image
0
0
(dimx_tile"slide_tile")
(dimy_tile"slide_tile")
color
)
(end_image)

findfile
SearchestheAutoCADlibrarypathforthespecifiedfileordirectory
(findfilefilename)
Thefindfilefunctionmakesnoassumptionaboutthefiletypeorextensionof
filename.Iffilenamedoesnotspecifyadrive/directoryprefix,findfile
searchestheAutoCADlibrarypath.Ifadrive/directoryprefixissupplied,
findfilelooksonlyinthatdirectory.

Arguments
filename
Nameofthefileordirectorytobesearchedfor.

ReturnValues
Astringcontainingthefullyqualifiedfilename,ornil,ifthespecified
fileordirectoryisnotfound.
Thefilenamereturnedbyfindfileissuitableforusewiththeopenfunction.

Examples
Ifthecurrentdirectoryis/AutoCADanditcontainsthefileabc.lsp,the
followingfunctioncallretrievesthepathname:
Command:(findfile"abc.lsp")
"C:\\ProgramFiles\\AutoCAD\\abc.lsp"
Ifyouareeditingadrawinginthe/AutoCAD/drawingsdirectory,theACAD
environmentvariableissetto/AutoCAD/support,andthefilexyz.txt
existsonlyinthe/AutoCAD/supportdirectory,thenthefollowingcommand
retrievesthepathname:

Command:(findfile"xyz.txt")
"C:\\ProgramFiles\\AutoCAD\\support\\xyz.txt"
Ifthefilenosuchisnotpresentinanyofthedirectoriesonthelibrary
searchpath,findfilereturnsnil:
Command:(findfile"nosuch")
nil

NotethatpriortoAutoCADRelease14,findfileonlyreturnedapathifyou
suppliedavalidfilenameasyourargument.Ifyousuppliedadirectorypath,
findfilereturnednilevenifthepathexisted.Forexample,thefollowingcall
tofindfilereturnsapathnameinAutoCAD:
Command:(findfile"c:/programfiles/AutoCAD")
"C:\\programfiles\\AutoCAD"
InAutoCADRelease13,thesamecommandreturnsnil.

fix
Returnstheconversionofarealnumberintothenearestsmallerinteger
(fixnumber)
Thefixfunctiontruncatesnumbertothenearestintegerbydiscardingthe
fractionalportion.

Arguments
number
Arealnumber.

ReturnValues
Theintegerderivedfromnumber.
Ifnumberislargerthanthelargestpossibleinteger(+2,147,483,647or
2,147,483,648ona32bitplatform),fixreturnsatruncatedreal(although
integerstransferredbetweenAutoLISPandAutoCADarerestrictedto16bit
values).

Examples
Command:(fix3)
3
Command:(fix3.7)
3

float
Returnstheconversionofanumberintoarealnumber
(floatnumber)

Arguments
number
Anynumber.

ReturnValues
Therealnumberderivedfromnumber.

Examples
Command:(float3)
3.0
Command:(float3.75)
3.75

foreach
Evaluatesexpressionsforallmembersofalist
(foreachnamelist[expr...])
Theforeachfunctionstepsthroughalist,assigningeachelementinthelist
toavariable,andevaluateseachexpressionforeveryelementinthelist.Any
numberofexpressionscanbespecified.

Arguments
name
Variablethateachelementinthelistwillbeassignedto.
list
Listtobesteppedthroughandevaluated.
expr
Expressiontobeevaluatedforeachelementinlist.

ReturnValues
Theresultofthelastexprevaluated.Ifnoexprisspecified,foreachreturns
nil.

Examples
Printeachelementinalist:
Command:(foreachn'(abc)(printn))
A
B
CC
foreachprintseachelementinthelistandreturnsC,thelastelement.This
commandisequivalenttothefollowingsequenceofcommands:
(printa)
(printb)
(printc)
exceptthatforeachreturnstheresultofonlythelastexpressionevaluated.

function
TellstheVisualLISPTMcompilertolinkandoptimizeanargumentasifitwere
abuiltinfunction
(functionsymbol|lambdaexpr)
Thefunctionfunctionisidenticaltothequotefunction,exceptittellsthe
VisualLISPcompilertolinkandoptimizetheargumentasifitwereabuiltin
functionordefun.

Compiledlambdaexpressionsthatarequotedbyfunctionwillcontaindebugging
informationwhenloadedintotheVisualLISPIDE.

Arguments
symbol
Asymbolnamingafunction.
lambdaexpr
Anexpressionofthefollowingform:
(LAMBDAarguments{Sexpression}*)

ReturnValues
Theresultoftheevaluatedexpression.

Examples
TheVisualLISPcompilercannotoptimizethequotedlambdaexpressioninthe
followingcode:
(mapcar
'(lambda(x)(*xx))
'(123))
Afteraddingthefunctionfunctiontotheexpression,thecompilercanoptimize
thelambdaexpression.Forexample:
(mapcar
(function(lambda(x)(*xx)))
'(123))
================================GFunctions===================================

gc
Forcesagarbagecollection,whichfreesupunusedmemory
(gc)
SeeAlso
TheMemoryManagementFunctionstopicintheVisualLISPDeveloper'sGuide.

gcd
Returnsthegreatestcommondenominatoroftwointegers
(gcdint1int2)

Arguments
int1
Anintegermustbegreaterthan0.
int2
Anintegermustbegreaterthan0.

ReturnValues
Anintegerrepresentingthegreatestcommondenominatorbetweenint1andint2.

Examples
Command:(gcd8157)

3
Command:(gcd1220)
4

get_attr
RetrievestheDCLvalueofadialogboxattribute
(get_attrkeyattribute)

Arguments
key
Astringthatspecifiesthetile.Thisparameteriscasesensitive.
attribute
Astringnamingtheattributeasitappearsinthetile'sDCLdescription.

ReturnValues
Astringcontainingtheattribute'sinitialvalueasspecifiedinitsDCL
description.

get_tile
Retrievesthecurrentruntimevalueofadialogboxtile
(get_tilekey)

Arguments
key
Astringthatspecifiesthetile.Thisparameteriscasesensitive.

ReturnValues
Astringcontainingthetile'svalue.

getangle
Pausesforuserinputofanangle,andreturnsthatangleinradians
(getangle[pt][msg])

Arguments
pt
A2DbasepointinthecurrentUCS.
Theptargument,ifspecified,isassumedtobethefirstoftwopoints,sothe
usercanshowAutoLISPtheanglebypointingtooneotherpoint.Youcansupply
a3Dbasepoint,buttheangleisalwaysmeasuredinthecurrentconstruction
plane.
msg
Astringtobedisplayedtoprompttheuser.

ReturnValues

Theanglespecifiedbytheuser,inradians.
Thegetanglefunctionmeasuresangleswiththezeroradiandirection(setby
theANGBASEsystemvariable)withanglesincreasinginthecounterclockwise
direction.Thereturnedangleisexpressedinradianswithrespecttothe
currentconstructionplane(theXYplaneofthecurrentUCS,atthecurrent
elevation).

Examples
Thefollowingcodeexamplesshowhowdifferentargumentscanbeusedwith
getangle:
Command:(setqang(getangle))
Command:(setqang(getangle'(1.03.5)))
Command:(setqang(getangle"Whichway?"))
Command:(setqang(getangle'(1.03.5)"Whichway?"))
UsageNotes
UserscanspecifyananglebyenteringanumberintheAutoCADcurrentangle
unitsformat.Althoughthecurrentangleunitsformatmightbeindegrees,
grads,orsomeotherunit,thisfunctionalwaysreturnstheangleinradians.
TheusercanalsoshowAutoLISPtheanglebypointingtotwo2Dlocationsin
thedrawingarea.AutoCADdrawsarubberbandlinefromthefirstpointtothe
currentcrosshairspositiontohelpyouvisualizetheangle.
Itisimportanttounderstandthedifferencebetweentheinputangleandthe
anglereturnedbygetangle.Anglesthatarepassedtogetanglearebasedonthe
currentsettingsofANGDIRandANGBASE.However,onceanangleisprovided,it
ismeasuredinacounterclockwisedirection(ignoringANGDIR)withzeroradians
asthecurrentsettingofANGBASE.
TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetangle
request.
SeeAlso
Theillustrationandcomparisontothegetorientfunction.

getcfg
RetrievesapplicationdatafromtheAppDatasectionoftheacad.cfgfile
(getcfgcfgname)

Arguments
cfgname
Astring(maximumlengthof496characters)namingthesectionandparameter
valuetoretrieve.
Thecfgnameargumentmustbeastringofthefollowingform:
"AppData/application_name/section_name/.../param_name"

ReturnValues
Applicationdata,ifsuccessful.Ifcfgnameisnotvalid,getcfgreturnsnil.

Examples
AssumingtheWallThkparameterintheAppData/ArchStuffsectionhasavalueof
8,thefollowingcommandretrievesthatvalue:
Command:(getcfg"AppData/ArchStuff/WallThk")
"8"
SeeAlso
Thesetcfgfunction.

getcname
RetrievesthelocalizedorEnglishnameofanAutoCADcommand
(getcnamecname)

Arguments
cname
ThelocalizedorunderscoredEnglishcommandnamemustbe64charactersor
lessinlength.

ReturnValues
Ifcnameisnotprecededbyanunderscore(assumedtobethelocalizedcommand
name),getcnamereturnstheunderscoredEnglishcommandname.Ifcnameis
precededbyanunderscore,getcnamereturnsthelocalizedcommandname.This
functionreturnsnilifcnameisnotavalidcommandname.

Examples
InaFrenchversionofAutoCAD,thefollowingistrue.
(getcname"ETIRER")returns"_STRETCH"
(getcname"_STRETCH")returns"ETIRER"

getcorner
Pausesforuserinputofarectangle'ssecondcorner
(getcornerpt[msg])
Thegetcornerfunctiontakesabasepointargument,basedonthecurrentUCS,
anddrawsarectanglefromthatpointastheusermovesthecrosshairsonthe
screen.
TheusercannotenteranotherAutoLISPexpressioninresponsetoagetcorner
request.

Arguments
pt
Apointtobeusedasthebasepoint.
msg
Astringtobedisplayedtoprompttheuser.

ReturnValues
ThegetcornerfunctionreturnsapointinthecurrentUCS,similartogetpoint.
Iftheusersuppliesa3Dpoint,itsZcoordinateisignored.Thecurrent
elevationisusedastheZcoordinate.

Examples
Command:(getcorner'(7.649356.029640.0))
(17.20661.476280.0)
Command:(getcorner'(7.649356.029640.0)"Pickacorner")
Pickacorner(15.95842.401190.0)

getdist
Pausesforuserinputofadistance

(getdist[pt][msg])
Theusercanspecifythedistancebyselectingtwopoints,orbyspecifying
justthesecondpoint,ifabasepointisprovided.Theusercanalsospecifya
distancebyenteringanumberintheAutoCADcurrentdistanceunitsformat.
Althoughthecurrentdistanceunitsformatmightbeinfeetandinches
(architectural),thegetdistfunctionalwaysreturnsthedistanceasareal.
Thegetdistfunctiondrawsarubberbandlinefromthefirstpointtothe
currentcrosshairspositiontohelptheuservisualizethedistance.
TheusercannotenteranotherAutoLISPexpressioninresponsetoagetdist
request.

Arguments
pt
A2Dor3DpointtobeusedasthebasepointinthecurrentUCS.Ifptis
provided,theuserispromptedforthesecondpoint.
msg
Astringtobedisplayedtoprompttheuser.Ifnostringissupplied,AutoCAD
doesnotdisplayamessage.

ReturnValues
Arealnumber.Ifa3Dpointisprovided,thereturnedvalueisa3Ddistance.
However,settingthe64bitoftheinitgetfunctioninstructsgetdisttoignore
theZcomponentof3Dpointsandtoreturna2Ddistance.

Examples
(setqdist(getdist))
(setqdist(getdist'(1.03.5)))
(setqdist(getdist"Howfar"))
(setqdist(getdist'(1.03.5)"Howfar?"))

getenv
Returnsthestringvalueassignedtoasystemenvironmentvariable
(getenvvariablename)

Arguments
variablename
Astringspecifyingthenameofthevariabletoberead.Environmentvariable
namesmustbespelledandcasedexactlyastheyarestoredinthesystem
registry.

ReturnValues
Astringrepresentingthevalueassignedtothespecifiedsystemvariable.If
thevariabledoesnotexist,getenvreturnsnil.

Examples
AssumethesystemenvironmentvariableACADissetto/acad/supportandthere
isnovariablenamedNOSUCH.
Command:(getenv"ACAD")
"/acad/support"
Command:(getenv"NOSUCH")
nil
AssumethattheMaxArrayenvironmentvariableissetto10000:
Command:(getenv"MaxArray")

"10000"
SeeAlso
Thesetenvfunction.

getfiled
PromptstheuserforafilenamewiththestandardAutoCADfiledialogbox,and
returnsthatfilename
(getfiledtitledefaultextflags)
Thegetfiledfunctiondisplaysadialogboxcontainingalistofavailable
filesofaspecifiedextensiontype.Youcanusethisdialogboxtobrowse
throughdifferentdrivesanddirectories,selectanexistingfile,orspecify
thenameofanewfile.

Arguments
title
Astringspecifyingthedialogboxlabel.
default
Adefaultfilenametousecanbeanullstring("").
ext
Thedefaultfilenameextension.Ifextispassedasanullstring(""),it
defaultsto*(allfiletypes).
Ifthefiletypedwgisincludedintheextargument,thegetfiledfunction
displaysanimagepreviewinthedialog.
flags
Anintegervalue(abitcodedfield)thatcontrolsthebehaviorofthedialog
box.Tosetmorethanoneconditionatatime,addthevaluestogetherto
createaflagsvaluebetween0and15.Thefollowingflagsargumentsare
recognizedbygetfiled:
1(bit0)Promptforthenameofanewfiletocreate.Donotsetthisbitwhen
youpromptforthenameofanexistingfiletoopen.Inthelattercase,ifthe
userentersthenameofafilethatdoesn'texist,thedialogboxdisplaysan
errormessageatthebottomofthebox.
Ifthisbitissetandtheuserchoosesafilethatalreadyexists,AutoCAD
displaysanalertboxandoffersthechoiceofproceedingwithorcancelingthe
operation.
4(bit2)Lettheuserenteranarbitraryfilenameextension,ornoextension
atall.
Ifthisbitisnotset,getfiledacceptsonlytheextensionspecifiedinthe
extargumentandappendsthisextensiontothefilenameiftheuserdoesn't
enteritintheFiletextbox.
8(bit3)Ifthisbitissetandbit0isnotset,getfiledperformsalibrary
searchforthefilenameentered.Ifitfindsthefileanditsdirectoryinthe
librarysearchpath,itstripsthepathandreturnsonlythefilename.(It
doesnotstripthepathnameifitfindsthatafileofthesamenameisina
differentdirectory.)
Ifthisbitisnotset,getfiledreturnstheentirefilename,includingthe
pathname.
Setthisbitifyouusethedialogboxtoopenanexistingfilewhosenameyou
wanttosaveinthedrawing(orotherdatabase).
16(bit4)Ifthisbitisset,orifthedefaultargumentendswithapath
delimiter,theargumentisinterpretedasapathnameonly.Thegetfiled
functionassumesthatthereisnodefaultfilename.Itdisplaysthepathin
theLookin:lineandleavestheFilenameboxblank.
32(bit5)Ifthisbitissetandbit0isset(indicatingthatanewfileis
beingspecified),userswillnotbewarnediftheyareabouttooverwritean
existingfile.Thealertboxtowarnusersthatafileofthesamenamealready

existswillnotbedisplayedtheoldfilewilljustbereplaced.
64(bit6)DonottransfertheremotefileiftheuserspecifiesaURL.
128(bit7)DonotallowURLsatall.

ReturnValues
Ifthedialogboxobtainsafilenamefromtheuser,getfiledreturnsastring
thatspecifiesthefilenameotherwise,itreturnsnil.

Examples
ThefollowingcalltogetfileddisplaystheSelectaLispFiledialogbox:
(getfiled"SelectaLispFile""c:/programfiles/AutoCAD/
support/""lsp"8)
AutoCADdisplaysthefollowingdialogboxasaresult:

getint
Pausesforuserinputofaninteger,andreturnsthatinteger
(getint[msg])
Valuespassedtogetintcanrangefrom32,768to+32,767.Iftheuserenters
somethingotherthananinteger,getintdisplaysthemessage"Requiresan
integervalue,"andallowstheusertotryagain.Theuserscannotenter
anotherAutoLISPexpressionastheresponsetoagetintrequest.

Arguments
msg
Astringtobedisplayedtoprompttheuserifomitted,nomessageis
displayed.

ReturnValues
Theintegerspecifiedbytheuserornil,iftheuserpressesENTERwithout
enteringaninteger.

Examples
Command:(setqnum(getint))
15
15
Command:(setqnum(getint"Enteranumber:"))
Enteranumber:25
25
Command:(setqnum(getint))
15.0
Requiresanintegervalue.
15
15
SeeAlso
TheinitgetfunctioninthisreferenceandThegetxxxFunctionsintheVisual
LISPDeveloper'sGuide.

getkword

Pausesforuserinputofakeyword,andreturnsthatkeyword
(getkword[msg])
Validkeywordsaresetpriortothegetkwordcallwiththeinitgetfunction.
TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetkword
request.

Arguments
msg
Astringtobedisplayedtoprompttheuserifomitted,getkworddoesnot
displayapromptingmessage.

ReturnValues
Astringrepresentingthekeywordenteredbytheuser,ornil,iftheuser
pressesENTERwithouttypingakeyword.Thefunctionalsoreturnsnilifitwas
notprecededbyacalltoinitgettoestablishoneormorekeywords.
Iftheuserentersavaluethatisnotavalidkeyword,getkworddisplaysa
warningmessageandpromptstheusertotryagain.

Examples
Thefollowingexampleshowsaninitialcalltoinitgetthatsetsupalistof
keywords(YesandNo)anddisallowsnullinput(bitsvalueequalto1)tothe
getkwordcallthatfollows:
Command:(initget1"YesNo")
nil
Command:(setqx(getkword"Areyousure?(YesorNo)"))
Areyousure?(YesorNo)yes
"Yes"
Thefollowingsequenceillustrateswhathappensiftheuserentersinvalid
inputinresponsetogetkword:
Command:(initget1"YesNo")
nil
Command:(setqx(getkword"Areyousure?(YesorNo)"))
Areyousure?(YesorNo)Maybe
Invalidoptionkeyword.
Areyousure?(YesorNo)yes
"Yes"
Theuser'sresponsewasnotoneofthekeywordsdefinedbythepreceding
initget,sogetkwordissuedanerrormessageandthenpromptedtheuseragain
withthestringsuppliedinthemsgargument.
SeeAlso
TheinitgetfunctioninthisreferenceandThegetxxxFunctionsintheVisual
LISPDeveloper'sGuide.

getorient
Pausesforuserinputofanangle,andreturnsthatangleinradians
(getorient[pt][msg])
Thegetorientfunctionmeasuresangleswiththezeroradiandirectiontothe
right(east)andanglesthatareincreasinginthecounterclockwisedirection.
TheangleinputbytheuserisbasedonthecurrentsettingsofANGDIRand
ANGBASE,butonceanangleisprovided,itismeasuredinacounterclockwise
direction,withzeroradiansbeingtotheright(ignoringANGDIRandANGBASE).
Therefore,someconversionmusttakeplaceifyouselectadifferent

zerodegreebaseoradifferentdirectionforincreasinganglesbyusingthe
UNITScommandortheANGBASEandANGDIRsystemvariables.
Usegetanglewhenyouneedarotationamount(arelativeangle).Usegetorient
toobtainanorientation(anabsoluteangle).
TheusercannotenteranotherAutoLISPexpressionastheresponsetoa
getorientrequest.

Arguments
pt
A2DbasepointinthecurrentUCS.
Theptargument,ifspecified,isassumedtobethefirstoftwopoints,so
thattheusercanshowAutoLISPtheanglebypointingtooneotherpoint.You
cansupplya3Dbasepoint,buttheangleisalwaysmeasuredinthecurrent
constructionplane.
msg
Astringtobedisplayedtoprompttheuser.

ReturnValues
Theanglespecifiedbytheuser,inradians,withrespecttothecurrent
constructionplane.

Examples
Command:(setqpt1(getpoint"Pickpoint:"))
(4.550285.847220.0)
Command:(getorientpt1"Pickpoint:")
5.61582
SeeAlso
ThegetanglefunctioninthisreferenceandThegetxxxFunctionsinthe
VisualLISPDeveloper'sGuide.

getpoint
Pausesforuserinputofapoint,andreturnsthatpoint
(getpoint[pt][msg])
Theusercanspecifyapointbypointingorbyenteringacoordinateinthe
currentunitsformat.Iftheptargumentispresent,AutoCADdrawsa
rubberbandlinefromthatpointtothecurrentcrosshairsposition.
TheusercannotenteranotherAutoLISPexpressioninresponsetoagetpoint
request.

Arguments
pt
A2Dor3DbasepointinthecurrentUCS.

Notethatgetpointwillacceptasingleintegerorrealnumberasthept
argument,andusetheAutoCADdirectdistanceentrymechanismtodeterminea
point.ThismechanismusesthevalueoftheLASTPOINTsystemvariableasthe
startingpoint,theptinputasthedistance,andthecurrentcursorlocation
asthedirectionfromLASTPOINT.Theresultisapointthatisthespecified
numberofunitsawayfromLASTPOINTinthedirectionofthecurrentcursor
location.
msg
Astringtobedisplayedtoprompttheuser.

ReturnValues
A3Dpoint,expressedintermsofthecurrentUCS.

Examples
(setqp(getpoint))
(setqp(getpoint"Where?"))
(setqp(getpoint'(1.52.0)"Secondpoint:"))
SeeAlso
ThegetcornerandinitgetfunctionsinthisreferenceandThegetxxx
FunctionsintheVisualLISPDeveloper'sGuide.

getreal
Pausesforuserinputofarealnumber,andreturnsthatrealnumber
(getreal[msg])
TheusercannotenteranotherAutoLISPexpressionastheresponsetoagetreal
request.

Arguments
msg
Astringtobedisplayedtoprompttheuser.

ReturnValues
Therealnumberenteredbytheuser.

Examples
(setqval(getreal))
(setqval(getreal"Scalefactor:"))

getstring
Pausesforuserinputofastring,andreturnsthatstring
(getstring[cr][msg])
TheusercannotenteranotherAutoLISPexpressionastheresponsetoa
getstringrequest.

Arguments
cr
Ifsuppliedandnotnil,thisargumentindicatesthatuserscanincludeblanks
intheirinputstring(andmustterminatethestringbypressingENTER).
Otherwise,theinputstringisterminatedbyspaceorENTER.
msg
Astringtobedisplayedtoprompttheuser.

ReturnValues
Thestringenteredbytheuser,ornil,iftheuserpressedENTERwithout
typingastring.
Ifthestringislongerthan132characters,getstringreturnsonlythefirst
132charactersofthestring.Iftheinputstringcontainsthebackslash
character(\),getstringconvertsittotwobackslashcharacters(\\).This
allowsyoutousereturnedvaluescontainingfilenamepathsinother
functions.

Examples
Command:(setqs(getstring"What'syourfirstname?"))

What'syourfirstname?Gary
"Gary"
Command:(setqs(getstringT"What'syourfullname?"))
What'syourfullname?GaryIndianaJones
"GaryIndianaJones"
Command:(setqs(getstringT"Enterfilename:"))
Enterfilename:c:\mydocuments\vlisp\secrets
"c:\\mydocuments\\vlisp\\secrets"
SeeAlso
Theinitgetfunction.

getvar
RetrievesthevalueofanAutoCADsystemvariable
(getvarvarname)

Arguments
varname
Astringorsymbolthatnamesasystemvariable.SeetheCommandReferencefor
alistofcurrentAutoCADsystemvariables.

ReturnValues
Thevalueofthesystemvariable,ornil,ifvarnameisnotavalidsystem
variable.

Examples
Getthecurrentvalueofthefilletradius:
Command:(getvar'FILLETRAD)
0.25
SeeAlso
Thesetvarfunction.

graphscr
DisplaystheAutoCADgraphicsscreen
(graphscr)
ThisfunctionisequivalenttotheGRAPHSCRcommandorpressingtheFlipScreen
functionkey.Thetextscrfunctionisthecomplementofgraphscr.
Returns
nil
SeeAlso
Thetextscrfunction.

grclear

Clearsthecurrentviewport(obsoletefunction)
(grclear)
Returns
nil

grdraw
Drawsavectorbetweentwopoints,inthecurrentviewport
(grdrawfromtocolor[highlight])

Arguments
from
2Dor3Dpoints(listsoftwoorthreereals)specifyingoneendpointofthe
vectorintermsofthecurrentUCS.AutoCADclipsthevectortofitthescreen.
to
2Dor3Dpoints(listsoftwoorthreereals)specifyingtheotherendpointof
thevectorintermsofthecurrentUCS.AutoCADclipsthevectortofitthe
screen.
color
Anintegeridentifyingthecolorusedtodrawthevector.A1signifiesXOR
ink,whichcomplementsanythingitdrawsoverandwhicherasesitselfwhen
overdrawn.
highlight
Aninteger,otherthanzero,indicatingthatthevectoristobedrawnusing
thedefaulthighlightingmethodofthedisplaydevice(usuallydashed).
Ifhighlightisomittedoriszero,grdrawusesthenormaldisplaymode.

ReturnValues
nil
SeeAlso
Thegrvecsfunctionforaroutinethatdrawsmultiplevectors.

grread
ReadsvaluesfromanyoftheAutoCADinputdevices
(grread[track][allkeys[curtype]])
OnlyspecializedAutoLISProutinesneedthisfunction.MostinputtoAutoLISP
shouldbeobtainedthroughthevariousgetxxxfunctions.

Arguments
track
Ifsuppliedandnotnil,thisargumentenablesthereturnofcoordinatesfroma
pointingdeviceasitismoved
allkeys
Anintegerrepresentingacodethattellsgrreadwhatfunctionstoperform.The
allkeysbitcodevaluescanbeaddedtogetherforcombinedfunctionality.The
followingvaluescanbespecified:
1(bit0)Returndragmodecoordinates.Ifthisbitissetandtheusermoves

thepointingdeviceinsteadofselectingabuttonorpressingakey,grread
returnsalistwherethefirstmemberisatype5andthesecondmemberisthe
(X,Y)coordinatesofthecurrentpointingdevice(mouseordigitizer)location.
ThisishowAutoCADimplementsdragging.
2(bit1)Returnallkeyvalues,includingfunctionandcursorkeycodes,and
don'tmovethecursorwhentheuserpressesacursorkey.
4(bit2)Usethevaluepassedinthecurtypeargumenttocontrolthecursor
display.
8(bit3)Don'tdisplaytheerror:consolebreakmessagewhentheuserpresses
ESC.
curtype
Anintegerindicatingthetypeofcursortobedisplayed.Theallkeysvaluefor
bit2mustbesetforthecurtypevaluestotakeeffect.Thecurtypeargument
affectsonlythecursortypeduringthecurrentgrreadfunctioncall.Youcan
specifyoneofthefollowingvaluesforcurtype:
0Displaythenormalcrosshairs.
1Donotdisplayacursor(nocrosshairs).
2Displaytheobjectselection"target"cursor.

ReturnValues
Thegrreadfunctionreturnsalistwhosefirstelementisacodespecifyingthe
typeofinput.Thesecondelementofthelistiseitheranintegerorapoint,
dependingonthetypeofinput.Thereturnvaluesarelistedinthefollowing
table:
+++++
|grreadreturnvalues|
+++++
|Firstelement|Secondelement|
+++++
|Value|Typeofinput|Value|Description|
+++++
|2|Keyboardinput|varies|Charactercode|
+++++
|3|Selectedpoint|3Dpoint|Pointcoordinates|
+++++
|4|Screen/pulldownmenu|0to999|Screenmenubox|
||item(frompointing|1001to1999|no.|
||device)|2001to2999|POP1menuboxno.|
|||3001to3999|POP2menuboxno.|
|||...andso|POP3menuboxno.|
|||on,to|...andsoon,to|
|||16001to|POP16menubox|
|||16999|no.|
+++++
|5|Pointingdevice|3Dpoint|Dragmode|
||(returnedonlyif||coordinate|
||trackingisenabled)|||
+++++
|6|BUTTONSmenuitem|0to999|BUTTONS1menu|
|||1000to1999|buttonno.|
|||2000to2999|BUTTONS2menu|
|||3000to3999|buttonno.|
||||BUTTONS3menu|
||||buttonno.|
||||BUTTONS4menu|
||||buttonno.|
+++++
|7|TABLET1menuitem|0to32767|Digitizedboxno.|
+++++
|8|TABLET2menuitem|0to32767|Digitizedboxno.|
+++++
|9|TABLET3menuitem|0to32767|Digitizedboxno.|
+++++
|10|TABLET4menuitem|0to32767|Digitizedboxno.|
+++++
|11|AUXmenuitem|0to999|AUX1menubutton|
|||1000to1999|no.|
|||2000to2999|AUX2menubutton|
|||3000to3999|no.|
||||AUX3menubutton|
||||no.|
||||AUX4menubutton|
||||no.|
+++++

|12|Pointerbutton|3Dpoint|Pointcoordinates|
||(followsatype6or|||
||type11return)|||
+++++
HandlingUserInputwithgrread
EnteringESCwhileagrreadisactiveabortstheAutoLISPprogramwitha
keyboardbreak(unlesstheallkeysargumenthasdisallowedthis).Anyother
inputispasseddirectlytogrread,givingtheapplicationcompletecontrol
overtheinputdevices.
Iftheuserpressesthepointerbuttonwithinascreenmenuorpulldownmenu
box,grreadreturnsatype6ortype11code,butinasubsequentcall,itdoes
notreturnatype12code:thetype12codefollowstype6ortype11onlywhen
thepointerbuttonispressedwhileitisinthedrawingarea.
Itisimportanttoclearthecode12datafromthebufferbeforeattempting
anotheroperationwithapointerbuttonoranauxiliarybutton.Toaccomplish
this,performanestedgrreadlikethis:
(setqcode_12(grread(setqcode(grread))))
Thissequencecapturesthevalueofthecode12listasstreaminginputfrom
thedevice.

grtext
Writestexttothestatuslineortoscreenmenuareas
(grtext[boxtext[highlight]])
Thisfunctiondisplaysthesuppliedtextinthemenuareaitdoesnotchange
theunderlyingmenuitem.Thegrtextfunctioncanbecalledwithnoarguments
torestorealltextareastotheirstandardvalues.

Arguments
box
Anintegerspecifyingthelocationinwhichtowritethetext.
text
Astringthatspecifiesthetexttobewrittentothescreenmenuorstatus
linelocation.Thetextargumentistruncatedifitistoolongtofitinthe
availablearea.
highlight
Anintegerthatselectsordeselectsascreenmenulocation.
Ifcalledwithoutarguments,grtextrestoresalltextareastotheirstandard
values.Ifcalledwithonlyoneargument,grtextresultsinanerror.

ReturnValues
Thestringpassedinthetextargument,ifsuccessful,andnilifunsuccessful
ornoargumentsaresupplied.
ScreenMenuArea
Settingboxtoapositiveorzerovaluespecifiesascreenmenulocation.Valid
boxvaluesrangefrom0tothehighestnumberedscreenmenuboxminus1.The
SCREENBOXESsystemvariablereportsthemaximumnumberofscreenmenuboxes.If
thehighlightargumentissuppliedasapositiveinteger,grtexthighlightsthe
textinthedesignatedbox.Highlightingaboxautomaticallydehighlightsany
otherboxalreadyhighlighted.Ifhighlightiszero,themenuitemis
dehighlighted.Ifhighlightisanegativenumber,itisignored.Onsome
platforms,thetextmustfirstbewrittenwithoutthehighlightargumentand
thenmustbehighlighted.Highlightingofascreenmenulocationworksonly
whenthecursorisnotinthatarea.
StatusLineArea
Ifgrtextiscalledwithaboxvalueof1,itwritesthetextintothemode
statuslinearea.Thelengthofthemodestatuslinediffersfromdisplayto
display(mostallowatleast40characters).Thefollowingcodeusesthe
$(linelen)DIESELexpressiontoreportthelengthofthemodestatusarea.

(setqmodelen(menucmd"M=$(linelen)"))
Ifaboxvalueof2isused,grtextwritesthetextintothecoordinatestatus
linearea.Ifcoordinatetrackingisturnedon,valueswrittenintothisfield
areoverwrittenassoonasthepointersendsanothersetofcoordinates.For
both1or2boxvalues,thehighlightargumentisignored.

grvecs
Drawsmultiplevectorsinthedrawingarea
(grvecsvlist[trans])

Arguments
vlist
Avectorlistiscomprisedofaseriesofoptionalcolorintegersandtwopoint
lists.See<PARAMname="Item2"value="VectorListFormatvlref132.html">for
detailsonhowtoformatvlist.
trans
Atransformationmatrixusedtochangethelocationorproportionofthe
vectorsdefinedinyourvectorlist.Thismatrixisalistoffourlistsof
fourrealnumbers.

ReturnValues
nil
VectorListFormat
Theformatforvlistisasfollows:
([color1]from1to1[color2]from2to2...)
Thecolorvalueappliestoallsucceedingvectorsuntilvlistspecifiesanother
color.AutoCADcolorsareintherange0255.Ifthecolorvalueisgreater
than255,succeedingvectorsaredrawninXORink,whichcomplementsanything
itdrawsoverandwhicherasesitselfwhenoverdrawn.Ifthecolorvalueis
lessthanzero,thevectorishighlighted.Highlightingdependsonthedisplay
device.Mostdisplaydevicesindicatehighlightingbyadashedline,butsome
indicateitbyusingadistinctivecolor.
Apairofpointlists,fromandto,specifytheendpointsofthevectors,
expressedinthecurrentUCS.Thesecanbe2Dor3Dpoints.Youmustpassthese
pointsaspairstwosuccessivepointlistsorthegrvecscallwillfail.
AutoCADclipsthevectorsasrequiredtofitonthescreen.

Examples
Thefollowingcodedrawsfiveverticallinesinthedrawingarea,eacha
differentcolor:
(grvecs'(1(12)(15)Drawsaredlinefrom(1,2)to(1,5)
2(22)(25)Drawsayellowlinefrom(2,2)to(2,5)
3(32)(35)Drawsagreenlinefrom(3,2)to(3,5)
4(42)(45)Drawsacyanlinefrom(4,2)to(4,5)
5(52)(55)Drawsabluelinefrom(5,2)to(5,5)
))
Thefollowingmatrixrepresentsauniformscaleof1.0andatranslationof
5.0,5.0,0.0.Ifthismatrixisappliedtotheprecedinglistofvectors,they
willbeoffsetby5.0,5.0,0.0.
'((1.00.00.05.0)
(0.01.00.05.0)
(0.00.01.00.0)
(0.00.00.01.0)

)
SeeAlso
Thenentselpfunctionformoreinformationontransformationmatrixesandthe
grdrawfunctionforaroutinethatdrawsavectorbetweentwopoints.
================================HFunctions===================================

handent
Returnsanobject(entity)namebasedonitshandle
(handenthandle)
Thehandentfunctionreturnstheentitynameofbothgraphicandnongraphic
entities.

Arguments
handle
Astringidentifyinganentityhandle.

ReturnValues
Ifsuccessful,handentreturnstheentitynameassociatedwithhandleinthe
currenteditingsession.Ifhandentispassedaninvalidhandleorahandlenot
usedbyanyentityinthecurrentdrawing,itreturnsnil.
Thehandentfunctionreturnsentitiesthathavebeendeletedduringthecurrent
editingsession.Youcanundeletethemwiththeentdelfunction.
Anentity'snamecanchangefromoneeditingsessiontothenext,butan
entity'shandleremainsconstant.

Examples
Command:(handent"5A2")
<Entityname:60004722>
Usedwiththesamedrawingbutinanothereditingsession,thesamecallmight
returnadifferententityname.Oncetheentitynameisobtained,youcanuse
ittomanipulatetheentitywithanyoftheentityrelatedfunctions.

help
InvokestheHelpfacility
(help[helpfile[topic[command]]])

Arguments
helpfile
AstringnamingtheHelpfile.Thefileextensionisnotrequiredwiththe
helpfileargument.Ifafileextensionisprovided,AutoCADlooksonlyfora
filewiththeexactnamespecified.
Ifnofileextensionisprovided,AutoCADlooksforhelpfilewithanextension
of.chm.Ifnofileofthatnameisfound,AutoCADlooksforafilewithan
extensionof.hlp.
topic
AstringidentifyingaHelptopicID.IfyouarecallingatopicwithinaCHM
file,providethefilenamewithouttheextensionAutoCADaddsan.htm
extension.
command
AstringthatspecifiestheinitialstateoftheHelpwindow.Thecommand

argumentisastringusedbytheuCommand(inHTMLHelp)orthefuCommand(in
WinHelp)argumentoftheHtmlHelp()andWinHelp()functionsasdefinedinthe
MicrosoftWindowsSDK.
ForHTMLHelpfiles,thecommandparametercanbeHH_ALINK_LOOKUPor
HH_DISPLAY_TOPIC.ForWindowsHelpfiles,thecommandparametercanbe
HELP_CONTENTS,HELP_HELPONHELP,orHELP_PARTIALKEY.

ReturnValues
Thehelpfilestring,ifsuccessful,otherwisenil.Ifyouusehelpwithoutany
arguments,itreturnsanemptystring("")ifsuccessful,andnilifitfails.
Theonlyerrorconditionthatthehelpfunctionreturnstotheapplicationis
theexistenceofthefilespecifiedbyhelpfile.Allothererrorconditionsare
reportedtotheuserthroughadialogbox.

Examples
ThefollowingcodecallshelptodisplaytheinformationonMYCOMMANDinthe
Helpfileachelp.chm:
(help"achelp.chm""mycommand")
SeeAlso
ThesetfunhelpfunctionassociatescontextsensitiveHelp(whentheuser
pressesF1)withauserdefinedcommand.
================================IFunctions===================================

if
Conditionallyevaluatesexpressions
(iftestexprthenexpr[elseexpr])

Arguments
testexpr
Expressiontobetested.
thenexpr
Expressionevaluatediftestexprisnotnil.
elseexpr
Expressionevaluatediftestexprisnil.

ReturnValues
Theiffunctionreturnsthevalueoftheselectedexpression.Ifelseexpris
missingandtestexprisnil,thenifreturnsnil.

Examples
Command:(if(=13)"YES!!""no.")
"no."
Command:(if(=2(+11))"YES!!")
"YES!!"
Command:(if(=2(+34))"YES!!")
nil
SeeAlso
Theprognfunction.

initdia

Forcesthedisplayofthenextcommand'sdialogbox
(initdia[dialogflag])
Currently,thefollowingcommandsmakeuseoftheinitdiafunction:ATTDEF,
ATTEXT,BHATCH,BLOCK,COLOR,IMAGE,IMAGEADJUST,INSERT,LAYER,LINETYPE,
MTEXT,PLOT,RENAME,STYLE,TOOLBAR,andVIEW.

Arguments
dialogflag
Aninteger.Ifthisargumentisnotpresentorispresentandnonzero,thenext
use(andnextuseonly)ofacommandwilldisplaythatcommand'sdialogbox
ratherthanitscommandlineprompts.
Ifdialogflagiszero,anypreviouscalltothisfunctioniscleared,restoring
thedefaultbehaviorofpresentingthecommandlineinterface.

ReturnValues
nil

Examples
IssuethePLOTcommandwithoutcallinginitdiafirst:
Command:(command"_.PLOT")
plot
Enteralayoutname<Model>:nil
Enteralayoutname<Model>:
AutoCADpromptsforuserinputinthecommandwindow.
UsethefollowingsequenceoffunctioncallstomakeAutoCADdisplaythePlot
dialogbox:
(initdia)
(command"_.PLOT")

initget
Establisheskeywordsforusebythenextuserinputfunctioncall
(initget[bits][string])
Thefunctionsthathonorkeywordsaregetint,getreal,getdist,getangle,
getorient,getpoint,getcorner,getkword,entsel,nentsel,andnentselp.The
getstringfunctionistheonlyuserinputfunctionthatdoesnothonor
keywords.
Thekeywordsarecheckedbythenextuserinputfunctioncallwhentheuser
doesnotentertheexpectedtypeofinput(forexample,apointtogetpoint).
Iftheuserinputmatchesakeywordfromthelist,thefunctionreturnsthat
keywordasastringresult.Theapplicationcantestforthekeywordsand
performtheactionassociatedwitheachone.Iftheuserinputisnotan
expectedtypeanddoesnotmatchakeyword,AutoCADaskstheusertotryagain.
Theinitgetbitvaluesandkeywordsapplyonlytothenextuserinputfunction
call.
Ifinitgetsetsacontrolbitandtheapplicationcallsauserinputfunction
forwhichthebithasnomeaning,thebitisignored.
Iftheuserinputfailsoneormoreofthespecifiedconditions(asinazero
valuewhenzerovaluesarenotallowed),AutoCADdisplaysamessageandasks
theusertotryagain.

Arguments
bits
Abitcodedintegerthatallowsordisallowscertaintypesofuserinput.The
bitscanbeaddedtogetherinanycombinationtoformavaluebetween0and

255.Ifnobitsargumentissupplied,zero(noconditions)isassumed.Thebit
valuesareasfollows:
1(bit0)Preventstheuserfromrespondingtotherequestbyenteringonly
ENTER.
2(bit1)Preventstheuserfromrespondingtotherequestbyenteringzero.
4(bit2)Preventstheuserfromrespondingtotherequestbyenteringa
negativevalue.
8(bit3)Allowstheusertoenterapointoutsidethecurrentdrawinglimits.
ThisconditionappliestothenextuserinputfunctioneveniftheAutoCAD
systemvariableLIMCHECKiscurrentlyset.
16(bit4)(Notcurrentlyused.)
32(bit5)Usesdashedlineswhendrawingarubberbandlineorbox.Forthose
functionswithwhichtheusercanspecifyapointbyselectingalocationin
thedrawingarea,thisbitvaluecausestherubberbandlineorboxtobe
dashedinsteadofsolid.(Somedisplaydriversuseadistinctivecolorinstead
ofdashedlines.)IfthesystemvariablePOPUPSis0,AutoCADignoresthisbit.
64(bit6)ProhibitsinputofaZcoordinatetothegetdistfunctionletsan
applicationensurethatthisfunctionreturnsa2Ddistance.
128(bit7)Allowsarbitraryinputasifitisakeyword,firsthonoringany
othercontrolbitsandlistedkeywords.Thisbittakesprecedenceoverbit0
ifbits7and0aresetandtheuserpressesENTER,anullstringisreturned.

Note:FutureversionsofAutoLISPmayuseadditionalinitgetcontrolbits,so
avoidsettingbitsthatarenotlistedhere.
string
Astringrepresentingaseriesofkeywords.SeeKeywordSpecificationsfor
informationondefiningkeywords.

ReturnValues
nil
FunctionApplicableControlBits
Thespecialcontrolvaluesarehonoredonlybythosegetxxxfunctionsforwhich
theymakesense,asindicatedinthefollowingtable:
++++++++++
|Userinputfunctionsandapplicablecontrolbits|
++++++++++
|Function|Honors|Controlbitsvalues|
||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||||||||
++++++++++
KeywordSpecifications
Thestringargumentisinterpretedaccordingtothefollowingrules:

*Eachkeywordisseparatedfromthefollowingkeywordbyoneormorespaces.
Forexample,"WidthHeightDepth"definesthreekeywords.
*Eachkeywordcancontainonlyletters,numbers,andhyphens().
Therearetwomethodsforabbreviatingkeywords:
*Therequiredportionofthekeywordisspecifiedinuppercasecharacters,
andtheremainderofthekeywordisspecifiedinlowercasecharacters.The
uppercaseabbreviationcanbeanywhereinthekeyword(forexample,
"LType","eXit",or"toP").
*Theentirekeywordisspecifiedinuppercasecharacters,anditisfollowed
immediatelybyacomma,whichisfollowedbytherequiredcharacters(for
example,"LTYPE,LT").Thekeywordcharactersinthiscasemustincludethe
firstletterofthekeyword,whichmeansthat"EXIT,X"isnotvalid.
Thetwobriefexamples,"LType"and"LTYPE,LT",areequivalent:iftheuser
typesLT(ineitheruppercaseorlowercaseletters),thisissufficientto
identifythekeyword.Theusercanentercharactersthatfollowtherequired
portionofthekeyword,providedtheydon'tconflictwiththespecification.In
theexample,theusercouldalsoenterLTYorLTYP,butLwouldnotbe
sufficient.
Ifstringshowsthekeywordentirelyinuppercaseorlowercasecharacterswith
nocommafollowedbyarequiredpart,AutoCADrecognizesthekeywordonlyif
theuserentersallofit.
Theinitgetfunctionprovidessupportforlocalizedkeywords.Thefollowing
syntaxforthekeywordstringallowsinputofthelocalizedkeywordwhileit
returnsthelanguageindependentkeyword:
"local1local2localn_indep1indep2indepn"
wherelocal1throughlocalnarethelocalizedkeywords,andindep1through
indepnarethelanguageindependentkeywords.
Theremustalwaysbethesamenumberoflocalizedkeywordsas
languageindependentkeywords,andthefirstlanguageindependentkeywordis
prefixedbyanunderscoreasshowninthefollowingexample:
(initget"AbcDef_GhiJkl")
(getkword"\nEnteranoption(Abc/Def):")
EnteringAreturnsGhiandentering_JreturnsJkl.
SeeAlso
TheControlofUserInputFunctionConditionstopicintheVisualLISP
Developer'sGuide.

inters
Findstheintersectionoftwolines
(interspt1pt2pt3pt4[onseg])
AllpointsareexpressedintermsofthecurrentUCS.Ifallfourpoint
argumentsare3D,interschecksfor3Dintersection.Ifanyofthepointsare
2D,intersprojectsthelinesontothecurrentconstructionplaneandchecks
onlyfor2Dintersection.

Arguments
pt1
Oneendpointofthefirstline.
pt2
Theotherendpointofthefirstline.
pt3
Oneendpointofthesecondline.
pt4

Theotherendpointofthesecondline.
onseg
Ifspecifiedasnil,thelinesdefinedbythefourptargumentsareconsidered
infiniteinlength.Iftheonsegargumentisomittedorisnotnil,the
intersectionpointmustlieonbothlinesorintersreturnsnil.

ReturnValues
Iftheonsegargumentispresentandisnil,intersreturnsthepointwherethe
linesintersect,evenifthatpointisofftheendofoneorbothofthelines.
Iftheonsegargumentisomittedorisnotnil,theintersectionpointmustlie
onbothlinesorintersreturnsnil.Theintersfunctionreturnsnilifthetwo
linesdonotintersect.

Examples
(setqa'(1.01.0)b'(9.09.0))
(setqc'(4.01.0)d'(4.02.0))
Command:(intersabcd)
nil
Command:(intersabcdT)
nil
Command:(intersabcdnil)
(4.04.0)

itoa
Returnstheconversionofanintegerintoastring
(itoaint)

Arguments
int
Aninteger.

ReturnValues
Astringderivedfromint.

Examples
Command:(itoa33)
"33"
Command:(itoa17)
"17"
SeeAlso
Theatoifunction.
================================LFunctions===================================

lambda
Definesananonymousfunction
(lambdaargumentsexpr...)
Usethelambdafunctionwhentheoverheadofdefininganewfunctionisnot
justified.Italsomakestheprogrammer'sintentionmoreapparentbylayingout

thefunctionatthespotwhereitistobeused.Thisfunctionreturnsthe
valueofitslastexpr,andisoftenusedinconjunctionwithapplyand/or
mapcartoperformafunctiononalist.

Arguments
arguments

Argumentspassedtoanexpression.
expr
AnAutoLISPexpression.

ReturnValues
Thevalueofthelastexpr.

Examples
ThefollowingexamplesdemonstratethelambdafunctionfromtheVisualLISP
Consolewindow:
_$(apply'(lambda(xyz)
(*x(yz))
)
'(52014)
)
30
_$(setqcounter0)
(mapcar'(lambda(x)
(setqcounter(1+counter))
(*x5)
)
'(24610.2)
)
0
(10203051.0)

last
Returnsthelastelementinalist
(lastlst)

Arguments
lst
Alist.

ReturnValues
Anatomoralist.

Examples
Command:(last'(abcde))
E
Command:(last'(abc(de)))
(DE)

layoutlist
Returnsalistofallpaperspacelayoutsinthecurrentdrawing
(layoutlist)

ReturnValues
Alistofstrings.

Examples
Command:(layoutlist)
("Layout1""Layout2")

length
Returnsanintegerindicatingthenumberofelementsinalist
(lengthlst)

Arguments
lst
Alist.

ReturnValues
Aninteger.

Examples
Command:(length'(abcd))
4
Command:(length'(ab(cd)))
3
Command:(length'())
0
SeeAlso
Thevllistlengthfunction.

list
Takesanynumberofexpressions,andcombinesthemintoonelist
(list[expr...])
Thisfunctionisfrequentlyusedtodefinea2Dor3Dpointvariable(alistof
twoorthreereals).

Arguments
expr
AnAutoLISPexpression.

ReturnValues

Alist,unlessnoexpressionsaresupplied,inwhichcaselistreturnsnil.

Examples
_$(list'a'b'c)
(ABC)
_$(list'a'(bc)'d)
(A(BC)D)
_$(list3.96.7)
(3.96.7)
Asanalternativetousingthelistfunction,youcanexplicitlyquotealist
withthequotefunctioniftherearenovariablesorundefineditemsinthe
list.Thesinglequotecharacter(')isdefinedasthequotefunction.
_$'(3.96.7)meansthesameas(list3.96.7)
Thiscanbeusefulforcreatingassociationlistsanddefiningpoints.
SeeAlso
Thequote,andvllistlengthfunctions.

listp
Verifiesthatanitemisalist
(listpitem)

Arguments
item
Anyatom,list,orexpression.

ReturnValues
Tifitemisalist,nilotherwise.Becausenilisbothanatomandalist,the
listpfunctionreturnsTwhenpassednil.

Examples
Command:(listp'(abc))
T
Command:(listp'a)
nil
Command:(listp4.343)
nil
Command:(listpnil)
T
Command:(listp(setqv1'(1243)))
T
SeeAlso
Thevllist_starandvllistlengthfunctions.

load

EvaluatestheAutoLISPexpressionsinafile
(loadfilename[onfailure])
TheloadfunctioncanbeusedfromwithinanotherAutoLISPfunction,oreven
recursively(inthefilebeingloaded).

Arguments
filename
Astringthatrepresentsthefilename.Ifthefilenameargumentdoesnot
specifyafileextension,loadaddsanextensiontothenamewhensearchingfor
afiletoload.Thefunctionwilltryseveralextensions,ifnecessary,inthe
followingorder:
*.vlx
*.fas
*.lsp
Assoonasloadfindsamatch,itstopssearchingandloadsthefile.
Thefilenamecanincludeadirectoryprefix,asin"c:/function/test1".A
forwardslash(/)ortwobackslashes(\\)arevaliddirectorydelimiters.If
youdon'tincludeadirectoryprefixinthefilenamestring,loadsearchesthe
AutoCADlibrarypathforthespecifiedfile.Ifthefileisfoundanywhereon
thispath,loadthenloadsthefile.
onfailure
Avaluereturnedifloadfails.
IftheonfailureargumentisavalidAutoLISPfunction,itisevaluated.In
mostcases,theonfailureargumentshouldbeastringoranatom.Thisallows
anAutoLISPapplicationcallingloadtotakealternativeactionuponfailure.

ReturnValues
Unspecified,ifsuccessful.Ifloadfails,itreturnsthevalueofonfailure
ifonfailureisnotdefined,failureresultsinanerrormessage.

Examples
Forthefollowingexamples,assumethatfile/fred/test1.lspcontainsthe
expressions
(defunMYFUNC1(x)
...functionbody...
)
(defunMYFUNC2(x)
...functionbody...
andthatnofilenamedtest2witha.lsp,.fas,or.vlxextensionexists:
Command:(load"/fred/test1")
MYFUNC2
Command:(load"\\fred\\test1")
MYFUNC2
Command:(load"/fred/test1""bad")
MYFUNC2
Command:(load"test2""bad")
"bad"
Command:(load"test2")causesanAutoLISPerror
SeeAlso
Thedefunandvlloadallfunctionsinthisreference,andSymboland
FunctionHandlingintheVisualLISPDeveloper'sGuide.

load_dialog
LoadsaDCLfile
(load_dialogdclfile)
Theload_dialogfunctionsearchesforfilesaccordingtotheAutoCADlibrary
searchpath.
Thisfunctionisthecomplementofunload_dialog.Anapplicationcanload
multipleDCLfileswithmultipleload_dialogcalls.

Arguments
dclfile
AstringthatspecifiestheDCLfiletoload.Ifthedclfileargumentdoesnot
specifyafileextension,.dclisassumed.

ReturnValues
Apositiveintegervalue(dcl_id)ifsuccessful,oranegativeintegerif
load_dialogcan'topenthefile.Thedcl_idisusedasahandleinsubsequent
new_dialogandunload_dialogcalls.

log
Returnsthenaturallogofanumberasarealnumber
(lognum)

Arguments
num
Apositivenumber.

ReturnValues
Arealnumber.

Examples
Command:(log4.5)
1.50408
Command:(log1.22)
0.198851

logand
ReturnstheresultofthelogicalbitwiseANDofalistofintegers
(logand[intint...])

Arguments
int
Aninteger.

ReturnValues
Aninteger(0,ifnoargumentsaresupplied).

Examples
Command:(logand7153)

3
Command:(logand2315)
2
Command:(logand834)
0

logior
ReturnstheresultofthelogicalbitwiseinclusiveORofalistofintegers
(logior[intint...])

Arguments
int
Aninteger.

ReturnValues
Aninteger(0,ifnoargumentsaresupplied).

Examples
Command:(logior124)
7
Command:(logior93)
11

lsh
Returnsthelogicalbitwiseshiftofanintegerbyaspecifiednumberofbits
(lsh[intnumbits])

Arguments
int
Aninteger.
numbits
Numberofbitstoshiftint.
Ifnumbitsispositive,intisshiftedtotheleftifnumbitsisnegative,int
isshiftedtotheright.Ineithercase,zerobitsareshiftedin,andthebits
shiftedoutarediscarded.
Ifnumbitsisnotspecified,noshiftoccurs.

ReturnValues
Thevalueofintafterthebitwiseshift.Thereturnedvalueispositiveifthe
significantbit(bitnumber31)containsa0aftertheshiftoperation,
otherwiseitisnegative.Ifnoargumentsaresupplied,lshreturns0.
Thebehaviorisdifferentfromotherlanguages(>>&<<ofC,C++,orJava)
wheremorethan32leftshifts(ofa32bitinteger)results0.Inrightshift
alsotheintegerappearsagainonevery32shifts.

Examples
Command:(lsh21)

4
Command:(lsh21)
1
Command:(lsh402)
160
================================MFunctions===================================

mapcar
Returnsalistthatistheresultofexecutingafunctionwithalist(or
lists)suppliedasargumentstothefunction
(mapcarfunctionlist1...listn)

Arguments
function
Afunction.
list1...listn
Oneormorelists.Thenumberoflistsmustmatchthenumberofarguments
requiredbyfunction.

ReturnValues
Alist.

Examples
Command:(setqa10b20c30)
30
Command:(mapcar'1+(listabc))
(112131)
Thisisequivalenttothefollowingseriesofexpressions:
(1+a)
(1+b)
(1+c)
exceptthatmapcarreturnsalistoftheresults.
Thelambdafunctioncanspecifyananonymousfunctiontobeperformedby
mapcar.Thisisusefulwhensomeofthefunctionargumentsareconstantorare
suppliedbysomeothermeans.Thefollowingexample,enteredfromtheVisual
LISPConsolewindow,demonstratestheuseoflambdawithmapcar:
_$(mapcar'(lambda(x)
(+x3)
)
'(102030)
)
(132333)

max
Returnsthelargestofthenumbersgiven

(max[numbernumber...])

Arguments
number
Anumber.

ReturnValues
Anumber.Ifanyoftheargumentsarerealnumbers,arealisreturned,
otherwiseanintegerisreturned.Ifnoargumentissupplied,maxreturns0.

Examples
Command:(max4.07144)
4.07
Command:(max881952)
19
Command:(max2.148)
8.0

mem
DisplaysthecurrentstateoftheAutoLISPmemory
(mem)
ThememfunctiondisplaysstatisticsonAutoLISPmemoryusage.Thefirstline
ofthisstatisticsreportcontainsthefollowinginformation:
GCcalls
NumberofgarbagecollectioncallssinceAutoLISPstarted.
GCruntime
Totaltimespentcollectinggarbage(inmilliseconds).
LISPobjectsareallocatedindynamic(heap)memorythatisorganizedin
segmentsanddividedintopages.Memoryisdescribedundertheheading,
"Dynamicmemorysegmentsstatistics:"
PgSz
Dynamicmemorypagesize(inKB).
Used
Numberofpagesused.
Free
Numberoffree(empty)pages.
FMCL
Largestcontiguousareaoffreepages.
Segs
Numberofsegmentsallocated.
Type
Internaldescriptionofthetypesofobjectsallocatedinthissegment.These
include:
lispstacksLISPinternalstacks
bytecodeareacompiledcodefunctionmodules
CONSmemoryCONSobjects

::newuntypedmemoryrequestsservedusingthissegment
DMStrdynamicstringbodies
DMxxmemoryallotherLISPnodes
bstackbodyinternalstructureusedforIOoperations
Thefinallineinthereportliststheminimalsegmentsizeandthenumberof
allocatedsegments.AutoLISPkeepsalistofnomorethanthreefreesegments,
inordertosavesystemcallsformemoryrequests.
Allheapmemoryisglobalthatis,allAutoCADdocumentssharethesameheap.
ThiscouldchangeinfuturereleasesofAutoCAD.

Notethatmemdoesnotlistallmemoryrequestedfromtheoperatingsystem,
onlythoserequestsservedbytheAutoLISPDynamicMemory(DM)subsystemsome
AutoLISPclassesdonotuseDMformemoryallocation.

ReturnValues
nil

Examples
Command:(mem)
GCcalls:23GCruntime:298ms
Dynamicmemorysegmentsstatistic:
PgSzUsedFreeFMCLSegsType
5127948481lispstacks
256370642314216bytecodearea
4096320101022CONSmemory
32769121310891::new
4096168121012DMStr
40962224415DMxxmemory
12845075071bstackbody
Segmentsize:65536,totalused:68,free:0
nil

member
Searchesalistforanoccurrenceofanexpressionandreturnstheremainderof
thelist,startingwiththefirstoccurrenceoftheexpression
(memberexprlst)

Arguments
expr
Theexpressiontobesearchedfor.
lst
Thelistinwhichtosearchforexpr.

ReturnValues
Alist,ornil,ifthereisnooccurrenceofexprinlst.

Examples
Command:(member'c'(abcde))
(CDE)

Command:(member'q'(abcde))
nil

menucmd
Issuesmenucommands,orsetsandretrievesmenuitemstatus
(menucmdstring)
ThemenucmdfunctioncanswitchbetweensubpagesinanAutoCADmenu.This
functioncanalsoforcethedisplayofmenus.ThisallowsAutoLISPprogramsto
useimagetilemenusandtodisplayothermenusfromwhichtheusercanmake
selections.AutoLISPprogramscanalsoenable,disable,andplacemarksinmenu
items.

Arguments
string
Astringthatspecifiesamenuareaandthevaluetoassigntothatmenuarea.
Thestringargumenthasthefollowingparameters.
"menu_area=value"
Theallowedvaluesofmenu_area,showninthefollowinglist,arethesameas
theyareinmenufilesubmenureferences.Formoreinformation,seePullDown
andShortcutMenusintheCustomizationGuide.
B1B4BUTTONSmenus1through4.
A1A4AUXmenus1through4.
P0P16Pulldown(POP)menus0through16.
IImagetilemenus.
SSCREENmenu.
T1T4TABLETmenus1through4.
MDIESELstringexpressions.
Gmenugroup.nametagAmenugroupandnametag.

ReturnValues
nil

Examples
ThefollowingcodedisplaystheimagetilemenuMOREICONS.
(menucmd"I=moreicons")LoadstheMOREICONSimagetilemenu
(menucmd"I=*")Displaysthemenu
Thefollowingcodechecksthestatusofthethirdmenuiteminthepulldown
menuPOP11.Ifthemenuitemiscurrentlyenabled,themenucmdfunction
disablesit.
(setqs(menucmd"P11.3=?"))Getsthestatusofthemenuitem
(if(=s"")Ifthestatusisanemptystring,
(menucmd"P11.3=~")disablethemenuitem
)
Thepreviouscodeisnotfoolproof.Inadditiontobeingenabledordisabled,
menuitemscanalsoreceivemarks.Thecode(menucmd"P11.3=?")couldreturn
"!.",indicatingthatthemenuitemiscurrentlychecked.Thiscodewould
assumethatthemenuitemisdisabledandcontinuewithoutdisablingit.Ifthe
codeincludedacalltothewcmatchfunction,itcouldcheckthestatusforan
occurrenceofthetilde(~)characterandthentakeappropriateaction.
ThemenucmdfunctionalsoallowsAutoLISPprogramstotakeadvantageofthe
DIESELstringexpressionlanguage.Somethingscanbedonemucheasierwith
DIESELthanwiththeequivalentAutoLISPcode.Thefollowingcodereturnsa

stringcontainingthecurrentdayanddate:
(menucmd"M=$(edtime,$(getvar,date),DDDD\",\"DMONTHYYYY)")
returns"Sunday,16July1995"
SeeAlso
TheCustomizationGuideformoreinformationonusingAutoLISPtoaccessmenu
labelstatus,andforinformationonusingDIESEL.

menugroup
Verifiesthatamenugroupisloaded
(menugroupgroupname)

Arguments
groupname
Astringthatspecifiesthemenugroupname.

ReturnValues
Ifgroupnamematchesaloadedmenugroup,thefunctionreturnsthegroupname
stringotherwise,itreturnsnil.

min
Returnsthesmallestofthenumbersgiven
(min[numbernumber...])

Arguments
number
Anumber.

ReturnValues
Anumber.Ifanynumberargumentisareal,arealisreturned,otherwisean
integerisreturned.Ifnoargumentissupplied,minreturns0.

Examples
Command:(min68310.0)
10.0
Command:(min732485)
2
Command:(min73.02485)
2.0
Command:(min246.7)
2.0

minusp
Verifiesthatanumberisnegative

(minuspnum)

Arguments
num
Anumber.

ReturnValues
Tifnumberisnegative,nilotherwise.

Examples
Command:(minusp1)
T
Command:(minusp4.293)
T
Command:(minusp830.2)
nil

mode_tile
Setsthemodeofadialogboxtile
(mode_tilekeymode)

Arguments
key
Astringthatspecifiesthetile.Thekeyargumentiscasesensitive.
mode
Anintegerthatcanbeoneofthefollowing:
0Enabletile
1Disabletile
2Setfocustotile
3Selecteditboxcontents
4Flipimagehighlightingonoroff

ReturnValues
nil
================================NFunctions===================================

namedobjdict
Returnstheentitynameofthecurrentdrawing'snamedobjectdictionary,which
istherootofallnongraphicalobjectsinthedrawing
(namedobjdict)
Usingthenamereturnedbythisfunctionandthedictionaryaccessfunctions,
anapplicationcanaccessthenongraphicalobjectsinthedrawing.

nentsel

Promptstheusertoselectanobject(entity)byspecifyingapoint,and
providesaccesstothedefinitiondatacontainedwithinacomplexobject
(nentsel[msg])
Thenentselfunctionpromptstheusertoselectanobject.ThecurrentObject
Snapmodeisignoredunlesstheuserspecificallyrequestsit.Toprovide
additionalsupportattheCommandprompt,nentselhonorskeywordsdefinedbya
previouscalltoinitget.

Arguments
msg
Astringtobedisplayedasaprompt.Ifthemsgfunctionisomitted,the
Selectobjectpromptisissued.

ReturnValues
Whentheselectedobjectisnotcomplex(i.e.,nota3Dpolylineorblock),
nentselreturnsthesameinformationasentsel.However,iftheselectedobject
isa3Dpolyline,nentselreturnsalistcontainingthenameofthesubentity
(vertex)andthepickpoint.Thisissimilartothelistreturnedbyentsel,
exceptthatthenameoftheselectedvertexisreturnedinsteadofthepolyline
header.Thenentselfunctionalwaysreturnsthestartingvertexoftheselected
3Dpolylinesegment.Pickingthethirdsegmentofthepolyline,forexample,
returnsthethirdvertex.TheSeqendsubentityisneverreturnedbynentselfor
a3Dpolyline.

Note:Alightweightpolyline(lwpolylineentity)isdefinedinthedrawing
databaseasasingleentityitdoesnotcontainsubentities.
Selectinganattributewithinablockreferencereturnsthenameofthe
attributeandthepickpoint.Whentheselectedobjectisacomponentofa
blockreferenceotherthananattribute,nentselreturnsalistcontainingfour
elements.
Thefirstelementofthelistreturnedfrompickinganobjectwithinablockis
theselectedentity'sname.Thesecondelementisalistcontainingthe
coordinatesofthepointusedtopicktheobject.
ThethirdelementiscalledtheModeltoWorldTransformationMatrix.Itisa
listconsistingoffoursublists,eachofwhichcontainsasetofcoordinates.
Thismatrixcanbeusedtotransformtheentitydefinitiondatapointsfroman
internalcoordinatesystemcalledtheModelCoordinateSystem(MCS),tothe
WorldCoordinateSystem(WCS).Theinsertionpointoftheblockthatcontains
theselectedentitydefinestheoriginoftheMCS.TheorientationoftheUCS
whentheblockiscreateddeterminesthedirectionoftheMCSaxes.

Note:nentselistheonlyAutoLISPfunctionthatusesamatrixofthistype
thenentselpfunctionreturnsamatrixsimilartothoseusedbyotherAutoLISP
andObjectARXfunctions.
Thefourthelementisalistcontainingtheentitynameoftheblockthat
containstheselectedobject.Iftheselectedobjectisinanestedblock(a
blockwithinablock),thelistadditionallycontainstheentitynamesofall
blocksinwhichtheselectedobjectisnested,startingwiththeinnermost
blockandcontinuingoutwarduntilthenameoftheblockthatwasinsertedin
thedrawingisreported.
ForinformationonconvertingMCScoordinatestoWCS,seeEntityContextand
CoordinateTransformDataintheUsingAutoLISPtoManipulateAutoCADObjects
chapteroftheVisualLISPDeveloper'sGuide.

Examples
Drawa3Dpolylinewithmultiplelinesegments,thenloadandrunthefollowing
functionandselectdifferentsegmentsoftheline.Pickoffofthelineand
thenpickthesamesegmentsagaintoseethesubentityhandle.Tryitwitha
lightweightpolylinetoseethedifference.
(defunc:subent()
(while
(setqEnt(entsel"\nPickanentity:"))
(print(strcat"Entityhandleis:"
(cdr(assoc5(entget(carEnt))))))
)

(while
(setqEnt(nentsel"\nPickanentityorsubEntity:"))
(print(strcat"EntityorsubEntityhandleis:"
(cdr(assoc5(entget(carEnt))))))
)
(prompt"\nDone.")
(princ)
)
SeeAlso
Theentsel,andnentselpfunctionsinthisreferenceandEntity
NameFunctionsintheVisualLISPDeveloper'sGuide.

nentselp
Providessimilarfunctionalitytothatofthenentselfunctionwithouttheneed
foruserinput
(nentselp[msg][pt])

Arguments
msg
Astringtobedisplayedasaprompt.Ifthemsgargumentisomitted,the
Selectobjectpromptisissued.
pt
Aselectionpoint.Thisallowsobjectselectionwithoutuserinput.

ReturnValues
Thenentselpfunctionreturnsa4x4transformationmatrix,definedas
follows:
Thefirstthreecolumnsofthematrixspecifyscalingandrotation.Thefourth
columnisatranslationvector.
Thefunctionsthatuseamatrixofthistypetreatapointasacolumnvector
ofdimension4.Thepointisexpressedinhomogeneouscoordinates,wherethe
fourthelementofthepointvectorisascalefactorthatisnormallysetto
1.0.Thefinalrowofthematrix,thevector[M30M31M32M33],hasthenominal
valueof[0001]itiscurrentlyignoredbythefunctionsthatusethis
matrixformat.Inthisconvention,applyingatransformationtoapointisa
matrixmultiplicationthatappearsasfollows:
Thismultiplicationgivesustheindividualcoordinatesofthepointas
follows:
Astheseequationsshow,thescalefactorandthelastrowofthematrixhave
noeffectandareignored.
SeeAlso
Thenentselfunction.

new_dialog
Beginsanewdialogboxanddisplaysit,andcanalsospecifyadefaultaction
(new_dialogdlgnamedcl_id[action[screenpt]])

Arguments
dlgname

Astringthatspecifiesthedialogbox.
dcl_id
TheDCLfileidentifierobtainedbyload_dialog.
action
AstringthatcontainsanAutoLISPexpressiontouseasthedefaultaction.If
youdon'twanttodefineadefaultaction,specifyanemptystring("").The
actionargumentisrequiredifyouspecifyscreenpt.
Thedefaultactionisevaluatedwhentheuserpicksanactivetilethatdoesn't
haveanactionorcallbackexplicitlyassignedtoitbyaction_tileorinDCL.
screenpt
A2DpointlistthatspecifiestheX,Ylocationofthedialogboxonthe
screen.Thepointspecifiestheupperleftcornerofthedialogbox.Ifyou
passthepointas'(11),thedialogboxisopenedinthedefaultposition
(thecenteroftheAutoCADdrawingarea).

ReturnValues
T,ifsuccessful,otherwisenil.
SeeAlso
TheManagingDialogBoxeschapteroftheVisualLISPDeveloper'sGuide.

not
Verifiesthatanitemevaluatestonil
(notitem)
Typically,thenullfunctionisusedforlists,andnotisusedforotherdata
typesalongwithsometypesofcontrolfunctions.

Arguments
item
AnAutoLISPexpression.

ReturnValues
Tifitemevaluatestonil,nilotherwise.

Examples
Command:(setqa123b"string"cnil)
nil
Command:(nota)
nil
Command:(notb)
nil
Command:(notc)
T
Command:(not'())
T
SeeAlso
Thenullfunction.

nth
Returnsthenthelementofalist
(nthnlst)

Arguments
n
Thenumberoftheelementtoreturnfromthelist(zeroisthefirstelement).
lst
Thelist.

ReturnValues
Thenthelementoflst.Ifnisgreaterthanthehighestelementnumberoflst,
nthreturnsnil.

Examples
Command:(nth3'(abcde))
D
Command:(nth0'(abcde))
A
Command:(nth5'(abcde))
nil

null
Verifiesthatanitemisboundtonil
(nullitem)

Arguments
item
AnAutoLISPexpression.

ReturnValues
Tifitemevaluatestonil,nilotherwise.

Examples
Command:(setqa123b"string"cnil)
nil
Command:(nulla)
nil
Command:(nullb)
nil
Command:(nullc)
T
Command:(null'())
T
SeeAlso

Thenotfunction.

numberp
Verifiesthatanitemisarealnumberoraninteger
(numberpitem)

Arguments
item
AnAutoLISPexpression.

ReturnValues
Tifitemevaluatestoarealoraninteger,nilotherwise.

Examples
Command:(setqa123b'a)
A
Command:(numberp4)
T
Command:(numberp3.8348)
T
Command:(numberp"Howdy")
nil
Command:(numberpa)
T
Command:(numberpb)
nil
Command:(numberp(evalb))
T
================================OFunctions===================================

open
OpensafileforaccessbytheAutoLISPI/Ofunctions
(openfilenamemode)

Arguments
filename
Astringthatspecifiesthenameandextensionofthefiletobeopened.Ifyou
donotspecifythefullpathnameofthefile,openassumesyouarereferring
totheAutoCADstartupdirectory.
mode
Indicateswhetherthefileisopenforreading,writing,orappending.Specify
astringcontainingoneofthefollowingletters:
rOpenforreading.
wOpenforwriting.Iffilenamedoesnotexist,anewfileiscreatedand
opened.Iffilenamealreadyexists,itsexistingdataisoverwritten.Data
passedtoanopenfileisnotactuallywrittenuntilthefileisclosedwith

theclosefunction.
aOpenforappending.Iffilenamedoesnotexist,anewfileiscreatedand
opened.Iffilenamealreadyexists,itisopenedandthepointerispositioned
attheendoftheexistingdata,sonewdatayouwritetothefileisappended
totheexistingdata.
Themodeargumentcanbeuppercaseorlowercase.Notethatinreleasespriorto
AutoCAD2000,modehadtobespecifiedinlowercase.

ReturnValues
Ifsuccessful,openreturnsafiledescriptorthatcanbeusedbytheotherI/O
functions.Ifmode"r"isspecifiedandfilenamedoesnotexist,openreturns
nil.

Note:OnDOSsystems,someprogramsandtexteditorswritetextfileswithan
endoffilemarker(CTRL+Z,decimalASCIIcode26)attheendofthetext.When
readingatextfile,DOSreturnsanendoffilestatusifaCTRL+Zmarkeris
encountered,evenifthatmarkerisfollowedbymoredata.Ifyouintendtouse
open's"a"modetoappenddatatofilesproducedbyanotherprogram,becertain
theotherprogramdoesnotinsertCTRL+Zmarkersattheendofitstextfiles.

Examples
Openanexistingfile:
Command:(setqa(open"c:/programfiles/AutoCAD/help/filelist.txt""r"))
#<file"c:/programfiles/AutoCAD/help/filelist.txt">
Thefollowingexamplesissueopenagainstfilesthatdonotexist:
Command:(setqf(open"c:\\mydocuments\\new.tst""w"))
#<file"c:\\mydocuments\\new.tst">
Command:(setqf(open"nosuch.fil""r"))
nil
Command:(setqf(open"logfile""a"))
#<file"logfile">

or
ReturnsthelogicalORofalistofexpressions
(or[expr...])
Theorfunctionevaluatestheexpressionsfromlefttoright,lookingfora
nonnilexpression.

Arguments
expr
Theexpressionstobeevaluated.

ReturnValues
T,ifanonnilexpressionisfound,ornil,ifalloftheexpressionsarenil
ornoargumentsaresupplied.

NotethatoracceptsanatomasanargumentandreturnsTifoneissupplied.
Examples
Command:(ornil45'())
T
Command:(ornil'())
nil

osnap
Returnsa3DpointthatistheresultofapplyinganObjectSnapmodetoa
specifiedpoint
(osnapptmode)

Arguments
pt
Apoint.
mode
AstringthatconsistsofoneormorevalidObjectSnapidentifierssuchas
mid,cen,andsoon,separatedbycommas.

ReturnValues
Apoint,ornil,ifthepickdidnotreturnanobject(forexample,thereisno
geometryunderthepickaperture,orthegeometryisnotapplicabletothe
selectedobjectsnapmode).Thepointreturnedbyosnapdependsonthecurrent
3Dview,theAutoCADentityaroundpt,andthesettingoftheAPERTUREsystem
variable.

Examples
Command:(setqpt1(getpoint))
(11.86373.282690.0)
Command:(setqpt2(osnappt1"_end,_int"))
(12.14243.421810.0)
================================PFunctions===================================

polar
ReturnstheUCS3Dpointataspecifiedangleanddistancefromapoint
(polarptangdist)

Arguments
pt
A2Dor3Dpoint.
ang
AnangleexpressedinradiansrelativetotheworldXaxis.Anglesincreasein
thecounterclockwisedirection,independentofthecurrentconstructionplane.
dist
Distancefromthespecifiedpt.

ReturnValues
A2Dor3Dpoint,dependingonthetypeofpointspecifiedbypt.

Examples
Supplyinga3Dpointtopolar:
Command:(polar'(113.5)0.7853981.414214)
(2.02.03.5)
Supplyinga2Dpointtopolar:
Command:(polar'(11)0.7853981.414214)
(2.02.0)

prin1
Printsanexpressiontothecommandlineorwritesanexpressiontoanopenfile
(prin1[expr[filedesc]])

Arguments
expr
AstringorAutoLISPexpression.Onlythespecifiedexprisprintednonewline
orspaceisincluded.
filedesc
Afiledescriptorforafileopenedforwriting.

ReturnValues
Thevalueoftheevaluatedexpr.Ifcalledwithnoarguments,prin1returnsa
nullsymbol.
Usedasthelastexpressioninafunction,prin1withoutargumentsresultsina
blanklineprintingwhenthefunctioncompletes,allowingthefunctiontoexit
"quietly."

Examples
Command:(setqa123b'(a))
(A)
Command:(prin1'a)
AA
ThepreviouscommandprintedAandreturnedA.
Command:(prin1a)
123123
Thepreviouscommandprinted123andreturned123.
Command:(prin1b)
(A)(A)
Thepreviouscommandprinted(A)andreturned(A).
Eachprecedingexampleisdisplayedonthescreenbecausenofiledescwas
specified.Assumingthatfisavalidfiledescriptorforafileopenedfor
writing,thefollowingfunctioncallwritesastringtothatfileandreturns
thestring:
Command:(prin1"Hello"f)
"Hello"
Ifexprisastringcontainingcontrolcharacters,prin1expandsthese
characterswithaleading\,asshowninthefollowingtable:
+++
|Controlcodes|
+++
|Code|Description|
+++
|\\|\character|
+++
|\"|"character|
+++
|\e|Escapecharacter|
+++
|\n|Newlinecharacter|
+++
|\r|Returncharacter|
+++

|\t|TABcharacter|
+++
|\nnn|Characterwhoseoctalcodeisnnn|
+++
Thefollowingexampleshowshowtousecontrolcharacters:
Command:(prin1(chr2))
"\002""\002"
SeeAlso
TheDisplayingMessagestopicintheVisualLISPDeveloper'sGuide.

princ
Printsanexpressiontothecommandline,orwritesanexpressiontoanopen
file
(princ[expr[filedesc]])
Thisfunctionisthesameasprin1,exceptcontrolcharactersinexprare
printedwithoutexpansion.Ingeneral,prin1isdesignedtoprintexpressions
inawaythatiscompatiblewithload,whileprincprintstheminawaythatis
readablebyfunctionssuchasreadline.

Arguments
expr
AstringorAutoLISPexpression.Onlythespecifiedexprisprintednonewline
orspaceisincluded.
filedesc
Afiledescriptorforafileopenedforwriting.

ReturnValues
Thevalueoftheevaluatedexpr.Ifcalledwithnoarguments,princreturnsa
nullsymbol.
SeeAlso
TheDisplayingMessagestopicintheVisualLISPDeveloper'sGuide.

print
Printsanexpressiontothecommandline,orwritesanexpressiontoanopen
file
(print[expr[filedesc]])
Thisfunctionisthesameasprin1,exceptitprintsanewlinecharacterbefore
expr,andprintsaspacefollowingexpr.

Arguments
expr
AstringorAutoLISPexpression.Onlythespecifiedexprisprintednonewline
orspaceisincluded.
filedesc
Afiledescriptorforafileopenedforwriting.

ReturnValues
Thevalueoftheevaluatedexpr.Ifcalledwithnoarguments,printreturnsa
nullsymbol.
SeeAlso

TheDisplayingMessagestopicintheVisualLISPDeveloper'sGuide.

progn
Evaluateseachexpressionsequentiallyandreturnsthevalueofthelast
expression
(progn[expr]...)
Youcanuseprogntoevaluateseveralexpressionswhereonlyoneexpressionis
expected.

Arguments
expr
OneormoreAutoLISPexpressions.

ReturnValues
Theresultofthelastevaluatedexpression.

Examples
Theiffunctionnormallyevaluatesonethenexpressionifthetestexpression
evaluatestoanythingbutnil.Thefollowingexampleusesprogntoevaluatetwo
expressionsfollowingif:
(if(=ab)
(progn
(princ"\nA=B")
(setqa(+a10)b(b10))
)
)
SeeAlso
Theiffunction.

prompt
Displaysastringonyourscreen'spromptarea
(promptmsg)
OndualscreenAutoCADconfigurations,promptdisplaysmsgonbothscreensand
is,therefore,preferabletoprinc.

Arguments
msg
Astring.

ReturnValues
nil

Examples
Command:(prompt"Newvalue:")
Newvalue:nil
SeeAlso
TheDisplayingMessagestopicintheVisualLISPDeveloper'sGuide.

================================QFunctions===================================

quit
Forcesthecurrentapplicationtoquit
(quit)
Ifquitiscalled,itreturnstheerrormessagequit/exitabortandreturnsto
theAutoCADCommandprompt.
SeeAlso
Theexitfunction.

quote
Returnsanexpressionwithoutevaluatingit
(quoteexpr)

Arguments
expr
AnAutoLISPexpression.

ReturnValues
Theexprargument.

Examples
Command:(quotea)
A
Thepreviousexpressioncanalsobewrittenas'a.Forexample:
Command:!'a
A
Command:(quote(ab))
(AB)
SeeAlso
Thefunctionfunction.
================================RFunctions===================================

read
Returnsthefirstlistoratomobtainedfromastring
(read[string])
ThereadfunctionparsesthestringrepresentationofanyLISPdataandreturns
thefirstexpressioninthestring,convertingittoacorrespondingdatatype.

Arguments
string
Astring.Thestringargumentshouldnotcontainblanks,exceptwithinalist
orstring.

ReturnValues
Alistoratom.Thereadfunctionreturnsitsargumentconvertedintothe
correspondingdatatype.Ifnoargumentisspecified,readreturnsnil.
IfthestringcontainsmultipleLISPexpressionsseparatedbyLISPsymbol
delimiterssuchasblanks,newline,tabs,orparentheses,onlythefirst
expressionisreturned.

Examples
Command:(read"hello")
HELLO
Command:(read"hellothere")
HELLO
Command:(read"\"HiY'all\"")
"HiY'all"
Command:(read"(abc)")
(ABC)
Command:(read"(abc)(d)")
(ABC)
Command:(read"1.2300")
1.23
Command:(read"87")
87
Command:(read"873.2")
87

readchar
ReturnsthedecimalASCIIcoderepresentingthecharacterreadfromthe
keyboardinputbufferorfromanopenfile
(readchar[filedesc])

Arguments
filedesc
Afiledescriptor(obtainedfromopen)referringtoanopenfile.Ifno
filedescisspecified,readcharobtainsinputfromthekeyboardinputbuffer.

ReturnValues
AnintegerrepresentingtheASCIIcodeforacharacter.Thereadcharfunction
returnsasinglenewlinecharacter(ASCIIcode10)wheneveritdetectsan
endoflinecharacterorcharactersequence.

Examples
Thefollowingexampleomitsfiledesc,soreadcharlooksfordatainthe
keyboardbuffer:
Command:(readchar)
Thekeyboardbufferisempty,soreadcharwaitsforuserinput.
ABC
65
TheuserenteredABCreadcharreturnedtheASCIIcoderepresentingthefirst
characterentered(A).Thenextthreecallstoreadcharreturnthedata

remaininginthekeyboardinputbuffer.Thisdatatranslatesto66(theASCII
codefortheletterB),67(C),and10(newline),respectively:
Command:(readchar)
66
Command:(readchar)
67
Command:(readchar)
10
Withthekeyboardinputbuffernowempty,readcharwaitsforuserinputthe
nexttimeitiscalled:
Command:(readchar)

readline
Readsastringfromthekeyboardorfromanopenfile,untilanendofline
markerisencountered
(readline[filedesc])

Arguments
filedesc
Afiledescriptor(obtainedfromopen)referringtoanopenfile.Ifno
filedescisspecified,readlineobtainsinputfromthekeyboardinputbuffer.

ReturnValues
Thestringreadbyreadline,withouttheendoflinemarker.Ifreadline
encounterstheendofthefile,itreturnsnil.

Examples
Openafileforreading:
Command:(setqf(open"c:\\mydocuments\\new.tst""r"))
#<file"c:\\mydocuments\\new.tst">
Usereadlinetoreadalinefromthefile:
Command:(readlinef)
"Toboldlygowherenomadhasgonebefore."
Obtainalineofinputfromtheuser:
Command:(readline)
Toboldlygo
"Toboldlygo"

redraw
Redrawsthecurrentviewportoraspecifiedobject(entity)inthecurrent
viewport
(redraw[ename[mode]])
Ifredrawiscalledwithnoarguments,thefunctionredrawsthecurrent
viewport.Ifcalledwithanentitynameargument,redrawredrawsthespecified
entity.
Theredrawfunctionhasnoeffectonhighlightedorhiddenentities,howevera

REGENcommandforcestheentitiestoredisplayintheirnormalmanner.

Arguments
ename
Thenameoftheentitynametoberedrawn.
mode
Anintegervaluethatcontrolsthevisibilityandhighlightingoftheentity.
Themodecanbeoneofthefollowingvalues:
1Showentity
2Hideentity(blankitout)
3Highlightentity
4Unhighlightentity
Theuseofentityhighlighting(mode3)mustbebalancedwithentity
unhighlighting(mode4).
Ifenameistheheaderofacomplexentity(apolylineorablockreference
withattributes),redrawprocessesthemainentityandallitssubentitiesif
themodeargumentispositive.Ifthemodeargumentisnegative,redraw
operatesononlytheheaderentity.

ReturnValues
Theredrawfunctionalwaysreturnsnil.

regapp
RegistersanapplicationnamewiththecurrentAutoCADdrawinginpreparation
forusingextendedobjectdata
(regappapplication)

Arguments
application
Astringnamingtheapplication.Thenamemustbeavalidsymboltablename.
SeethedescriptionofsnvalidfortherulesAutoLISPusestodetermineifa
symbolnameisvalid.

ReturnValues
Ifanapplicationofthesamenamehasalreadybeenregistered,thisfunction
returnsnilotherwiseitreturnsthenameoftheapplication.
Ifregisteredsuccessfully,theapplicationnameisenteredintotheAPPID
symboltable.Thistablemaintainsalistoftheapplicationsthatareusing
extendeddatainthedrawing.

Examples
(regapp"ADESK_4153322344")
(regapp"DESIGNERv2.1124753")

Note:Itisrecommendedthatyoupickauniqueapplicationname.Onewayof
ensuringthisistoadoptanamingschemethatusesthecompanyorproductname
andauniquenumber(likeyourtelephonenumberorthecurrentdate/time).The
productversionnumbercanbeincludedintheapplicationnameorstoredbythe
applicationinaseparateintegerorrealnumberfieldforexample,(1040
2.1).

rem
Dividesthefirstnumberbythesecond,andreturnstheremainder

(rem[numbernumber...])

Arguments
number
Anynumber.
Ifyouprovidemorethantwonumbers,remdividestheresultofdividingthe
firstnumberbythesecondwiththethird,andsoon.
Ifyouprovidemorethantwonumbers,remevaluatestheargumentsfromleftto
right.Forexample,ifyousupplythreenumbers,remdividesthefirstnumber
bythesecond,thentakestheresultanddividesitbythethirdnumber,
returningtheremainderofthatoperation.

ReturnValues
Anumber.Ifanynumberargumentisareal,remreturnsareal,otherwiserem
returnsaninteger.Ifnoargumentsaresupplied,remreturns0.Ifasingle
numberargumentissupplied,remreturnsnumber.

Examples
Command:(rem4212)
6
Command:(rem12.016)
12.0
Command:(rem2672)
1

repeat
Evaluateseachexpressionaspecifiednumberoftimes,andreturnsthevalueof
thelastexpression
(repeatint[expr...])

Arguments
int
Aninteger.Mustbeapositivenumber.
expr
Oneormoreatomsorexpressions.

ReturnValues
Thevalueofthelastexpressionoratomevaluated.Ifexprisnotsupplied,
repeatreturnsnil.

Examples
Command:(setqa10b100)
100
Command:(repeat4(setqa(+a10))(setqb(+b100)))
500
Afterevaluation,ais50,bis500,andrepeatreturns500.
Ifstringsaresuppliedasarguments,repeatreturnsthelaststring:
Command:(repeat100"Me""You")
"You"

reverse
Returnsacopyofalistwithitselementsreversed
(reverselst)

Arguments
lst
Alist.

ReturnValues
Alist.

Examples
Command:(reverse'((a)bc))
(CB(A))

rtos
Convertsanumberintoastring
(rtosnumber[mode[precision]])
Thertosfunctionreturnsastringthatistherepresentationofnumber
accordingtothesettingsofmode,precision,andthesystemvariables
UNITMODE,DIMZIN,LUNITS,andLUPREC.

Arguments
number
Anumber.
mode
Anintegerspecifyingthelinearunitsmode.Themodecorrespondstothevalues
allowedfortheLUNITSAutoCADsystemvariable.Themodecanbeoneofthe
followingnumbers:
1Scientific
2Decimal
3Engineering(feetanddecimalinches)
4Architectural(feetandfractionalinches)
5Fractional
precision
Anintegerspecifyingtheprecision.
ThemodeandprecisionargumentscorrespondtothesystemvariablesLUNITSand
LUPREC.Ifyouomitthearguments,rtosusesthecurrentsettingsofLUNITSand
LUPREC.

ReturnValues
Astring.TheUNITMODEsystemvariableaffectsthereturnedstringwhen
engineering,architectural,orfractionalunitsareselected(modevalues3,4,
or5).

Examples
Setvariablex:
Command:(setqx17.5)
17.5

Convertthevalueofxtoastringinscientificformat,withaprecisionof4:
Command:(setqfmtval(rtosx14))
"1.7500E+01"
Convertthevalueofxtoastringindecimalformat,with2decimalplaces:
Command:(setqfmtval(rtosx22))
"17.50"
Convertthevalueofxtoastringinengineeringformat,withaprecisionof
2:
Command:(setqfmtval(rtosx32))
"1'5.50\""
Convertthevalueofxtoastringinarchitecturalformat:
Command:(setqfmtval(rtosx42))
"1'51/2\""
Convertthevalueofxtoastringinfractionalformat:
Command:(setqfmtval(rtosx52))
"171/2"
SettingUNITMODEto1causesunitstobedisplayedasentered.Thisaffectsthe
valuesreturnedbyrtosforengineering,architectural,andfractionalformats,
asshowninthefollowingexamples:
Command:(setvar"unitmode"1)
1
Command:(setqfmtval(rtosx32))
"1'5.50\""
Command:(setqfmtval(rtosx42))
"1'51/2\""
Command:(setqfmtval(rtosx52))
"171/2"
SeeAlso
TheStringConversionstopicintheVisualLISPDeveloper'sGuide.
================================SFunctions===================================

set
Setsthevalueofaquotedsymbolnametoanexpression
(setsymexpr)
Thesetfunctionissimilartosetqexceptthatsetevaluatesbothofits
argumentswhereassetqonlyevaluatesitssecondargument.

Arguments
sym
Asymbol.
expr
AnAutoLISPexpression.

ReturnValues
Thevalueoftheexpression.

Examples
Eachofthefollowingcommandssetssymbolato5.0:
(set'a5.0)
(set(read"a")5.0)
(setqa5.0)
Bothsetandsetqexpectasymbolastheirfirstargument,butsetacceptsan
expressionthatreturnsasymbol,whereassetqdoesnot,asthefollowing
shows:
Command:(set(read"a")5.0)
5.0
Command:(setq(read"a")5.0)
ERROR:syntaxerror
SeeAlso
Thesetqfunction.

set_tile
Setsthevalueofadialogboxtile
(set_tilekeyvalue)

Arguments
key
Astringthatspecifiesthetile.
value
Astringthatnamesthenewvaluetoassign(initiallysetbythevalue
attribute).

ReturnValues
Thevaluethetilewassetto.

setcfg
WritesapplicationdatatotheAppDatasectionoftheacad.cfgfile
(setcfgcfgnamecfgval)

Arguments
cfgname
Astringthatspecifiesthesectionandparametertosetwiththevalueof
cfgval.Thecfgnameargumentmustbeastringofthefollowingform:
AppData/application_name/section_name/.../param_name
Thestringcanbeupto496characterslong.
cfgval
Astring.Thestringcanbeupto512charactersinlength.Largerstringsare
acceptedbysetcfg,butcannotbereturnedbygetcfg.

ReturnValues
Ifsuccessful,setcfgreturnscfgval.Ifcfgnameisnotvalid,setcfgreturns

nil.

Examples
ThefollowingcodesetstheWallThkparameterintheAppData/ArchStuffsection
to8,andreturnsthestring"8":
Command:(setcfg"AppData/ArchStuff/WallThk""8")
"8"
SeeAlso
Thegetcfgfunction.

setenv
Setsasystemenvironmentvariabletoaspecifiedvalue
(setenvvarnamevalue)

Arguments
varname
Astringspecifyingthenameoftheenvironmentvariabletobeset.Environment
variablenamesmustbespelledandcasedexactlyastheyarestoredinthe
systemregistry.
value
Astringspecifyingthevaluetosetvarnameto.

ReturnValues
value

Examples
ThefollowingcommandsetsthevalueoftheMaxArrayenvironmentvariableto
10000:
Command:(setenv"MaxArray""10000")
"10000"

NotethatchangestosettingsmightnottakeeffectuntilthenexttimeAutoCAD
isstarted.
SeeAlso
Thegetenvfunction.

setfunhelp
RegistersauserdefinedcommandwiththeHelpfacilitysotheappropriateHelp
fileandtopicarecalledwhentheuserrequestshelponthatcommand
(setfunhelpc:fname[helpfile[topic[command]]])

Arguments
c:fname
Astringspecifyingtheuserdefinedcommand(theC:XXXfunction).Youmust
includethec:prefix.
helpfile
AstringnamingtheHelpfile.Thefileextensionisnotrequiredwiththe
helpfileargument.Ifafileextensionisprovided,AutoCADlooksonlyfora
filewiththeexactnamespecified.

Ifnofileextensionisprovided,AutoCADlooksforhelpfilewithanextension
of.chm.Ifnofileofthatnameisfound,AutoCADlooksforfilewithan
extensionof.hlp.
topic
AstringidentifyingaHelptopicID.IfyouarecallingatopicwithinaCHM
file,providethefilenamewithouttheextensionAutoCADaddsan.htm
extension.
command
AstringthatspecifiestheinitialstateoftheHelpwindow.Thecommand
argumentisastringusedbytheuCommand(inHTMLHelp)orthefuCommand(in
WinHelp)argumentoftheHtmlHelp()andWinHelp()functionsasdefinedinthe
MicrosoftWindowsSDK.
ForHTMLHelpfiles,thecommandparametercanbeHH_ALINK_LOOKUPor
HH_DISPLAY_TOPIC.ForWindowsHelpfiles,thecommandparametercanbe
HELP_CONTENTS,HELP_HELPONHELP,orHELP_PARTIALKEY.

ReturnValues
Thestringpassedasc:fname,ifsuccessful,otherwise,nil.
Thisfunctionverifiesonlythatthec:fnameargumenthasthec:prefix.It
doesnotverifythatthec:fnamefunctionexists,nordoesitverifythe
correctnessoftheotherargumentssupplied.

Examples
Thefollowingexampleillustratestheuseofsetfunhelpbydefiningasimple
functionandissuingsetfunhelptoassociatethefunctionwiththecircletopic
intheAutoCADHelpfile(acad.chm):
(defunc:foo()
(getstring"PressF1forhelponthefoocommand:")
)
(setfunhelp"c:foo""acad.chm""circle")
Afterthiscodeisloaded,issuingthefoocommandandthenpressingF1
displaysthecircletopic.
Thisexampleworks,butservesnorealpurpose.Intherealworld,youwould
createyourownHelpfileandassociatethathelpfileandtopicwithyour
function.
Defineafunctionnamedtest:
Command:(defunc:test()(getstring"\nTEST:")(princ))
C:TEST
AssociatethefunctionwithacalltoHelpwiththestring"line":
Command:(setfunhelp"c:test""acad.chm""line")
"c:test"
Runthetestcommandandattheprompt,pressF1youshouldseetheHelptopic
fortheAutoCADLINEcommand.

Note:WhenyouusethedefunfunctiontodefineaC:XXXfunction,itremoves
thatfunction'snamefromthoseregisteredbysetfunhelp(ifoneexists).
Therefore,setfunhelpshouldonlybecalledafterthedefuncall,whichdefines
theuserdefinedcommand.
SeeAlso
Thedefunandhelpfunctions.

setq
Setsthevalueofasymbolorsymbolstoassociatedexpressions
(setqsymexpr[symexpr]...)

ThisisthebasicassignmentfunctioninAutoLISP.Thesetqfunctioncanassign
multiplesymbolsinonecalltothefunction.

Arguments
sym
Asymbol.Thisargumentisnotevaluated.
expr
Anexpression.

ReturnValues
Theresultofthelastexprevaluated.

Examples
Thefollowingfunctioncallsetsvariableato5.0:
Command:(setqa5.0)
5.0
Wheneveraisevaluated,itreturnstherealnumber5.0.
Thefollowingcommandsetstwovariables,bandc:
Command:(setqb123c4.7)
4.7
setqreturnsthevalueofthelastvariableset.
Inthefollowingexample,sissettoastring:
Command:(setqs"it")
"it"
Thefollowingexampleassignsalisttox:
Command:(setqx'(ab))
(AB)
SeeAlso
TheAutoLISPVariablestopicintheVisualLISPDeveloper'sGuide.

setvar
SetsanAutoCADsystemvariabletoaspecifiedvalue
(setvarvarnamevalue)

Arguments
varname
Astringorsymbolnamingavariable.
value
Anatomorexpressionwhoseevaluatedresultistobeassignedtovarname.For
systemvariableswithintegervalues,thesuppliedvaluemustbebetween
32,768and+32,767.

ReturnValues
Ifsuccessful,setvarreturnsvalue.

Examples
SettheAutoCADfilletradiusto0.5units:
Command:(setvar"FILLETRAD"0.50)

0.5

NotesonUsingsetvar
SomeAutoCADcommandsobtainthevaluesofsystemvariablesbeforeissuingany
prompts.Ifyouusesetvartosetanewvaluewhileacommandisinprogress,
thenewvaluemightnottakeeffectuntilthenextAutoCADcommand.
WhenusingthesetvarfunctiontochangetheAutoCADsystemvariableANGBASE,
thevalueargumentisinterpretedasradians.ThisdiffersfromtheAutoCAD
SETVARcommand,whichinterpretsthisargumentasdegrees.Whenusingthe
setvarfunctiontochangetheAutoCADsystemvariableSNAPANG,thevalue
argumentisinterpretedasradiansrelativetotheAutoCADdefaultdirection
forangle0,whichiseastor3o'clock.ThisalsodiffersfromtheSETVAR
command,whichinterpretsthisargumentasdegreesrelativetotheANGBASE
setting.

Note:TheUNDOcommanddoesnotundochangesmadetotheCVPORTsystem
variablebythesetvarfunction.
YoucanfindalistofthecurrentAutoCADsystemvariablesintheCommand
Reference.
SeeAlso
Thegetvarfunction.

setview
Establishesaviewforaspecifiedviewport
(setviewview_descriptor[vport_id])

Arguments
view_descriptor
Anentitydefinitionlistsimilartothatreturnedbytblsearchwhenappliedto
theVIEWsymboltable.
vport_id
Anintegeridentifyingtheviewporttoreceivethenewview.Ifvport_idis0,
thecurrentviewportreceivesthenewview.
Youcanobtainthevport_idnumberfromtheCVPORTsystemvariable.

ReturnValues
Ifsuccessful,thesetviewfunctionreturnstheview_descriptor.

sin
Returnsthesineofanangleasarealnumberexpressedinradians
(sinang)

Arguments
ang
Anangle,inradians.

ReturnValues
Arealnumberrepresentingthesineofang,inradians.

Examples
Command:(sin1.0)
0.841471

Command:(sin0.0)
0.0

slide_image
DisplaysanAutoCADslideinthecurrentlyactivedialogboximagetile
(slide_imagex1y1widthheightsldname)

Arguments
x1
Xoffsetfromtheupperleftcornerofthetile,inpixels.Mustbeapositive
value.
y1
Yoffsetfromtheupperleftcornerofthetile,inpixels.Mustbeapositive
value.
width
Widthoftheimage,inpixels.
height
Heightoftheimage,inpixels.
sldname
Identifiestheslide.Thisargumentcanbeaslidefile(.sld)oraslideina
slidelibraryfile(.slb).Specifysldnamethesamewayyouwouldspecifyit
fortheVSLIDEcommandorforamenufile(seetheCreatingImagestopicinthe
VisualLISPDeveloper'sGuide).Useoneofthefollowingformatsforsldname:
sldnameorlibname(sldname)
Thefirst(upperleft)corneroftheslideitsinsertionpointislocatedat
(x1,y1),andthesecond(lowerright)cornerislocatedattherelative
distance(wid,hgt)fromthefirst(widandhgtmustbepositivevalues).The
origin(0,0)istheupperleftcorneroftheimage.Youobtainthecoordinates
ofthelowerrightcornerbycallingthedimensionfunctions(dimx_tileand
dimy_tile).

ReturnValues
Astringcontainingsldname.

Examples
(slide_image
0
0
(dimx_tile"slide_tile")
(dimy_tile"slide_tile")
"myslide"
)
(end_image)

snvalid
Checksthesymboltablenameforvalidcharacters

(snvalidsym_name[flag])
ThesnvalidfunctioninspectsthesystemvariableEXTNAMEStodeterminethe
rulestoenforcefortheactivedrawing.IfEXTNAMESis0,snvalidvalidates
usingthesymbolnamerulesineffectpriortoAutoCAD2000.IfEXTNAMESis1
(thedefaultvalue),snvalidvalidatesusingtherulesforextendedsymbol
namesintroducedwithAutoCAD2000.Thefollowingarenotallowedinanysymbol
names,regardlessofthesettingofEXTNAMES:
*Controlandgraphiccharacters
*Nullstrings
*Verticalbarsasthefirstorlastcharacterofthename
AutoLISPdoesnotenforcerestrictionsonthelengthofsymboltablenamesif
extnamesis1.

Arguments
sym_name
Astringthatspecifiesasymboltablename.
flag
Anintegerthatspecifieswhethertheverticalbarcharacterisallowedwithin
sym_name.Theflagargumentcanbeoneofthefollowing:
0Donotallowverticalbarcharactersanywhereinsym_name.Thisisthe
default.
1Allowverticalbarcharactersinsym_name,aslongastheyarenotthefirst
orlastcharactersinthename.

ReturnValues
T,ifsym_nameisavalidsymboltablename,otherwisenil.
Ifextnamesis1,allcharactersareallowedexceptcontrolandgraphic
charactersandthefollowing:
+++
|Charactersdisallowedinsymboltablenames|
+++
|<>|lessthanandgreaterthansymbol|
+++
|/\|forwardslashandbackslash|
+++
|"|quotationmark|
+++
|:|colon|
+++
|?|questionmark|
+++
|*|asterisk|
+++
|||verticalbar|
+++
|,|comma|
+++
|=|equalsign|
+++
|`|backquote|
+++
||Semicolon(ASCII59)|
+++
Asymboltablenamemaycontainspaces.
Ifextnamesis0,symboltablenamescanconsistofupperandlowercase
alphabeticletters(e.g.,AZ),numericdigits(e.g.,09),andthedollarsign
($),underscore(_),andhyphen()characters.

Examples
ThefollowingexamplesassumeEXTNAMESissetto1:
Command:(snvalid"hocuspocus")
T
Command:(snvalid"hocuspocus")
T

Command:(snvalid"hocus%pocus")
T
ThefollowingexamplesassumeEXTNAMESissetto0:
Command:(snvalid"hocuspocus")
T
Command:(snvalid"hocuspocus")
nil
Command:(snvalid"hocus%pocus")
nil
Thefollowingexampleincludesaverticalbarinthesymboltablename:
Command:(snvalid"hocus|pocus")
nil
Bydefault,theverticalbarcharacterisconsideredinvalidinallsymbol
tablenames.
Inthefollowingexample,theflagargumentissetto1,sosnvalidconsiders
theverticalbarcharactertobevalidinsym_name,aslongasitisnotthe
firstorlastcharacterinthename:
Command:(snvalid"hocus|pocus"1)
T

sqrt
Returnsthesquarerootofanumberasarealnumber
(sqrtnum)

Arguments
num
Anumber(integerorreal).

ReturnValues
Arealnumber.

Examples
Command:(sqrt4)
2.0
Command:(sqrt2.0)
1.41421

ssadd
Addsanobject(entity)toaselectionset,orcreatesanewselectionset
(ssadd[ename[ss]])

Arguments
ename
Anentityname.

ss
Aselectionset.
Ifcalledwithnoarguments,ssaddconstructsanewselectionsetwithno
members.Ifcalledwiththesingleentitynameargumentename,ssaddconstructs
anewselectionsetcontainingthatsingleentity.Ifcalledwithanentity
nameandtheselectionsetss,ssaddaddsthenamedentitytotheselection
set.

ReturnValues
Thenewormodifiedselectionset.

Examples
Whenaddinganentitytoaset,thenewentityisaddedtotheexistingset,
andthesetpassedasssisreturnedastheresult.Thus,ifthesetis
assignedtoothervariables,theyalsoreflecttheaddition.Ifthenamed
entityisalreadyintheset,thessaddoperationisignoredandnoerroris
reported.
Sete1tothenameofthefirstentityindrawing:
Command:(setqe1(entnext))
<Entityname:1d62d60>
Setsstoanullselectionset:
Command:(setqss(ssadd))
<Selectionset:2>
Thefollowingcommandaddsthee1entitytotheselectionsetreferencedbyss:
Command:(ssadde1ss)
<Selectionset:2>
Gettheentityfollowinge1:
Command:(setqe2(entnexte1))
<Entityname:1d62d68>
Adde2tothessentity:
Command:(ssadde2ss)
<Selectionset:2>

ssdel
Deletesanobject(entity)fromaselectionset
(ssdelenamess)

Arguments
ename
Anentityname.
ss
Aselectionset.

ReturnValues
Thenameoftheselectionset,ornil,ifthespecifiedentityisnotinthe
set.

Notethattheentityisactuallydeletedfromtheexistingselectionset,as
opposedtoanewsetbeingreturnedwiththeelementdeleted.

Examples

Inthefollowingexamples,entitynamee1isamemberofselectionsetss,
whileentitynamee3isnotamemberofss:
Command:(ssdele1ss)
<Selectionset:2>
Selectionsetssisreturnedwithentitye1removed.
Command:(ssdele3ss)
nil
Thefunctionreturnsnilbecausee3isnotamemberofselectionsetss.

ssget
Createsaselectionsetfromtheselectedobject
(ssget[selmethod][pt1[pt2]][ptlist][filterlist])
Selectionsetscancontainobjectsfrombothpaperandmodelspace,butwhen
theselectionsetisusedinanoperation,ssgetfiltersoutobjectsfromthe
spacenotcurrentlyineffect.Selectionsetsreturnedbyssgetcontainmain
entitiesonly(noattributesorpolylinevertices).

Arguments
selmethod
Astringthatspecifiestheobjectselectionmethod.Validselectionmethods
are:
CCrossingselection.
CPCpolygonselection(allobjectscrossingandinsideofthespecified
polygon).
FFenceselection.
IImpliedselection(objectsselectedwhilePICKFIRSTisineffect).
LLastvisibleobjectaddedtothedatabase.
PLastselectionsetcreated.
WWindowselection.
WPWPolygon(allobjectswithinthespecifiedpolygon).
XEntiredatabase.IfyouspecifytheXselectionmethodanddonotprovidea
filterlist,ssgetselectsallentitiesinthedatabase,includingentitieson
layersthatareoff,frozen,andoutofthevisiblescreen.
:EEverythingwithinthecursor'sobjectselectionpickbox.
:NCallssnamexforadditionalinformationoncontainerblocksand
transformationmatricesforanyentitiesselectedduringthessgetoperation.
Thisadditionalinformationisavailableonlyforentitiesselectedvia
graphicalselectionmethodssuchasWindow,Crossing,andpointpicks.
Unliketheotherobjectselectionmethods,:Nmayreturnmultipleentitieswith
thesameentitynameintheselectionset.Forexample,iftheuserselectsa
subentityofacomplexentitysuchasaBlockReference,PolygonMesh,orold
stylepolyline,ssgetlooksatthesubentitythatisselectedwhendetermining
ifithasalreadybeenselected.However,ssgetactuallyaddsthemainentity
(BlockReference,PolygonMesh,etc.)totheselectionset.Theresultcouldbe
multipleentrieswiththesameentitynameintheselectionset(eachwillhave
differentsubentityinformationforssnamextoreport).
:SAllowsingleselectiononly.
pt1
Apointrelativetotheselection.
pt2
Apointrelativetotheselection.

ptlist
Alistofpoints.
filterlist
Anassociationlistthatspecifiesobjectproperties.Objectsthatmatchthe
filterlistareaddedtotheselectionset.
Ifyouomitallarguments,ssgetpromptstheuserwiththeSelectobjects
prompt,allowinginteractiveconstructionofaselectionset.
Ifyousupplyapointbutdonotspecifyanobjectselectionmethod,AutoCAD
assumestheuserisselectinganobjectbypickingasinglepoint.

ReturnValues
Thenameofthecreatedselectionsetifsuccessful,ornilifnoobjectswere
selected.

NotesontheObjectSelectionMethods
*Whenusingthe:Nselectionmethod,iftheuserselectsasubentityofa
complexentitysuchasaBlockReference,PolygonMesh,oroldstyle
polyline,ssgetlooksatthesubentitythatisselectedwhendeterminingif
ithasalreadybeenselected.However,ssgetactuallyaddsthemainentity
(BlockReference,PolygonMesh,etc.)totheselectionset.Itistherefore
possibletohavemultipleentrieswiththesameentitynameinthe
selectionset(eachwillhavedifferentsubentityinformationforssnamex
toreport).Becausethe:Nmethoddoesnotguaranteethateachentrywill
beunique,codethatreliesonuniquenessshouldnotuseselectionsets
createdusingthisoption.
*WhenusingtheLselectionmethodinanMDIenvironment,youcannotalways
countonthelastobjectdrawntoremainvisible.Forexample,ifyour
applicationdrawsaline,andtheusersubsequentlyminimizesorcascades
theAutoCADdrawingwindow,thelinemaynolongerbevisible.Ifthis
occurs,ssgetwiththe"L"optionwillreturnnil.

Examples
Prompttheusertoselecttheobjectstobeplacedinaselectionset:
Command:(ssget)
<Selectionset:2>
Createaselectionsetoftheobjectpassingthrough(2,2):
Command:(ssget'(22))
nil
Createaselectionsetofthemostrecentlyselectedobjects:
Command:(ssget"_P")
<Selectionset:4>
Createaselectionsetoftheobjectscrossingtheboxfrom(0,0)to(1,1):
Command:(ssget"_C"'(00)'(11))
<Selectionset:b>
Createaselectionsetoftheobjectsinsidethewindowfrom(0,0):
Command:(ssget"_W"'(00)'(55))
<Selectionset:d>
Byspecifyingfilters,youcanobtainaselectionsetthatincludesallobjects
ofagiventype,onagivenlayer,orofagivencolor.Thefollowingexample
returnsaselectionsetthatconsistsonlyofbluelinesthatarepartofthe
impliedselectionset(thoseobjectsselectedwhilePICKFIRSTisineffect):
Command:(ssget"_I"'((0."LINE")(62.5)))
<Selectionset:4>
Thefollowingexamplesofssgetrequirethatalistofpointsbepassedtothe
function.Thept_listvariablecannotcontainpointsthatdefinezerolength
segments.

Createalistofpoints:
Command:(setqpt_list'((11)(31)(52)(24)))
((11)(31)(52)(24))
Createaselectionsetofallobjectscrossingandinsidethepolygondefined
bypt_list:
Command:(ssget"_CP"pt_list)
<Selectionset:13>
Createaselectionsetofallbluelinesinsidethepolygondefinedbypt_list:
Command:(ssget"_WP"pt_list'((0."LINE")(62.5)))
<Selectionset:8>
Theselectedobjectsarehighlightedonlywhenssgetisusedwithnoarguments.
SelectionsetsconsumeAutoCADtemporaryfileslots,soAutoLISPisnot
permittedtohavemorethan128openatonetime.Ifthislimitisreached,
AutoCADrefusestocreateanymoreselectionsetsandreturnsniltoallssget
calls.Tocloseanunnecessaryselectionsetvariable,setittonil.
AselectionsetvariablecanbepassedtoAutoCADinresponsetoanySelect
objectspromptatwhichselectionbyLastisvalid.AutoCADthenselectsall
theobjectsintheselectionsetvariable.
ThecurrentsettingofObjectSnapmodeisignoredbyssgetunlessyou
specificallyrequestitwhileyouareinthefunction.
SeeAlso
TheSelectionSetHandlingandSelectionSetFilterListstopicsintheVisual
LISPDeveloper'sGuide.

ssgetfirst
Determineswhichobjectsareselectedandgripped
(ssgetfirst)
Returnsalistoftwoselectionsetssimilartothosepassedtosssetfirst.The
firstelementinthelistisaselectionsetofentitiesthataregrippedbut
notselected.Thesecondelementisaselectionsetofentitiesthatareboth
grippedandselected.Either(orboth)elementsofthelistcanbenil.

Note:Onlyentitiesfromthecurrentdrawing'smodelspaceandpaperspace,
notnongraphicalobjectsorentitiesinotherblockdefinitions,canbe
analyzedbythisfunction.
SeeAlso
Thessgetandsssetfirstfunctions.

sslength
Returnsanintegercontainingthenumberofobjects(entities)inaselection
set
(sslengthss)

Arguments
ss
Aselectionset.

ReturnValues
Aninteger.

Examples
Addthelastobjecttoanewselectionset:
Command:(setqsset(ssget"L"))
<Selectionset:8>
Usesslengthtodeterminethenumberofobjectsinthenewselectionset:
Command:(sslengthsset)
1

ssmemb
Testswhetheranobject(entity)isamemberofaselectionset
(ssmembenamess)

Arguments
ename
Anentityname.
ss
Aselectionset.

ReturnValues
Ifenameisamemberofss,ssmembreturnstheentityname.Ifenameisnota
member,ssmembreturnsnil.

Examples
Inthefollowingexamples,entitynamee2isamemberofselectionsetss,
whileentitynamee1isnotamemberofss:
Command:(ssmembe2ss)
<Entityname:1d62d68>
Command:(ssmembe1ss)
nil

ssname
Returnstheobject(entity)nameoftheindexedelementofaselectionset
(ssnamessindex)
Entitynamesinselectionsetsobtainedwithssgetarealwaysnamesofmain
entities.Subentities(attributesandpolylinevertices)arenotreturned.(The
entnextfunctionallowsaccesstothem.)

Arguments
ss
Aselectionset.
index
Aninteger(orreal)indicatinganelementinaselectionset.Thefirst
elementinthesethasanindexofzero.Toaccessentitiesbeyondthe32767th
oneinaselectionset,youmustsupplytheindexargumentasareal.

ReturnValues

Anentityname,ifsuccessful.Ifindexisnegativeorgreaterthanthehighest
numberedentityintheselectionset,ssnamereturnsnil.

Examples
Getthenameofthefirstentityinaselectionset:
Command:(setqent1(ssnamess0))
<Entityname:1d62d68>
Getthenameofthefourthentityinaselectionset:
Command:(setqent4(ssnamess3))
<Entityname:1d62d90>
Toaccessentitiesbeyondthe32767thoneinaselectionset,youmustsupply
theindexargumentasareal,asinthefollowingexample:
(setqentx(ssnamesset50843.0))
SeeAlso
Theentnextfunction.

ssnamex
Retrievesinformationabouthowaselectionsetwascreated
(ssnamexss[index])
Onlyselectionsetswithentitiesfromthecurrentdrawing'smodelspaceand
paperspacenotnongraphicalobjectsorentitiesinotherblock
definitionscanberetrievedbythisfunction.

Arguments
ss
Aselectionset.
index
Aninteger(orreal)indicatinganelementinaselectionset.Thefirst
elementinthesethasanindexofzero.

ReturnValues
Ifsuccessful,ssnamexreturnsthenameoftheentityatindex,alongwithdata
describinghowtheentitywasselected.Iftheindexargumentisnotsupplied,
thisfunctionreturnsalistcontainingtheentitynamesofalloftheelements
intheselectionset,alongwithdatathatdescribeshoweachentitywas
selected.Ifindexisnegativeorgreaterthanthehighestnumberedentityin
theselectionset,ssnamexreturnsnil.
Thedatareturnedbyssnamextakestheformofalistofliststhatcontains
informationthateitherdescribesanentityanditsselectionmethodora
polygonusedtoselectoneormoreentities.Eachsublistthatdescribesthe
selectionofaparticularentitycomprisesthreeparts:theselectionmethodID
(aninteger>=0),theentitynameoftheselectedentity,andselectionmethod
specificdatathatdescribeshowtheentitywasselected.
((sel_id1ename1(data))(sel_id2ename2(data))...)
ThefollowingtableliststheselectionmethodIDs:
+++
|SelectionmethodIDs|
+++
|ID|Description|
+++
|0|nonspecific(i.e.,LastAlletc.)|
+++
|1|Pick|
+++
|2|WindoworWPolygon|
+++
|3|CrossingorCPolygon|

+++
|4|Fence|
+++
Eachsublistthatdescribesapolygonandisusedduringentityselectiontakes
theformofapolygonID(aninteger<0),followedbypointdescriptions.
(polygon_idpoint_description_1point_description_n...)
PolygonIDnumberingstartsat1andeachadditionalpolygonIDisincremented
by1.Dependingontheviewinglocation,apointisrepresentedasoneofthe
following:aninfiniteline,aray,oralinesegment.Apointdescriptor
comprisesthreeparts:apointdescriptorID(thetypeofitembeing
described),thestartpointoftheitem,andanoptionalunitvectorthat
describeseitherthedirectioninwhichtheinfinitelinetravelsoravector
thatdescribestheoffsettotheothersideofthelinesegment.
(point_descriptor_idbase_point[unit_or_offset_vector])
ThefollowingtableliststhevalidpointdescriptorIDs:
+++
|PointdescriptorIDs|
+++
|ID|Description|
+++
|0|Infiniteline|
+++
|1|Ray|
+++
|2|Linesegment|
+++
Theunit_or_offset_vectorisreturnedwhentheviewpointissomethingother
than0,0,1.

Examples
ThedataassociatedwithPick(type1)entityselectionsisasinglepoint
description.Forexample,thefollowingrecordisreturnedfortheselectionof
anentitypickedat1,1inplanviewoftheWCS:
Command:(ssnamexss30)
((1<Entityname:1d62da0>0(0(1.01.00.0))))
ThedataassociatedwithanentityselectedwiththeWindow,WPolygon,
Crossing,orCPolygonmethodistheintegerIDofthepolygonthatselectedthe
entity.Itisuptotheapplicationtoassociatethepolygonidentifiersand
maketheconnectionbetweenthepolygonandtheentitiesitselected.For
example,thefollowingreturnsanentityselectedbyCrossing(notethatthe
polygonIDis1):
Command:(ssnamexss40)
((3<Entityname:1d62d60>01)(1(0(1.808798.855360.0))(0(13.4004
8.855360.0))(0(13.40041.800240.0))(0(1.808791.800240.0))))
ThedataassociatedwithFenceselectionsisalistofpointsanddescriptions
forthepointswherethefenceandentityvisuallyintersect.Forexample,the
followingcommandreturnsinformationforanearlyverticallineintersected
threetimesbyaZshapedfence:
Command:(ssnamexss50)
((4<Entityname:1d62d88>0(0(5.281356.252190.0))(0(5.618682.81961
0.0))(0(5.526883.753810.0))))

sssetfirst
Setswhichobjectsareselectedandgripped
(sssetfirstgripset[pickset])
Theselectionsetofobjectsspecifiedbythegripsetargumentaregripped,and
theselectionsetofobjectsspecifiedbypicksetarebothgrippedand
selected.Ifanyobjectsarecommontobothselectionsets,sssetfirstgrips
andselectstheselectionsetspecifiedbypicksetonly(itdoesnotgripthe
gripsetset).
Youareresponsibleforcreatingavalidselectionset.Forexample,youmay

needtoverifythatabackgroundpaperspaceviewport(DXFgroupcode69)is
notincludedintheselectionset.Youmayalsoneedtoensurethatselected
objectsbelongtothecurrentlayout,asinthefollowingcode:
(setqss(ssget(list(cons410(getvar"ctab")))))

Arguments
gripset
Aselectionsettobegripped.Ifgripsetisnilandpicksetisspecified,
sssetfirstgripsandselectspickset.Ifgripsetisnilandnopicksetis
specified,sssetfirstturnsoffthegriphandlesandselectionsitpreviously
turnedon.
pickset
Aselectionsettobeselected.

ReturnValues
Theselectionsetorsetsspecified.

Examples
First,drawasquareandbuildthreeselectionsets.Beginbydrawingside1
andcreatingaselectionsettoincludethelinedrawn:
Command:(entmake(list(cons0"line")'(100.00.00.0)'(110.010.00.0)))
((0."line")(100.00.00.0)(110.010.00.0))
Command:(setqgripset(ssget"_l"))
<Selectionset:a5>
Variablegripsetpointstotheselectionsetcreated.
Drawside2andaddittothegripsetselectionset:
Command:(entmake(list(cons0"line")'(100.010.00.0)'(1110.010.00.0)))
((0."line")(100.010.00.0)(1110.010.00.0))
Command:(ssadd(entlast)gripset)
<Selectionset:a5>
Createanotherselectionsettoincludeonlyside2:
Command:(setq2onlyset(ssget"_l"))
<Selectionset:a8>
Drawside3andaddittothegripsetselectionset:
Command:(entmake(list(cons0"line")'(1010.010.00.0)'(1110.00.00.0)))
((0."line")(1010.010.00.0)(1110.00.00.0))
Command:(ssadd(entlast)gripset)
<Selectionset:a5>
Createanotherselectionandincludeside3intheselectionset:
Command:(setqpickset(ssget"_l"))
<Selectionset:ab>
Variablepicksetpointstothenewselectionset.
Drawside4andaddittothegripsetandpicksetselectionsets:
Command:(entmake(list(cons0"line")'(1010.00.00.0)'(110.00.00.0)))
((0."line")(1010.00.00.0)(110.00.00.0))
Command:(ssadd(entlast)gripset)
<Selectionset:a5>
Command:(ssadd(entlast)pickset)

<Selectionset:ab>
Atthispoint,gripsetcontainssides14,picksetcontainssides3and4,and
2onlysetcontainsonlyside2.
Turngriphandlesonforallobjectsinthegripsetselectionset:
Command:(sssetfirstgripset)
(<Selectionset:a5>)
Turngriphandlesoffforallobjectsingripset:
Command:(sssetfirstnil)
(nil)
Turngriphandlesonandselectallobjectsinpickset:
Command:(sssetfirstnilpickset)
(nil<Selectionset:ab>)
Turnongriphandlesforallobjectsin2onlyset,andselectallobjectsin
pickset:
Command:(sssetfirst2onlysetpickset)
(<Selectionset:a8><Selectionset:ab>)
Eachsssetfirstcallreplacesthegrippedandselectedselectionsetsfromthe
previoussssetfirstcall.Forexample,afterthefollowingcommandisissued,
gripsareturnedonin2onlyset,andnoselectionsetisselected:
Command:(sssetfirst2onlyset
(<Selectionset:a8>)

Note:DonotcallsssetfirstwhenAutoCADisinthemiddleofexecutinga
command.
SeeAlso
Thessgetandssgetfirstfunctions.

startapp
StartsaWindowsapplication
(startappappcmd[file])

Arguments
appcmd
Astringthatspecifiestheapplicationtoexecute.Ifappcmddoesnotinclude
afullpathname,startappsearchesthedirectoriesinthePATHenvironment
variablefortheapplication.
file
Astringthatspecifiesthefilenametobeopened.

ReturnValues
Anintegergreaterthan0,ifsuccessful,otherwisenil.

Examples
ThefollowingcodestartstheWindowsNotepadandopenstheacad.lspfile.
Command:(startapp"notepad""acad.lsp")
33
Ifanargumenthasembeddedspaces,itmustbesurroundedbyliteraldouble
quotes.Forexample,toeditthefilemystuff.txtwithNotepad,usethe
followingsyntax:

Command:(startapp"notepad.exe""\"mystuff.txt\"")
33

start_dialog
Displaysadialogboxandbeginsacceptinguserinput
(start_dialog)
Youmustfirstinitializethedialogboxbyapreviousnew_dialogcall.The
dialogboxremainsactiveuntilanactionexpressionorcallbackfunctioncalls
done_dialog.Usuallydone_dialogisassociatedwiththetilewhosekeyis
"accept"(typicallytheOKbutton)andthetilewhosekeyis"cancel"
(typicallytheCancelbutton).
Thestart_dialogfunctionhasnoarguments.

ReturnValues
Thestart_dialogfunctionreturnstheoptionalstatuspassedtodone_dialog.
Thedefaultvalueis1iftheuserpressesOK,0iftheuserpressesCancel,or
1ifalldialogboxesareterminatedwithterm_dialog.Ifdone_dialogis
passedanintegerstatusgreaterthan1,start_dialogreturnsthisvalue,whose
meaningisdeterminedbytheapplication.

start_image
Startsthecreationofanimageinthedialogboxtile
(start_imagekey)
Subsequentcallstofill_image,slide_image,andvector_imageaffectthe
createdimageuntiltheapplicationcallsend_image.

Arguments
key
Astringthatspecifiesthedialogboxtile.Thekeyargumentis
casesensitive.

ReturnValues
Thekeyargument,ifsuccessful,nilotherwise.

Note:Donotusetheset_tilefunctionbetweenstart_imageandend_image
functioncalls.

start_list
Startstheprocessingofalistinthelistboxorinthepopuplistdialog
boxtile
(start_listkey[operation[index]])
Subsequentcallstoadd_listaffecttheliststartedbystart_listuntilthe
applicationcallsend_list.

Arguments
key
Astringthatspecifiesthedialogboxtile.Thekeyargumentis
casesensitive.
operation

Anintegerindicatingthetypeoflistoperationtoperform.Youcanspecify
oneofthefollowing:
1Changeselectedlistcontents
2Appendnewlistentry
3Deleteoldlistandcreatenewlist(thedefault)
index
Anumberindicatingthelistitemtochangebythesubsequentadd_listcall.
Thefirstiteminthelistisindex0.Ifnotspecified,indexdefaultsto0.
Theindexargumentisignoredifstart_listisnotperformingachange
operation.

ReturnValues
Thenameofthelistthatwasstarted.

Note:Donotusetheset_tilefunctionbetweenstart_listandend_list
functioncalls.

strcase
Returnsastringwhereallalphabeticcharactershavebeenconvertedto
uppercaseorlowercase
(strcasestring[which])

Arguments
string
Astring.
which
IfspecifiedasT,allalphabeticcharactersinstringareconvertedto
lowercase.Otherwise,charactersareconvertedtouppercase.

ReturnValues
Astring.

Examples
Command:(strcase"Sample")
"SAMPLE"
Command:(strcase"Sample"T)
"sample"
Thestrcasefunctionwillcorrectlyhandlecasemappingofthecurrently
configuredcharacterset.

strcat
Returnsastringthatistheconcatenationofmultiplestrings
(strcat[string[string]...])

Arguments
string
Astring.

ReturnValues

Astring.Ifnoargumentsaresupplied,strcatreturnsazerolengthstring.

Examples
Command:(strcat"a""bout")
"about"
Command:(strcat"a""b""c")
"abc"
Command:(strcat"a""""c")
"ac"
Command:(strcat)
""

strlen
Returnsanintegerthatisthenumberofcharactersinastring
(strlen[string]...)

Arguments
string
Astring.

ReturnValues
Aninteger.Ifmultiplestringargumentsareprovided,strlenreturnsthesum
ofthelengthsofallarguments.Ifyouomittheargumentsorenteranempty
string,strlenreturns0.

Examples
Command:(strlen"abcd")
4
Command:(strlen"ab")
2
Command:(strlen"one""two""four")
10
Command:(strlen)
0
Command:(strlen"")
0

subst
Searchesalistforanolditemandreturnsacopyofthelistwithanewitem
substitutedinplaceofeveryoccurrenceoftheolditem
(substnewitemolditemlst)

Arguments
newitem
Anatomorlist.

olditem
Anatomorlist.
lst
Alist.

ReturnValues
Alist,withnewitemreplacingalloccurrencesofolditem.Ifolditemisnot
foundinlst,substreturnslstunchanged.

Examples
Command:(setqsample'(ab(cd)b))
(AB(CD)B)
Command:(subst'qq'bsample)
(AQQ(CD)QQ)
Command:(subst'qq'zsample)
(AB(CD)B)
Command:(subst'qq'(cd)sample)
(ABQQB)
Command:(subst'(qqrr)'(cd)sample)
(AB(QQRR)B)
Command:(subst'(qqrr)'zsample)
(AB(CD)B)
Whenusedinconjunctionwithassoc,substprovidesaconvenientmeansof
replacingthevalueassociatedwithonekeyinanassociationlist,as
demonstratedbythefollowingfunctioncalls.
Setvariablewhotoanassociationlist:
Command:(setqwho'((firstjohn)(midq)(lastpublic)))
((FIRSTJOHN)(MIDQ)(LASTPUBLIC))
Thefollowingsetsoldto(FIRSTJOHN)andnewto(FIRSTJ):
Command:(setqold(assoc'firstwho)new'(firstj))
(FIRSTJ)
Finally,replacethevalueofthefirstitemintheassociationlist:
Command:(substnewoldwho)
((FIRSTJ)(MIDQ)(LASTPUBLIC))

substr
Returnsasubstringofastring
(substrstringstart[length])
Thesubstrfunctionstartsatthestartcharacterpositionofstringand
continuesforlengthcharacters.

Arguments
string
Astring.
start

Apositiveintegerindicatingthestartingpositioninstring.Thefirst
characterinthestringisposition1.
length
Apositiveintegerspecifyingthenumberofcharacterstosearchthroughin
string.Iflengthisnotspecified,thesubstringcontinuestotheendof
string.

Note:Thefirstcharacterofstringischaracternumber1.Thisdiffersfrom
otherfunctionsthatprocesselementsofalist(likenthandssname)that
countthefirstelementas0.

ReturnValues
Astring.

Examples
Command:(substr"abcde"2)
"bcde"
Command:(substr"abcde"21)
"b"
Command:(substr"abcde"32)
"cd"
================================TFunctions===================================

tablet
Retrievesandsetsdigitizer(tablet)calibrations
(tabletcode[row1row2row3direction])

Arguments
code
Anintegerthatcanbeoneofthefollowing:
0Returnthecurrentdigitizercalibration.Inthiscase,theremaining
argumentsmustbeomitted.
1Setthecalibrationaccordingtotheargumentsthatfollow.Inthiscase,you
mustprovidethenewcalibrationsettings(row1,row2,row3,anddirection).
row1,row2,row3
Three3Dpoints.Thesethreeargumentsspecifythethreerowsofthetablet's
transformationmatrix.
Thethirdelementinrow3(Z)shouldalwaysequal1:tabletreturnsitas1
evenifyouspecifyadifferentvalueinrow3.
direction
One3Dpoint.Thisisthevector(expressedintheWorldCoordinateSystem,or
WCS)thatisnormaltotheplanethatrepresentsthesurfaceofthetablet.
Ifthespecifieddirectionisn'tnormalized,tabletcorrectsit,sothe
directionitreturnswhenyousetthecalibrationmaydifferfromthevalueyou
passed.

ReturnValues
Iftabletfails,itreturnsnilandsetstheERRNOsystemvariabletoavalue
thatindicatesthereasonforthefailure(seeappendixC,AutoLISPErrorCodes
intheVisualLISPDeveloper'sGuide).Thiscanhappenifthedigitizerisnot
atablet.

Examples
Averysimpletransformationthatcanbeestablishedwithtabletisthe
identitytransformation:

(tablet1'(100)'(010)'(001)'(001))
Withthistransformationineffect,AutoCADwillreceive,effectively,raw
digitizercoordinatesfromthetablet.Forexample,ifyoupickthepointwith
digitizercoordinates(5000,15000),AutoCADwillseeitasthepointinyour
drawingwiththosesamecoordinates.
TheTABMODEsystemvariableallowsAutoLISProutinestotogglethetableton
andoff.
SeeAlso
TheCalibratingTabletstopicintheVisualLISPDeveloper'sGuide.

tblnext
Findsthenextiteminasymboltable
(tblnexttablename[rewind])
Whentblnextisusedrepeatedly,itnormallyreturnsthenextentryinthe
specifiedtableeachtime.Thetblsearchfunctioncansetthenextentrytobe
retrieved.Iftherewindargumentispresentandisnotnil,thesymboltable
isrewoundandthefirstentryinitisretrieved.

Arguments
tablename
Astringthatidentifiesasymboltable.Validtablenamevaluesare"LAYER",
"LTYPE","VIEW","STYLE","BLOCK","UCS","APPID","DIMSTYLE",and"VPORT".The
argumentisnotcasesensitive.
rewind
Ifthisargumentispresentandisnotnil,thesymboltableisrewoundandthe
firstentryinitisretrieved.

ReturnValues
Ifasymboltableentryisfound,theentryisreturnedasalistofdotted
pairsofDXFtypecodesandvalues.Iftherearenomoreentriesinthetable,
nilisreturned.Deletedtableentriesareneverreturned.

Examples
Retrievethefirstlayerinthesymboltable:
Command:(tblnext"layer"T)
((0."LAYER")(2."0")(70.0)(62.7)(6."CONTINUOUS"))
Thereturnvaluesrepresentthefollowing:
(0."LAYER")Symboltype
(2."0")Symbolname
(70.0)Flags
(62.7)Colornumber,negativeifoff
(6."CONTINUOUS")Linetypename

Notethatthereisno1group.Thelastentryreturnedfromeachtableis
stored,andthenextoneisreturnedeachtimetblnextiscalledforthat
table.Whenyoubeginscanningatable,besuretosupplyanonnilsecond
argumenttorewindthetableandtoreturnthefirstentry.
Entriesretrievedfromtheblocktableincludea2groupwiththeentityname
ofthefirstentityintheblockdefinition(ifany).Forexample,the
followingcommandobtainsinformationaboutablockcalledBOX:
Command:(tblnext"block")
((0."BLOCK")(2."BOX")(70.0)(109.02.00.0)(2.<Entityname:
1dca370>))
Thereturnvaluesrepresentthefollowing:

(0."BLOCK")Symboltype
(2."BOX")Symbolname
(70.0)Flags
(109.02.00.0)OriginX,Y,Z
(2.<Entityname:1dca370>)Firstentity
Theentitynameinthe2groupisacceptedbyentgetandentnext,butnotby
otherentityaccessfunctions.Forexample,youcannotusessaddtoputitina
selectionset.Byprovidingthe2groupentitynametoentnext,youcanscan
theentitiescomprisingablockdefinitionentnextreturnsnilafterthelast
entityintheblockdefinition.
Ifablockcontainsnoentities,the2groupreturnedbytblnextistheentity
nameofitsendblkentity.

Note:ThevportsfunctionreturnscurrentVPORTtableinformation,therefore
itmaybeeasiertousevportsasopposedtotblnexttoretrievethis
information.

tblobjname
Returnstheentitynameofaspecifiedsymboltableentry
(tblobjnametablenamesymbol)

Arguments
tablename
Astringthatidentifiesthesymboltabletobesearched.Theargumentisnot
casesensitive.
symbol
Astringidentifyingthesymboltobesearchedfor.

ReturnValues
Theentitynameofthesymboltableentry,iffound.
Theentitynamereturnedbytblobjnamecanbeusedinentgetandentmod
operations.

Examples
Thefollowingcommandsearchesfortheentitynameoftheblockentry"ESC01":
Command:(tblobjname"block""ESC01")
<Entityname:1dca368>

tblsearch
Searchesasymboltableforasymbolname
(tblsearchtablenamesymbol[setnext])

Arguments
tablename
Astringthatidentifiesthesymboltabletobesearched.Thisargumentisnot
casesensitive.
symbol
Astringidentifyingthesymbolnametobesearchedfor.Thisargumentisnot
casesensitive.

setnext
Ifthisargumentissuppliedandisnotnil,thetblnextentrycounteris
adjustedsothefollowingtblnextcallreturnstheentryaftertheonereturned
bythistblsearchcall.Otherwise,tblsearchhasnoeffectontheorderof
entriesretrievedbytblnext.

ReturnValues
Iftblsearchfindsanentryforthegivensymbolname,itreturnsthatentryin
theformatdescribedfortblnext.Ifnoentryisfound,tblsearchreturnsnil.

Examples
Thefollowingcommandsearchesforatextstylenamed"standard":
Command:(tblsearch"style""standard")
((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
Terminatesallcurrentdialogboxesasiftheuserhadcanceledeachofthem
(term_dialog)
IfanapplicationisterminatedwhileanyDCLfilesareopen,AutoCAD
automaticallycallsterm_dialog.Thisfunctionisusedmainlyforaborting
nesteddialogboxes.

ReturnValues
Theterm_dialogfunctionalwaysreturnsnil.

terpri
Printsanewlinetothecommandline
(terpri)
TheterprifunctionisnotusedforfileI/O.Towriteanewlinetoafile,use
prin1,princ,orprint.

ReturnValues
nil

textbox
Measuresaspecifiedtextobject,andreturnsthediagonalcoordinatesofabox
thatenclosesthetext
(textboxelist)

Arguments
elist
Anentitydefinitionlistdefiningatextobject,intheformatreturnedby
entget.
Iffieldsthatdefinetextparametersotherthanthetextitselfareomitted
fromelist,thecurrent(ordefault)settingsareused.
Theminimumlistacceptedbytextboxisthatofthetextitself.

ReturnValues
Alistoftwopoints,ifsuccessful,otherwisenil.
Thepointsreturnedbytextboxdescribetheboundingboxofthetextobjectas
ifitsinsertionpointislocatedat(0,0,0)anditsrotationangleis0.The
firstlistreturnedisgenerallythepoint(0.00.00.0)unlessthetextobject
isobliqueorvertical,oritcontainsletterswithdescenders(suchasgand
p).Thevalueofthefirstpointlistspecifiestheoffsetfromthetext
insertionpointtothelowerleftcornerofthesmallestrectangleenclosing
thetext.Thesecondpointlistspecifiestheupperrightcornerofthatbox.
Regardlessoftheorientationofthetextbeingmeasured,thepointlist
returnedalwaysdescribesthebottomleftandupperrightcornersofthis
boundingbox.

Examples
Thefollowingcommandsuppliesthetextandacceptsthecurrentdefaultsfor
theremainingparameters:
Command:(textbox'((1."Helloworld.")))
((0.0001241260.008233640.0)(3.036230.3103450.0))

textpage
Switchesfocusfromthedrawingareatothetextscreen
(textpage)
Thetextpagefunctionisequivalenttotextscr.

ReturnValues
nil

textscr
Switchesfocusfromthedrawingareatothetextscreen(liketheAutoCADFlip
Screenfunctionkey)
(textscr)

ReturnValues
Thetextscrfunctionalwaysreturnsnil.
SeeAlso
Thegraphscrfunction.

trace
AidsinAutoLISPdebugging
(trace[function...])
Thetracefunctionsetsthetraceflagforthespecifiedfunctions.Eachtimea
specifiedfunctionisevaluated,atracedisplayappearsshowingtheentryof
thefunction(indentedtothelevelofcallingdepth)andprintstheresultof
thefunction.
IfVisualLISPisactive,traceoutputissenttotheVisualLISPTracewindow.
IfVisualLISPisnotactive,traceoutputgoestotheAutoCADcommandwindow.

Note:OnceyoustartVisualLISPduringanAutoCADsession,itremainsactive

untilyouexitAutoCAD.Therefore,alltraceoutputprintsintheVisualLISP
TracewindowfortheremainderofthatAutoCADsession.Exitingorclosing
VisualLISPwhileAutoCADisrunningonlyclosestheIDEwindowsandplaces
VisualLISPinaquiescentstateitdoesnotresultinatrueshutdown.You
mustreopenVisualLISPtoviewtheoutputintheTracewindow.
Useuntracetoturnoffthetraceflag.

Arguments
function
Asymbolthatnamesafunction.Ifnoargumentissupplied,tracehasno
effect.

ReturnValues
Thelastfunctionnamepassedtotrace.Ifnoargumentissupplied,trace
returnsnil.

Examples
Defineafunctionnamedfooandsetthetraceflagforthefunction:
Command:(defunfoo(x)(if(>x0)(foo(1x))))
FOO
Command:(tracefoo)
FOO
Invokefooandobservetheresults:
Command:(foo3)
Entering(FOO3)
Entering(FOO2)
Entering(FOO1)
Entering(FOO0)
Result:nil
Result:nil
Result:nil
Result:nil
Clearthetraceflagbyinvokinguntrace:
Command:(untracefoo)
FOO
SeeAlso
Theuntracefunction.

trans
Translatesapoint(oradisplacement)fromonecoordinatesystemtoanother
(transptfromto[disp])

Arguments
pt
Alistofthreerealsthatcanbeinterpretedaseithera3Dpointora3D
displacement(vector).
from
Anintegercode,entityname,or3Dextrusionvectoridentifyingthecoordinate
systeminwhichptisexpressed.Theintegercodecanbeoneofthefollowing:

0World(WCS)
1User(currentUCS)
2Ifusedwithcode0or1,thisindicatestheDisplayCoordinateSystem(DCS)
ofthecurrentviewport.Whenusedwithcode3,itindicatestheDCSofthe
currentmodelspaceviewport.
3PaperspaceDCS(usedonlywithcode2)
to
Anintegercode,entityname,or3Dextrusionvectoridentifyingthecoordinate
systemofthereturnedpoint.Seethefromargumentforalistofvalidinteger
codes.
disp
Ifpresentandisnotnil,thisargumentspecifiesthatptistobetreatedas
a3Ddisplacementratherthanasapoint.
Ifyouuseanentitynameforthefromortoarguments,itmustbepassedin
theformatreturnedbytheentnext,entlast,entsel,nentsel,andssname
functions.ThisformatletsyoutranslateapointtoandfromtheObject
CoordinateSystem(OCS)ofaparticularobject.(Forsomeobjects,theOCSis
equivalenttotheWCSfortheseobjects,conversionbetweenOCSandWCSisa
nulloperation.)A3Dextrusionvector(alistofthreereals)isanother
methodofconvertingtoandfromanobject'sOCS.However,thisdoesnotwork
forthoseobjectswhoseOCSisequivalenttotheWCS.

ReturnValues
A3Dpoint(ordisplacement)intherequestedtocoordinatesystem.

Examples
Inthefollowingexamples,theUCSisrotated90degreescounterclockwise
aroundtheWorldZaxis:
Command:(trans'(1.02.03.0)01)
(2.01.03.0)
Command:(trans'(1.02.03.0)10)
(2.01.03.0)
ThecoordinatesystemsarediscussedingreaterdetailintheVisualLISP
Developer'sGuide,underthetopic,CoordinateSystemTransformations.
Forexample,todrawalinefromtheinsertionpointofapieceoftext
(withoutusingOsnap),youconvertthetextobject'sinsertionpointfromthe
textobject'sOCStotheUCS.
(transtextinsertpointtextename1)
YoucanthenpasstheresulttotheFrompointprompt.
Conversely,youmustconvertpoint(ordisplacement)valuestotheir
destinationOCSbeforefeedingthemtoentmod.Forexample,ifyouwanttomove
acircle(withoutusingtheMOVEcommand)bytheUCSrelativeoffset(1,2,3),
youneedtoconvertthedisplacementfromtheUCStothecircle'sOCS:
(trans'(123)1circleename)
Thenyouaddtheresultingdisplacementtothecircle'scenterpoint.
Forexample,ifyouhaveapointenteredbytheuserandwanttofindoutwhich
endofalineitlookscloserto,youconverttheuser'spointfromtheUCSto
theDCS.
(transuserpoint12)
Thenyouconverteachoftheline'sendpointsfromtheOCStotheDCS.
(transendpointlineename2)
Fromthereyoucancomputethedistancebetweentheuser'spointandeach
endpointoftheline(ignoringtheZcoordinates)todeterminewhichendlooks
closer.
Thetransfunctioncanalsotransform2Dpoints.ItdoesthisbysettingtheZ
coordinatetoanappropriatevalue.TheZcomponentuseddependsonthefrom

coordinatesystemthatwasspecifiedandonwhetherthevalueistobe
convertedasapointorasadisplacement.Ifthevalueistobeconvertedasa
displacement,theZvalueisalways0.0ifthevalueistobeconvertedasa
point,thefilledinZvalueisdeterminedasshowninthefollowingtable.
+++
|Converted2DpointZvalues|
+++
|From|FilledinZvalue|
+++
|WCS|0.0|
+++
|UCS|Currentelevation|
+++
|OCS|0.0|
+++
|DCS|Projectedtothecurrentconstruction|
||plane(UCSXYplane+currentelevation)|
+++
|PSDCS|Projectedtothecurrentconstruction|
||plane(UCSXYplane+currentelevation)|
+++

type
Returnsthetypeofaspecifieditem
(typeitem)

Arguments
item
Asymbol.

ReturnValues
Thedatatypeofitem.Itemsthatevaluatetonil(suchasunassignedsymbols)
returnnil.Thedatatypeisreturnedasoneoftheatomslistedinthe
followingtable:
+++
|Datatypesreturnedbythetypefunction|
+++
|Datatype|Description|
+++
|ENAME|Entitynames|
+++
|EXRXSUBR|ExternalObjectARXapplications|
+++
|FILE|Filedescriptors|
+++
|INT|Integers|
+++
|LIST|Lists|
+++
|PAGETB|Functionpagingtable|
+++
|PICKSET|Selectionsets|
+++
|REAL|Floatingpointnumbers|
+++
|SAFEARRAY|Safearray|
+++
|STR|Strings|
+++
|SUBR|InternalAutoLISPfunctionsor|
||functionsloadedfromcompiled(FAS|
||orVLX)files.FunctionsinLISP|
||sourcefilesloadedfromtheAutoCAD|
||Commandpromptmayalsoappearas|
||SUBR.|
+++
|SYM|Symbols|
+++
|VARIANT|Variant|
+++
|USUBR|Userdefinedfunctionsloadedfrom|
||LISPsourcefiles|
+++

|VLAobject|ActiveXobjects|
+++

Examples

Forexample,giventhefollowingassignments:
(setqa123r3.45s"Hello!"x'(abc))
(setqf(open"name""r"))
then
(type'a)returnsSYM
(typea)returnsINT
(typef)returnsFILE
(typer)returnsREAL
(types)returnsSTR
(typex)returnsLIST
(type+)returnsSUBR
(typenil)returnsnil
Thefollowingcodeexampleusesthetypefunctionontheargumentpassedtoit:
(defunisint(a)
(if(=(typea)'INT)isTYPEinteger?
Tyes,returnT
nilno,returnnil
)
)
================================UFunctions===================================

unload_dialog
UnloadsaDCLfile
(unload_dialogdcl_id)
UnloadstheDCLfileassociatedwithdcl_id(obtainedfromaprevious
new_dialogcall)frommemory.
ItisgenerallynotnecessarytounloadaDCLdefinitionfrommemory,unless
youarerunninglowonmemoryorneedtoupdatetheDCLdialogdefinitionfrom
anewfile.

Arguments
dcl_id
ADCLfileidentifierobtainedfromapreviousload_dialogcall.

ReturnValues
Theunload_dialogfunctionalwaysreturnsnil.
SeeAlso
Theload_dilogandnew_dialogfunctions.

untrace
Clearsthetraceflagforthespecifiedfunctions

(untrace[function...])

Arguments
function
Asymbolthatnamesafunction.Iffunctionisnotspecified,untracehasno
effect.

ReturnValues
Thelastfunctionnamepassedtountrace.Iffunctionwasnotspecified,
untracereturnsnil.

Examples
Thefollowingcommandclearsthetraceflagforfunctionfoo:
Command:(untracefoo)
FOO
SeeAlso
Thetracefunction.
================================VFunctions===================================

vector_image
Drawsavectorinthecurrentlyactivedialogboximage
(vector_imagex1y1x2y2color)
Thisfunctiondrawsavectorinthecurrentlyactivedialogboximage(opened
bystart_image)fromthepoint(x1,y1)to(x2,y2).Theorigin(0,0)isthe
upperleftcorneroftheimage.Youcanobtainthecoordinatesofthe
lowerrightcornerbycallingthedimensionfunctions(dimx_tileand
dimy_tile).

Arguments
x1
Xcoordinateofthefirstpoint.
y1
Ycoordinateofthefirstpoint.
x2
Xcoordinateofthesecondpoint.
y2
Ycoordinateofthesecondpoint.
color
AnAutoCADcolornumber,oroneofthelogicalcolornumbersshowninthe
followingtable:
++++
|Symbolicnamesforcolorattribute|
++++
|Colornumber|ADImnemonic|Description|
++++
|2|BGLCOLOR|Currentbackgroundofthe|
|||AutoCADdrawingarea|
++++
|15|DBGLCOLOR|Currentdialogboxbackground|
|||color|
++++
|16|DFGLCOLOR|Currentdialogboxforeground|
|||color(text)|
++++
|18|LINELCOLOR|Currentdialogboxlinecolor|
++++

ReturnValues
Anintegerrepresentingthecolorofthevector.

Examples
(setqcolor2)colorofAutoCADdrawingarea
(vector_image
0
0
(dimx_tile"slide_tile")
(dimy_tile"slide_tile")
color
)
(end_image)

ver
ReturnsastringthatcontainsthecurrentAutoLISPversionnumber
(ver)
Theverfunctioncanbeusedtocheckthecompatibilityofprograms.

ReturnValues
Thestringreturnedtakesthefollowingform:
"VisualLISPversion(nn)"
whereversionisthecurrentversionnumberandnnisatwoletterlanguage
description.

Examplesofthetwoletterlanguagedescriptionsareasfollows:
(de)German
(en)US/UK
(es)Spanish
(fr)French
(it)Italian

Examples
Command:(ver)
"VisualLISP2002(en)"

vlacaddefun
DefinesanAutoLISPfunctionsymbolasanexternalsubroutine
(vlacaddefun'symbol)
symbol
Asymbolidentifyingafunction.
Ifafunctiondoesnothavethec:prefix,andyouwanttobeabletoinvoke
thisfunctionfromanexternalObjectARXapplication,youcanusevlacaddefun
tomakethefunctionaccessible.

ReturnValues
Unspecified.

vlacadundefun
UndefinesanAutoLISPfunctionsymbolsoitisnolongeravailabletoObjectARX
applications
(vlacadundefun'symbol)
symbol
Asymbolidentifyingafunction.
Youcanusevlacadundefuntoundefineac:functionorafunctionthatwas
exposedviavlacaddefun.

ReturnValues
Tifsuccessful,nilifunsuccessful(forexample,thefunctionwasnotdefined
inAutoLISP).

vlarximport
ImportsObjectARX/ADSRXfunctionsintoaseparatenamespaceVLX
(vlarximport['function|"application"])
Bydefault,separatenamespaceVLXapplicationsdonotimportanyfunctions
fromObjectARX/ADSRXapplications.Usevlarximporttoexplicitlyimport
functionsfromObjectARX/ADSRXapplications.

Arguments
function
Asymbolnamingthefunctiontoimport.
application
Astringnamingtheapplicationwhosefunctionsaretobeimported.
Ifnoargument(ornil)isspecified,vlarximportimportsallfunctionnames
fromthecurrentdocumentnamespace.

ReturnValues
Unspecified.
IfexecutedfromadocumentVLX,thisfunctiondoesnothingandreturnsnil,as
allADSDEFUNfunctionnamesareautomaticallyimportedtodocumentVLX
applications.

Examples
Toseehowvlarximportworks,trythefollowing:
*CopythefollowingcodeintotheVLISPeditorandsavethefile:
(vldocexport'testarx)
(defuntestarx()
(princ"ThisfunctiontestsinvokinganARXapp")
(vlarximport'c:cal)
(c:cal)
)
*UseMakeApplicationtobuildaVLXwiththiscode.SelectSeparate
NamespaceApplicationOptions.
*Loadgeomcal.arx,ifitisnotalreadyloaded.
*Loadandruntheapplication.

Toverifytheeffectofvlarximport,commentoutthevlarximportcallin
thecode,savethechange,thenrebuildandruntheapplication.Withoutthe
vlarximportcall,thec:calfunctionwillnotbefound.
Intheexampleabove,youcouldhavereplacedthevlarximportcallwiththe
following:
(vlarximport"geomcal.arx")
Thiswouldimportallfunctionsdefinedingeomcal.arx,includingc:cal.

vlbbref
Returnsthevalueofavariablefromtheblackboardnamespace
(vlbbref'variable)

Arguments
'variable
Asymbolidentifyingthevariabletoberetrieved.

ReturnValues
Thevalueofthevariablenamedbysymbol.

Examples
Setavariableintheblackboard:
Command:(vlbbset'foobar"Roottoottoot")
"Roottoottoot"
Usevlbbreftoretrievethevalueoffoobarfromtheblackboard:
Command:(vlbbref'foobar)
"Roottoottoot"
SeeAlso
Thevlbbsetfunction.Also,seeSharingDatabetweenNamespacesinthe
VisualLISPDeveloper'sGuideforadescriptionoftheblackboardnamespace.

vlbbset
Setsavariableintheblackboardnamespace
(vlbbset'symbolvalue)

Arguments
'symbol
Asymbolnamingthevariabletobeset.
value
Anyvalue,exceptafunction.

ReturnValues
Thevalueyouassignedtosymbol.

Examples
Command:(vlbbset'foobar"Roottoottoot")
"Roottoottoot"
Command:(vlbbref'foobar)

"Roottoottoot"
SeeAlso
Thevlbbreffunction.Also,seeSharingDatabetweenNamespacesinthe
VisualLISPDeveloper'sGuideforadescriptionoftheblackboardnamespace.

vlcatchallapply
Passesalistofargumentstoaspecifiedfunctionandtrapsanyexceptions
(vlcatchallapply'functionlist)

Arguments
'function
Afunction.Thefunctionargumentcanbeeitherasymbolidentifyingadefun,
oralambdaexpression.
list
Alistcontainingargumentstobepassedtothefunction.

ReturnValues
Theresultofthefunctioncall,ifsuccessful.Ifanerroroccurs,
vlcatchallapplyreturnsanerrorobject.

Examples
Ifthefunctioninvokedbyvlcatchallapplycompletessuccessfully,itisthe
sameasusingapply,asthefollowingexamplesshow:
_$(setqcatchit(apply'/'(505)))
10
_$(setqcatchit(vlcatchallapply'/'(505)))
10
Thebenefitofusingvlcatchallapplyisthatitallowsyoutointercept
errorsandcontinueprocessing.Lookatwhathappenswhenyoutrytodivideby
zerousingapply:
_$(setqcatchit(apply'/'(500)))
error:dividebyzero
Whenyouuseapply,anexceptionoccursandanerrormessagedisplays.
Hereisthesameoperationusingvlcatchallapply
_$(setqcatchit(vlcatchallapply'/'(500)))
#<%catchallapplyerror%>
Thevlcatchallapplyfunctiontrapstheerrorandreturnsanerrorobject.
Usevlcatchallerrormessagetoseetheerrormessagecontainedintheerror
object:
_$(vlcatchallerrormessagecatchit)
"dividebyzero"
SeeAlso
Thevlcatchallerrormessageandvlcatchallerrorpfunctionsinthis
referenceandErrorHandlingintheVisualLISPDeveloper'sGuide.

vlcatchallerrormessage

Returnsastringfromanerrorobject
(vlcatchallerrormessageerrorobj)

Arguments
errorobj
Anerrorobjectreturnedbyvlcatchallapply.

ReturnValues
Astringcontaininganerrormessage.

Examples
Dividebyzerousingvlcatchallapply:
_$(setqcatchit(vlcatchallapply'/'(500)))
#<%catchallapplyerror%>
Thevlcatchallapplyfunctiontrapstheerrorandreturnsanerrorobject.
Usevlcatchallerrormessagetoseetheerrormessagecontainedintheerror
object:
_$(vlcatchallerrormessagecatchit)
"dividebyzero"
SeeAlso
Thevlcatchallapplyandvlcatchallerrorpfunctionsinthisreference
andErrorHandlingintheVisualLISPDeveloper'sGuide.

vlcatchallerrorp
Determineswhetheranargumentisanerrorobjectreturnedfrom
vlcatchallapply
(vlcatchallerrorparg)

Arguments
arg
Anyargument.

ReturnValues
T,ifthesuppliedargumentisanerrorobjectreturnedfrom
vlcatchallapply,nilotherwise.

Examples
Dividebyzerousingvlcatchallapply:
_$(setqcatchit(vlcatchallapply'/'(500)))
#<%catchallapplyerror%>
Usevlcatchallerrorptodetermineifthevaluereturnedby
vlcatchallapplyisanerrorobject:
_$(vlcatchallerrorpcatchit)
T
SeeAlso
Thevlcatchallapplyandvlcatchallerrormessagefunctions,andError
HandlingintheVisualLISPDeveloper'sGuide.

vlcmdf
ExecutesanAutoCADcommand

Arguments
(vlcmdf[arguments]...)
Thevlcmdffunctionissimilartothecommandfunction,butdiffersfrom
commandinthewayitevaluatestheargumentspassedtoit.Thevlcmdf
functionevaluatesallthesuppliedargumentsbeforeexecutingtheAutoCAD
command,andwillnotexecutetheAutoCADcommandifitdetectsanerrorduring
argumentevaluation.Incontrast,thecommandfunctionpasseseachargumentin
turntoAutoCAD,sothecommandmaybepartiallyexecutedbeforeanerroris
detected.
Ifyourcommandcallincludesacalltoanotherfunction,vlcmdfexecutesthe
callbeforeitexecutesyourcommand,whilecommandexecutesthecallafterit
beginsexecutingyourcommand.
SomeAutoCADcommandsmayworkcorrectlywheninvokedthroughvlcmdf,while
failingwheninvokedthroughcommand.Thevlcmdffunctionmainlyovercomesthe
limitationofnotbeingabletousegetxxxfunctionsinsidecommand.

Arguments
arguments
AutoCADcommandsandtheiroptions.
Theargumentstothevlcmdffunctioncanbestrings,reals,integers,or
points,asexpectedbythepromptsequenceoftheexecutedcommand.Anull
string("")isequivalenttopressingENTERonthekeyboard.Invokingvlcmdf
withnoargumentisequivalenttopressingESCandcancelsmostAutoCAD
commands.

ReturnValues
T

NotethatifyouissuevlcmdffromVisualLISP,focusdoesnotchangetothe
AutoCADwindow.Ifthecommandrequiresuserinput,you'llseethereturnvalue
(T)intheConsolewindow,butAutoCADwillbewaitingforinput.Youmust
manuallyactivatetheAutoCADwindowandrespondtotheprompts.Untilyoudo
so,anysubsequentcommandswillfail.

Examples
Thedifferencesbetweencommandandvlcmdfareeasiertoseeifyouenterthe
followingcallsattheAutoCADCommandprompt,ratherthantheVLISPConsole
prompt:
Command:(command"line"(getpoint"point?")'(00)"")
lineSpecifyfirstpoint:point?
Specifynextpointor[Undo]:
Command:nil
Usingcommand,theLINEcommandexecutesfirst,thenthegetpointfunctionis
called.
Command:(VLCMDF"line"(getpoint"point?")'(00)"")
point?lineSpecifyfirstpoint:
Specifynextpointor[Undo]:
Command:T
Usingvlcmdf,thegetpointfunctioniscalledfirst(noticethe"point?"
promptfromgetpoint),thentheLINEcommandexecutes.
Thefollowingexamplesshowthesamecommands,butpassaninvalidpointlist
argumenttotheLINEcommand.Noticehowtheresultsdiffer:
Command:(command"line"(getpoint"point?")'(0)"")
lineSpecifyfirstpoint:point?

Specifynextpointor[Undo]:
Command:ERASEnil
objects:Specifyoppositecorner:

Cancel
0found
ThecommandfunctionpasseseachargumentinturntoAutoCAD,without
evaluatingtheargument,sotheinvalidpointlistisundetected.
Command:(VLCMDF"line"(getpoint"point?")'(0)"")
point?ApplicationERROR:Invalidentity/pointlist.
nil
BecausevlcmdfevaluateseachargumentbeforepassingthecommandtoAutoCAD,
theinvalidpointlistisdetectedandthecommandisnotexecuted.
SeeAlso
Thecommandfunction.

vlconsp
Determineswhetherornotalistisnil
(vlconsplistvariable)
Thevlconspfunctiondetermineswhetheravariablecontainsavalidlist
definition.

Arguments
listvariable
Alist.

ReturnValues
T,iflistvariableisalistandisnotnil,otherwisenil.

Examples
_$(vlconspnil)
nil
_$(vlconspt)
nil
_$(vlconsp(cons0"LINE"))
T

vlcopyobjects

Duplicatesmultipleobjects(deepcloning).

Signature
RetVal=object.CopyObjects(Objects[,Owner][,IDPairs])
Object

Database,Document
Theobjectorobjectsthismethodappliesto.
Objects
Variant(arrayofobjects)inputonly
Thearrayofprimaryobjectstobecopied.Alltheobjectsmusthavethesameowner,
andtheownermustbelongtothedatabaseordocumentthatiscallingthismethod.
Owner
Variant(asingleobject)inputonlyoptional
Thenewownerforthecopiedobjects.Ifnoownerisspecified,theobjectswillbe
createdwiththesameownerastheobjectsintheObjectsarray.
IDPairs
Variant(arrayofIDPairobjects)inputoutputoptional
Informationonwhathappenedduringthecopyandtranslationprocess.
Input:anemptyvariant.
Output:anarrayofIDPairobjects.
RetVal
Variant(arrayofobjects)
Anarrayofnewlycreatedduplicateobjects.Onlyprimaryobjectsarereturnedin
thisarray.FormoreinformationonwhatoccuredduringtheCopyObjectsoperation,or
alistofobjectsownedbyprimaryobjectsthatwerealsocopied,consulttheIDPairs
array.
Remarks
Tocopyobjectstoanotheropendrawing,settheOwnerparametertotheother
drawing'smodelspace.
DuringtheCopyObjectsoperation,objectsthatareownedorreferencedbytheprimary
objectsintheObjectsparameterwillalsobecopied.

NOTEYoucannotexecutethismethodwhilesimultaneouslyiteratingthrougha
collection.Aniterationwillopentheworkspaceforareadonlyoperation,while
thismethodattemptstoperformareadwriteoperation.Completeanyiterationbefore
youcallthismethod.

vldirectoryfiles
Listsallfilesinagivendirectory
(vldirectoryfiles[directorypatterndirectories])

Arguments
directory
Astringnamingthedirectorytocollectfilesforifnilorabsent,
vldirectoryfilesusesthecurrentdirectory.
pattern
AstringcontainingaDOSpatternforthefilenameifnilorabsent,
vldirectoryfilesassumes"*.*"
directories
Anintegerthatindicateswhetherthereturnedlistshouldincludedirectory
names.Specifyoneofthefollowing:
1Listdirectoriesonly.
0Listfilesanddirectories(thedefault).
1Listfilesonly.

ReturnValues
Alistoffileandpathnames,ornilifnofilesmatchthespecifiedpattern.

Examples

_$(vldirectoryfiles"c:/acadwin""acad*.exe")
("ACAD.EXE""ACADAPP.EXE""ACADL.EXE""ACADPS.EXE")
_$(vldirectoryfiles"e:/acadwin"nil1)
(".""..""SUPPORT""SAMPLE""ADS""FONTS""IGESFONT""SOURCE"
"ASE")
_$(vldirectoryfiles"E:/acad13c4"nil1)
(".""..""WIN""COM""DOS")

vldocexport
Makesafunctionavailabletothecurrentdocument
(vldocexport'function)
WhenissuedfromaVLXthatrunsinitsownnamespace,vldocexportexposes
thespecifiedfunctiontoanydocumentnamespacethatloadstheVLX.
Thevldocexportfunctionshouldonlybeusedatthetoplevelinafile,
neverinsideotherforms(forexample,notwithinadefun).

Arguments
'function
Asymbolnamingthefunctiontobeexported.

ReturnValues
Unspecified.

Examples
Thefollowingcodeshowsthecontentsofafilenamedkertrats.lsp.Thisfile
iscompiledintoaVLXthatrunsinitsownnamespace.TheVLXfileisnamed
kertrats.vlx.Thevldocexportcallmakesthekertratsfunctionvisibletoany
documentthatloadskertrats.vlx:
(vldocexport'kertrats)
(defunkertrats()
(princ"Thisfunctiongoesnowhere")
)

vldocimport
ImportsapreviouslyexportedfunctionintoaVLXnamespace
(vldocimportapplication['function...])
ThisfunctioncanbeusedinaseparatenamespaceVLXtoimportafunctionthat
waspreviouslyexportedfromanotherVLXloadedfromthesamedocument.
Thevldocimportfunctionshouldonlybeusedatthetoplevelinafile,
neverinsideotherforms(forexample,notwithinadefun).

Arguments
application
AstringnamingtheVLXapplicationwhosefunctionsaretobeimported.Donot
includethe.vlxextensioninthename.
function
Oneormoresymbolsnamingfunctionstobeimported.Ifnofunctionsare
specified,allfunctionsexportedbyapplicationwillbeimported.

ReturnValues
Unspecified.

Examples
Importfunctionldatagetfromtheldatatestapplication:
(vldocimport"ldatatest"'ldataget)
nil

vldocref
Retrievesthevalueofavariablefromthecurrentdocument'snamespace
ThisfunctioncanbeusedbyaseparatenamespaceVLXapplicationtoretrieve
thevalueofavariablefromthecurrentdocument'snamespace.
(vldocref'symbol)

Arguments
'symbol
Asymbolnamingavariable.

ReturnValues
Thevalueofthevariableidentifiedbysymbol.

Examples
Command:(vldocref'foobar)
"Rinkydinkystinky"
SeeAlso
Thevldocsetfunction.

vldocset
Setsthevalueofavariableinthecurrentdocument'snamespace
(vldocset'symbolvalue)
ThisfunctioncanbeusedbyaVLXapplicationtosetthevalueofavariable
thatresidesinthecurrentdocument'snamespace.
Ifexecutedwithinadocumentnamespace,vldocsetisequivalenttoset.

Arguments
'symbol
Asymbolnamingavariable.
value
Anyvalue.

ReturnValues
Thevalueset.

Examples
Command:(vldocset'foobar"Rinkydinkystinky")
"Rinkydinkystinky"

SeeAlso
Thevldocreffunction.

vlevery
Checkswhetherthepredicateistrueforeveryelementcombination
(vleverypredicatefunctionlist[list]...)
Thevleveryfunctionpassesthefirstelementofeachsuppliedlistasan
argumenttothetestfunction,followedbythenextelementfromeachlist,and
soon.Evaluationstopsassoonasoneofthelistsrunsout.

Arguments
predicatefunction
Thetestfunction.Thiscanbeanyfunctionthatacceptsasmanyargumentsas
therearelistsprovidedwithvlevery,andreturnsTonanyuserspecified
condition.Thepredicatefunctionvaluecantakeoneofthefollowingforms:
*Asymbol(functionname)
*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))
list
Alisttobetested.

ReturnValues
T,ifpredicatefunctionreturnsanonnilvalueforeveryelementcombination,
nilotherwise.

Examples
Checkwhetherthereareanyemptyfilesinthecurrentdirectory:
_$(vlevery
'(lambda(fnm)(>(vlfilesizefnm)0))
(vldirectoryfilesnilnil1))
T
CheckwhetherthelistofnumbersinNLSTisorderedby'<=:
_$(setqnlst(list02pipi4))
(023.141593.141594)
_$(vlevery'<=nlst(cdrnlst))
T
Comparetheresultsofthefollowingexpressions:
_$(vlevery'='(12)'(13))
nil
_$(vlevery'='(12)'(123))
T
Thefirstexpressionreturnednilbecausevleverycomparedthesecondelement
ineachlistandtheywerenotnumericallyequal.Thesecondexpression
returnedTbecausevleverystoppedcomparingelementsafterithadprocessed
alltheelementsintheshorterlist(12),atwhichpointthelistswere
numericallyequal.Iftheendofalistisreached,vleveryreturnsanonnil
value.
Thefollowingexampledemonstratestheresultwhenvleveryevaluatesonelist
thatcontainsintegerelementsandanotherlistthatisnil:
_$(setqalist(list1234))

(1234)
_$(setqjunknil)
nil
_$(vlevery'=junkalist)
T
ThereturnvalueisTbecausevleveryrespondstothenillistasifithas
reachedtheendofthelist(eventhoughthepredicatehasn'tyetbeenapplied
toanyelements).Andsincetheendofalisthasbeenreached,vlevery
returnsanonnilvalue.

vlexitwitherror
NOTE:+error+=(*error*)
controlfromaVLXerrorhandlertothe+error+functionofthecalling
namespace
(vlexitwitherrormsg)
ThisfunctionisusedbyVLXapplicationsthatrunintheirownnamespace.When
vlexitwitherrorexecutes,itcallsthe+error+function,thestackis
unwound,andcontrolreturnstoacommandprompt.

Arguments
msg
Astring.

ReturnValues
None.

Examples
Thefollowingcodeillustratestheuseofvlexitwitherrortopassastring
the+error+functionofthecallingnamespace:
(defun+error+(msg)
...processinginVLXnamespace/executioncontext
(vlexitwitherror(strcat"Myapplicationbombed!"msg)))
SeeAlso
ThevlexitwithvaluefunctionandHandlingErrorsinanMDIEnvironmentin
theVisualLISPDeveloper'sGuide.

vlexitwithvalue
NOTE:+error+=(*error*)
ReturnsavaluetothefunctionthatinvokedtheVLXfromanothernamespace
(vlexitwithvaluevalue)
VLX+error+handlercanusethevlexitwithvaluefunctiontoreturnavalue
totheprogramthatcalledtheVLX.

Arguments
value
Anyvalue.

ReturnValues
value

Examples

Thefollowingexampleusesvlexitwithvaluetoreturntheintegervalue3to
thefunctionthatinvokedtheVLX:
(defun+error+(msg)
...processinginVLXTnamespace/executioncontext
(vlexitwithvalue3))
SeeAlso
ThevlexitwitherrorfunctionandtheHandlingErrorsinanMDIEnvironment
topicintheVisualLISPDeveloper'sGuide.

vlfilecopy
Copiesorappendsthecontentsofonefiletoanotherfile
(vlfilecopysourcefiledestinationfile[append])
Copyorappendthecontentsofonefiletoanotherfile.Thevlfilecopy
functionwillnotoverwriteanexistingfile,onlyappendtoit.

Arguments
sourcefile
Astringnamingthefiletobecopied.Ifyoudonotspecifyafullpathname,
vlfilecopylooksintheAutoCADstartupdirectory.
destinationfile
Astringnamingthedestinationfile.Ifyoudonotspecifyapathname,
vlfilecopywritestotheAutoCADstartupdirectory.
append
Ifspecifiedandnotnil,sourcefileisappendedtodestinationfile(thatis,
copiedtotheendofthedestinationfile).

ReturnValues
Aninteger,ifthecopywassuccessful,otherwisenil.
Sometypicalreasonsforreturningnilare:
*sourcefileisnotreadable
*sourcefileisadirectory
*append?isabsentornilanddestinationfileexists
*destinationfilecannotbeopenedforoutput(thatis,itisanillegal
filenameorawriteprotectedfile)
*sourcefileisthesameasdestinationfile

Examples
Copyautoexec.battonewauto.bat:
_$(vlfilecopy"c:/autoexec.bat""c:/newauto.bat")
1417
Copytest.battonewauto.bat:
_$(vlfilecopy"c:/test.bat""c:/newauto.bat")
nil
Thecopyfailsbecausenewauto.batalreadyexists,andtheappendargumentwas
notspecified.
Repeatthepreviouscommand,butspecifyappend:
_$(vlfilecopy"c:/test.bat""c:/newauto.bat"T)
185

ThecopyissuccessfulbecauseTwasspecifiedfortheappendargument.

vlfiledelete
Deletesafile
(vlfiledeletefilename)

Arguments
filename
Astringcontainingthenameofthefiletobedeleted.Ifyoudonotspecifya
fullpathname,vlfiledeletesearchestheAutoCADstartupdirectory.

ReturnValues
Tifsuccessful,nilifdeletefailed.

Examples
Deletenewauto.bat:
_$(vlfiledelete"newauto.bat")
nil
Nothingwasdeletedbecausethereisnonewauto.batfileintheAutoCAD
startupdirectory.
Deletethenewauto.batfileinthec:\directory:
_$(vlfiledelete"c:/newauto.bat")
T
Thedeletewassuccessfulbecausethefullpathnameidentifiedanexisting
file.

vlfiledirectoryp
Determinesifafilenamereferstoadirectory
(vlfiledirectorypfilename)

Arguments
filename
Astringcontainingafilename.Ifyoudonotspecifyafullpathname,
vlfiledirectorypsearchesonlytheAutoCADstartupdirectory.

ReturnValues
T,iffilenameisthenameofadirectory,nilifitisnot.

Examples
_$(vlfiledirectoryp"sample")
T
_$(vlfiledirectoryp"yinyang")
nil
_$(vlfiledirectoryp"c:/programfiles/AutoCAD")
T
_$(vlfiledirectoryp"c:/programfiles/AutoCAD/visuallisp/
yinyang.lsp")

nil

vlfilerename
Renamesafile
(vlfilerenameoldfilenamenewfilename)

Arguments
oldfilename
Astringcontainingthenameofthefileyouwanttorename.Ifyoudonot
specifyafullpathname,vlfilerenamelooksintheAutoCADstartup
directory.
newfilename
Astringcontainingthenewnametobeassignedtothefile.

Note:Ifyoudonotspecifyapathname,vlfilerenamewritestherenamed
filetotheAutoCADstartupdirectory.

ReturnValues
T,ifrenamingcompletedsuccessfully,nilifrenamingfailed.

Examples
_$(vlfilerename"c:/newauto.bat""c:/myauto.bat")
T

vlfilesize
Determinesthesizeofafile,inbytes
(vlfilesizefilename)

Arguments
filename
Astringnamingthefiletobesized.Ifyoudonotspecifyafullpathname,
vlfilesizesearchestheAutoCADstartupdirectoryforthefile.

ReturnValues
Ifsuccessful,vlfilesizereturnsanintegershowingthesizeoffilename.If
thefileisnotreadable,vlfilesizereturnsnil.Iffilenameisadirectory
oranemptyfile,vlfilesizereturns0.

Examples
_$(vlfilesize"c:/autoexec.bat")
1417
_$(vlfilesize"c:/")
0
Intheprecedingexample,vlfilesizereturned0becausec:/namesa
directory.

vlfilesystime

Returnslastmodificationtimeofthespecifiedfile
(vlfilesystimefilename)

Arguments
filename
Astringcontainingthenameofthefiletobechecked.

ReturnValues
Alistcontainingthemodificationdateandtime,ornil,ifthefileisnot
found.
Thelistreturnedcontainsthefollowingelements:
*year
*month
*dayofweek
*dayofmonth
*hours
*minutes
*seconds

NotethatMondayisday1ofdayofweek,Tuesdayisday2,etc.
Examples
_$(vlfilesystime
"c:/programfiles/AutoCAD/sample/visuallisp/yinyang.lsp")
(199843810652)
Thereturnedvalueshowsthatthefilewaslastmodifiedin1998,inthe4th
monthoftheyear(April),the3rddayoftheweek(Wednesday),onthe8thday
ofthemonth,at10:6:52.

vlfilenamebase
Returnsthenameofafile,afterstrippingoutthedirectorypathandextension
(vlfilenamebasefilename)

Arguments
filename
Astringcontainingafilename.Thevlfilenamebasefunctiondoesnotcheck
toseeifthefileexists.

ReturnValues
Astringcontainingfilenameinuppercase,withanydirectoryandextension
strippedfromthename.

Examples
_$(vlfilenamebase"c:\\acadwin\\acad.exe")
"ACAD"
_$(vlfilenamebase"c:\\acadwin")
"ACADWIN"

vlfilenamedirectory
Returnsthedirectorypathofafile,afterstrippingoutthenameandextension

(vlfilenamedirectoryfilename)

Arguments
filename
Astringcontainingacompletefilename,includingthepath.The
vlfilenamedirectoryfunctiondoesnotchecktoseeifthespecifiedfile
exists.Slashes(/)andbackslashes(\)areacceptedasdirectorydelimiters.

ReturnValues
Astringcontainingthedirectoryportionoffilename,inuppercase.

Examples
_$(vlfilenamedirectory"c:\\acadwin\\acad.exe")
"C:\\ACADWIN"
_$(vlfilenamedirectory"acad.exe")
""

vlfilenameextension
Returnstheextensionfromafilename,afterstrippingouttherestofthename
(vlfilenameextensionfilename)

Arguments
filename
Astringcontainingafilename,includingtheextension.The
vlfilenameextensionfunctiondoesnotchecktoseeifthespecifiedfile
exists.

ReturnValues
Astringcontainingtheextensionoffilename.Thereturnedstringstartswith
aperiod(.)andisinuppercase.Iffilenamedoesnotcontainanextension,
vlfilenameextensionreturnsnil.

Examples
_$(vlfilenameextension"c:\\acadwin\\acad.exe")
".EXE"
_$(vlfilenameextension"c:\\acadwin\\acad")
nil

vlfilenamemktemp
Calculatesauniquefilenametobeusedforatemporaryfile
(vlfilenamemktemp[patterndirectoryextension])

Arguments
pattern
Astringcontainingafilenamepatternifnilorabsent,vlfilenamemktemp
uses"$VL~~".
directory
Astringnamingthedirectoryfortemporaryfilesifnilorabsent,
vlfilenamemktempchoosesadirectoryinthefollowingorder:
*Thedirectoryspecifiedinpattern,ifany.

*ThedirectoryspecifiedintheTMPenvironmentvariable.
*ThedirectoryspecifiedintheTEMPenvironmentvariable.
*Thecurrentdirectory.
extension
Astringnamingtheextensiontobeassignedtothefileifnilorabsent,
vlfilenamemktempusestheextensionpartofpattern(whichmaybeanempty
string).

ReturnValues
Astringcontainingafilename,inthefollowingformat:
directory\base<XXX><.extension>
where:
baseisupto5characters,takenfrompattern
XXXisa3characteruniquecombination
AllfilenamesgeneratedbyvlfilenamemktempduringaVLISPsessionare
deletedwhenyouexitVLISP.

Examples
_$(vlfilenamemktemp)
"C:\\TMP\\$VL~~004"
_$(vlfilenamemktemp"myapp.del")
"C:\\TMP\\MYAPP005.DEL"
_$(vlfilenamemktemp"c:\\acadwin\\myapp.del")
"C:\\ACADWIN\\MYAPP006.DEL"
_$(vlfilenamemktemp"c:\\acadwin\\myapp.del")
"C:\\ACADWIN\\MYAPP007.DEL"
_$(vlfilenamemktemp"myapp""c:\\acadwin")
"C:\\ACADWIN\\MYAPP008"
_$(vlfilenamemktemp"myapp""c:\\acadwin"".del")
"C:\\ACADWIN\\MYAPP00A.DEL"

vlgetresource
Returnsthetextstoredina.txtfilepackagedinaVLX
(vlgetresourcetextfile)

Arguments
textfile
Astringnaminga.txtfilepackagedwiththeVLX.Donotincludethe.txt
extensionwhenspecifyingthefilename.

ReturnValues
Astringcontainingthetextintextfile.

Examples
Assumethegetres.vlxfilecontainsaLISPprogramdefiningafunctionnamed
printreadme,andatextfilenamedreadme.txt.Theprintreadmefunctionis
definedasfollows:
(defunprintreadme()
(princ(vlgetresource"readme"))
(princ)

)
Afterloadinggetres.vlx,invokeprintreadme:
_$(printreadme)
Thereisveryimportantinformationhere!
Besuretothoroughlyreadthefollowing!
Areyouready?
Hereitcomes...

vllist_star
Constructsandreturnsalist
(vllist*object[object]...)

Arguments
object
AnyLISPobject.

ReturnValues
Thevllist*functionissimilartolist,butitwillplacethelastobjectin
thefinalcdroftheresultlist.Ifthelastargumenttovllist*isanatom,
theresultisadottedlist.Ifthelastargumentisalist,itselementsare
appendedtoallpreviousargumentsaddedtotheconstructedlist.Thepossible
returnvaluesfromvllist*are:
*Anatom,ifasingleatomobjectisspecified.
*Adottedpair,ifallobjectargumentsareatoms.
*Adottedlistifthelastargumentisanatomandneitheroftheprevious
conditionsistrue.
*Alist,ifnoneofthepreviousstatementsistrue.

Examples
_$(vllist*1)
1
_$(vllist*0"text")
(0."TEXT")
_$(vllist*123)
(12.3)
_$(vllist*12'(34))
(1234)
SeeAlso
Thelistfunction.

vllist>string
Combinesthecharactersassociatedwithalistofintegersintoastring
(vllist>stringcharcodeslist)

Arguments

charcodeslist
Alistofnonnegativeintegers.Eachintegermustbelessthan256.

ReturnValues
Astringofcharacters,witheachcharacterbasedononeoftheintegers
suppliedincharcodeslist.

Examples
_$(vllist>stringnil)
""
_$(vllist>string'(4950))
"12"
SeeAlso
Thevlstring>listfunction.

vllistexportedfunctions
Listsexportedfunctions
(vllistexportedfunctions[appname])

Arguments
appname
AstringnamingaloadedVLXapplication.Donotincludethe.vlxextension.

ReturnValues
Alistofstringsnamingexportedfunctions,ornil,iftherearenofunctions
exportedfromthespecifiedVLX.Ifappnameisomittedorisnil,
vllistexportedfunctionsreturnsalistofallexportedfunctions(for
example,c:functions)exceptthoseexportedfromVLXnamespaces.

Examples
_$(vllistexportedfunctions"whichexpns")
("WHICHNAMESPACE")
SeeAlso
Thevllistloadedvlxfunction.

vllistlength
Calculateslistlengthofatruelist
(vllistlengthlistorconsobject)

Arguments
listorconsobject
Atrueordottedlist.

ReturnValues
Anintegercontainingthelistlengthiftheargumentisatruelist,ornilif
listorconsobjectisadottedlist.
Compatibilitynote:Thevllistlengthfunctionreturnsnilforadottedlist,
whilethecorrespondingCommonLispfunctionissuesanerrormessageifthe
argumentisadottedlist.

Examples
_$(vllistlengthnil)
0
_$(vllistlength'(12))
2
_$(vllistlength'(12.3))
nil
SeeAlso
Thelistpfunction.

vllistloadedvlx
ReturnsalistofallseparatenamespaceVLXfilesassociatedwiththecurrent
document
(vllistloadedvlx)

ReturnValues
AlistofsymbolsidentifyingseparatenamespaceVLXapplicationsassociated
withthecurrentAutoCADdocument,orniliftherearenoVLXapplications
associatedwiththecurrentdocument.
ThevllistloadedvlxfunctiondoesnotidentifyVLXapplicationsthatare
loadedinthecurrentdocument'snamespace.

Examples
TestforloadedVLXfilesassociatedwiththecurrentAutoCADdocument:
_$(vllistloadedvlx)
nil
NoVLXfilesareassociatedwiththecurrentdocument.
LoadtwoVLXfilesbothVLXapplicationshavebeencompiledtorunintheir
ownnamespace:
_$(load"c:/mydocuments/visuallisp/examples/foo1.vlx")
nil
_$(load"c:/mydocuments/visuallisp/examples/foo2.vlx")
nil
TestforloadedVLXfilesassociatedwiththecurrentAutoCADdocument:
_$(vllistloadedvlx)
(FOO1FOO2)
ThetwoVLXfilesjustloadedareidentifiedbyvllistloadedvlx.
LoadaVLXthatwascompiledtoruninadocument'snamespace:
_$(load"c:/mydocuments/visuallisp/examples/foolocal.vlx")
nil
TestforloadedVLXfiles:
_$(vllistloadedvlx)
(FOO1FOO2))
ThelastVLXloaded(foolocal.vlx)isnotreturnedbyvllistloadedvlx
becausetheapplicationwasloadedintothedocument'snamespacetheVLXdoes

nothaveitsownnamespace.

vlloadall
LoadsafileintoallopenAutoCADdocuments,andintoanydocument
subsequentlyopenedduringthecurrentAutoCADsession
(vlloadallfilename)

Arguments
filename
Astringnamingthefiletobeloaded.IfthefileisintheAutoCADSupport
FileSearchPath,youcanomitthepathname,butyoumustalwaysspecifythe
fileextensionvlloadalldoesnotassumeafiletype.

ReturnValues
Unspecified.Iffilenameisnotfound,vlloadallissuesanerrormessage.

Examples
_$(vlloadall"c:/mydocuments/visuallisp/examples/whichns.lsp")
nil
_$(vlloadall"yinyang.lsp")
nil

vlloadcom
LoadsVisualLISPextensionstoAutoLISP
(vlloadcom)
ThisfunctionloadstheextendedAutoLISPfunctionsprovidedwithVisualLISP.
TheVisualLISPextensionsimplementActiveXandAutoCADreactorsupport
throughAutoLISP,andalsoprovideActiveXutilityanddataconversion
functions,dictionaryhandlingfunctions,andcurvemeasurementfunctions.
Iftheextensionsarealreadyloaded,vlloadcomdoesnothing.

ReturnValues
Unspecified.
SeeAlso
TheloadfunctioninthisreferenceandtheUsingExtendedAutoLISPFunctions
topicintheVisualLISPDeveloper'sGuide.

vlloadreactors
Loadsreactorsupportfunctions
(vlloadreactors)
Thisfunctionisidenticaltovlloadcomandismaintainedforbackward
compatibility.
SeeAlso
Thevlloadcomfunction.

vlmemberif
Determinesifthepredicateistrueforoneofthelistmembers
(vlmemberifpredicatefunctionlist)
Thevlmemberiffunctionpasseseachelementinlisttothefunctionspecified
inpredicatefunction.Ifpredicatefunctionreturnsanonnilvalue,
vlmemberifreturnstherestofthelistinthesamemannerasthemember
function.

Arguments
predicatefunction
Thetestfunction.Thiscanbeanyfunctionthatacceptsasingleargumentand
returnsTforanyuserspecifiedcondition.Thepredicatefunctionvaluecan
takeoneofthefollowingforms:
*Asymbol(functionname)
*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))
list
Alisttobetested.

ReturnValues
Alist,startingwiththefirstelementthatpassesthetestandcontainingall
elementsfollowingthisintheoriginalargument.Ifnoneoftheelements
passesthetestcondition,vlmemberifreturnsnil.

Examples
Thefollowingcommanddrawsaline:
_$(COMMAND"_.LINE"'(010)'(3050)nil)
nil
Thefollowingcommandusesvlmemberiftoreturnassociationlistsdescribing
anentity,iftheentityisaline:
_$(vlmemberif
'(lambda(x)(=(cdrx)"AcDbLine"))
(entget(entlast)))
((100."AcDbLine")(100.010.00.0)(1130.050.00.0)(2100.0
0.01.0))
SeeAlso
Thevlmemberifnotfunction.

vlmemberifnot
Determinesifthepredicateisnilforoneofthelistmembers
(vlmemberifnotpredicatefunctionlist)
Thevlmemberifnotfunctionpasseseachelementinlisttothefunction
specifiedinpredicatefunction.Ifthefunctionreturnsnil,vlmemberifnot
returnstherestofthelistinthesamemannerasthememberfunction.

Arguments
predicatefunction
Thetestfunction.Thiscanbeanyfunctionthatacceptsasingleargumentand
returnsTforanyuserspecifiedcondition.Thepredicatefunctionvaluecan
takeoneofthefollowingforms:

*Asymbol(functionname)
*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))
list
Alisttobetested.

ReturnValues
Alist,startingwiththefirstelementthatfailsthetestandcontainingall
elementsfollowingthisintheoriginalargument.Ifnoneoftheelementsfails
thetestcondition,vlmemberifnotreturnsnil.

Examples
_$(vlmemberifnot'atom'(1"Str"(0."line")nilt))
((0."line")nilT)
SeeAlso
Thevlmemberiffunction.

vlposition
Returnstheindexofthespecifiedlistitem
(vlpositionsymbollist)

Arguments
symbol
AnyAutoLISPsymbol.
list
Atruelist.

ReturnValues
Anintegercontainingtheindexpositionofsymbolinlist,ornilifsymbol
doesnotexistinthelist.

Notethatthefirstlistelementisindex0,thesecondelementisindex1,and
soon.

Examples
_$(setqstuff(list"a""b""c""d""e"))
("a""b""c""d""e")
_$(vlposition"c"stuff)
2

vlprin1tostring
ReturnsthestringrepresentationofLISPdataasifitwereoutputbythe
prin1function
(vlprin1tostringdata)

Arguments
data
AnyAutoLISPdata.

ReturnValues

Astringcontainingtheprintedrepresentationofdataasifdisplayedby
prin1.

Examples
_$(vlprin1tostring"abc")
"\"abc\""
_$(vlprin1tostring"c:\\acadwin")
"\"C:\\\\ACADWIN\""
_$(vlprin1tostring'myvar)
"MYVAR"
SeeAlso
Thevlprinctostringfunction.

vlprinctostring
ReturnsthestringrepresentationofLISPdataasifitwereoutputbythe
princfunction
(vlprinctostringdata)

Arguments
data
AnyAutoLISPdata.

ReturnValues
Astringcontainingtheprintedrepresentationofdataasifdisplayedby
princ.

Examples
_$(vlprinctostring"abc")
"abc"
_$(vlprinctostring"c:\\acadwin")
"C:\\ACADWIN"
_$(vlprinctostring'myvar)
"MYVAR"
SeeAlso
Thevlprin1tostringfunction.

vlpropagate
Copiesthevalueofavariableintoallopendocumentnamespaces(andsetsits
valueinanysubsequentdrawingsopenedduringthecurrentAutoCADsession)
(vlpropagate'symbol)

Arguments
symbol
AsymbolnaminganAutoLISPvariable.

ReturnValues

Unspecified.

Examples
Command:(vlpropagate'radius)
nil

vlregistrydelete
DeletesthespecifiedkeyorvaluefromtheWindowsregistry
(vlregistrydeleteregkey[valname])

Arguments
regkey
AstringspecifyingaWindowsregistrykey.
valname
Astringcontainingthevalueoftheregkeyentry.
Ifvalnameissuppliedandisnotnil,thespecifiedvaluewillbepurgedfrom
theregistry.Ifvalnameisabsentornil,thefunctiondeletesthespecified
keyandallofitsvalues.

ReturnValues
Tifsuccessful,otherwisenil.

Examples
_$(vlregistrywrite"HKEY_CURRENT_USER\\Test""""testdata")
"testdata"
_$(vlregistryread"HKEY_CURRENT_USER\\Test")
"testdata"
_$(vlregistrydelete"HKEY_CURRENT_USER\\Test")
T

Note:Thisfunctioncannotdeleteakeythathassubkeys.Todeleteasubtree
youmustusevlregistrydescendentstoenumerateallsubkeysanddeleteallof
them.
SeeAlso
Thevlregistrydescendentsandvlregistrywrite
functions.

vlregistrydescendents
Returnsalistofsubkeysorvaluenamesforthespecifiedregistrykey
(vlregistrydescendentsregkey[valnames])

Arguments
regkey
AstringspecifyingaWindowsregistrykey.
valnames
Astringcontainingthevaluesfortheregkeyentry.
Ifvalnamesissuppliedandisnotnil,thespecifiedvaluenameswillbe

listedfromtheregistry.Ifvalnameisabsentornil,thefunctiondisplays
allsubkeysofregkey.

ReturnValues
Alistofstrings,ifsuccessful,otherwisenil.

Examples
_$(vlregistrydescendents"HKEY_LOCAL_MACHINE\\SOFTWARE")
("Description""ProgramGroups""ORACLE""ODBC""Netscape"
"Microsoft")
SeeAlso
Thevlregistrydeleteandvlregistrywritefunctions.

vlregistryread
ReturnsdatastoredintheWindowsregistryforthespecifiedkey/valuepair
(vlregistryreadregkey[valname])

Arguments
regkey
AstringspecifyingaWindowsregistrykey.
valname
Astringcontainingthevalueofaregistryentry.
Ifvalnameissuppliedandisnotnil,thespecifiedvaluewillbereadfrom
theregistry.Ifvalnameisabsentornil,thefunctionreadsthespecified
keyandallofitsvalues.

ReturnValues
Astringcontainingregistrydata,ifsuccessful,otherwisenil.

Examples
_$(vlregistryread"HKEY_CURRENT_USER\\Test")
nil
_$(vlregistrywrite"HKEY_CURRENT_USER\\Test""""testdata")
"testdata"
_$(vlregistryread"HKEY_CURRENT_USER\\Test")
"testdata"
SeeAlso
Thevlregistrydeleteandvlregistrywritefunctions.

vlregistrywrite
CreatesakeyintheWindowsregistry
(vlregistrywriteregkey[valnamevaldata])

Arguments
regkey
AstringspecifyingaWindowsregistrykey.

Note:YoucannotusevlregistrywriteforHKEY_USERSorKEY_LOCAL_MACHINE.

valname
Astringcontainingthevalueofaregistryentry.
valdata
Astringcontainingregistrydata.
Ifvalnameisnotsuppliedorisnil,adefaultvalueforthekeyiswritten.
Ifvalnameissuppliedandvaldataisnotspecified,anemptystringis
stored.

ReturnValues
vlregistrywritereturnsvaldata,ifsuccessful,nilotherwise.

Examples
_$(vlregistrywrite"HKEY_CURRENT_USER\\Test""""testdata")
"testdata"
_$(vlregistryread"HKEY_CURRENT_USER\\Test")
"testdata"
SeeAlso

Thevlregistrydeleteandvlregistryreadfunctions.

vlremove
Removeselementsfromalist
(vlremoveelementtoremovelist)

Arguments
elementtoremove
ThevalueoftheelementtoberemovedmaybeanyLISPdatatype.
list
Anylist.

ReturnValues
Thelistwithallelementsexceptthoseequaltoelementtoremove.

Examples
_$(vlremovepi(listpit0"abc"))
(T0"abc")

vlremoveif
Returnsallelementsofthesuppliedlistthatfailthetestfunction
(vlremoveifpredicatefunctionlist)

Arguments
predicatefunction
Thetestfunction.Thiscanbeanyfunctionthatacceptsasingleargumentand
returnsTforanyuserspecifiedcondition.Thepredicatefunctionvaluecan
takeoneofthefollowingforms:
*Asymbol(functionname)

*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))
list
Alisttobetested.

ReturnValues
Alistcontainingallelementsoflistforwhichpredicatefunctionreturns
nil.

Examples
_$(vlremoveif'vlsymbolp(listpit0"abc"))
(3.141590"abc")

vlremoveifnot
Returnsallelementsofthesuppliedlistthatpassthetestfunction
(vlremoveifnotpredicatefunctionlist)

Arguments
predicatefunction
Thetestfunction.Thiscanbeanyfunctionthatacceptsasingleargumentand
returnsTforanyuserspecifiedcondition.Thepredicatefunctionvaluecan
takeoneofthefollowingforms:
*Asymbol(functionname)
*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))
list
Alisttobetested.

ReturnValues
Alistcontainingallelementsoflistforwhichpredicatefunctionreturnsa
nonnilvalue

Examples
_$(vlremoveifnot'vlsymbolp(listpit0"abc"))
(T)

vlsome
Checkswhetherthepredicateisnotnilforoneelementcombination
(vlsomepredicatefunctionlist[list]...)

Arguments
predicatefunction
Thetestfunction.Thiscanbeanyfunctionthatacceptsasmanyargumentsas
therearelistsprovidedwithvlsome,andreturnsTonauserspecified
condition.Thepredicatefunctionvaluecantakeoneofthefollowingforms:
*Asymbol(functionname)
*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))
list
Alisttobetested.

Thevlsomefunctionpassesthefirstelementofeachsuppliedlistasan
argumenttothetestfunction,thenthenextelementfromeachlist,andsoon.
Evaluationstopsassoonasthepredicatefunctionreturnsanonnilvaluefor
anargumentcombination,oruntilallelementshavebeenprocessedinoneof
thelists.

ReturnValues
Thepredicatevalue,ifpredicatefunctionreturnedavalueotherthannil,
otherwisenil.

Examples
Thefollowingexamplecheckswhethernlst(anumberlist)hasequalelementsin
sequence:
_$(setqnlst(list02pipi4))
(023.141593.141594)
_$(vlsome'=nlst(cdrnlst))
T

vlsort
Sortstheelementsinalistaccordingtoagivencomparefunction
(vlsortlistcomparisonfunction)

Arguments
list
Anylist.
comparisonfunction
Acomparisonfunction.Thiscanbeanyfunctionthatacceptstwoargumentsand
returnsT(oranynonnilvalue)ifthefirstargumentprecedesthesecondin
thesortorder.Thecomparisonfunctionvaluecantakeoneofthefollowing
forms:
*Asymbol(functionname)
*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))

ReturnValues
Alistcontainingtheelementsoflistintheorderspecifiedby
comparisonfunction.Duplicateelementsmaybeeliminatedfromthelist.

Examples
Sortalistofnumbers:
_$(vlsort'(3213)'<)
(123)

Notethattheresultlistcontainsonlyone3.
Sortalistof2DpointsbyYcoordinate:
_$(vlsort'((13)(22)(31))
(function(lambda(e1e2)
(<(cadre1)(cadre2)))))
((31)(22)(13))
Sortalistofsymbols:
_$(vlsort
'(adcba)

'(lambda(s1s2)
(<(vlsymbolnames1)(vlsymbolnames2))))
(ABCD)NotethatonlyoneAremainsintheresultlist

vlsorti
Sortstheelementsinalistaccordingtoagivencomparefunction,andreturns
theelementindexnumbers
(vlsortilistcomparisonfunction)

Arguments
list
Anylist.
comparisonfunction
Acomparisonfunction.Thiscanbeanyfunctionthatacceptstwoargumentsand
returnsT(oranynonnilvalue)ifthefirstargumentprecedesthesecondin
thesortorder.Thecomparisonfunctionvaluecantakeoneofthefollowing
forms:
*Asymbol(functionname)
*'(LAMBDA(A1A2)...)
*(FUNCTION(LAMBDA(A1A2)...))

ReturnValues
Alistcontainingtheindexvaluesoftheelementsoflist,sortedintheorder
specifiedbycomparisonfunction.Duplicateelementswillberetainedinthe
result.

Examples
Sortalistofcharactersindescendingorder:
_$(vlsorti'("a""d""f""c")'>)
(2130)
Thesortedlistorderis"f""d""c""a""f"isthe3rdelement(index2)in
theoriginallist,"d"isthe2ndelement(index1)inthelist,andsoon.
Sortalistofnumbersinascendingorder:
_$(vlsorti'(3213)'<)
(2130)

Notethatbothoccurrencesof3areaccountedforintheresultlist.
Sortalistof2DpointsbyYcoordinate:
_$(vlsorti'((13)(22)(31))
(function(lambda(e1e2)
(<(cadre1)(cadre2)))))
(210)
Sortalistofsymbols:
_$(vlsorti
'(adcba)
'(lambda(s1s2)
(<(vlsymbolnames1)(vlsymbolnames2))))
(40321)

Notethatbotha'sareaccountedforintheresultlist.

vlstring>list
Convertsastringintoalistofcharactercodes
(vlstring>liststring)

Arguments
string
Astring.

ReturnValues
Alist,eachelementofwhichisanintegerrepresentingthecharactercodeof
thecorrespondingcharacterinstring.

Examples
_$(vlstring>list"")
nil
_$(vlstring>list"12")
(4950)
SeeAlso
Thevllist>stringfunction.

vlstringelt
ReturnstheASCIIrepresentationofthecharacterataspecifiedpositionina
string
(vlstringeltstringposition)

Arguments
string
Astringtobeinspected.
position
Adisplacementinthestringthefirstcharacterisdisplacement0.Notethat
anerroroccursifpositionisoutsideoftherangeofthestring.

ReturnValues
AnintegerdenotingtheASCIIrepresentationofthecharacteratthespecified
position

Examples
_$(vlstringelt"MaytheForcebewithyou"8)
70

vlstringlefttrim
Removesthespecifiedcharactersfromthebeginningofastring
(vlstringlefttrimcharactersetstring)

Arguments
characterset
Astringlistingthecharacterstoberemoved.
string
Thestringtobestrippedofcharacterset.

ReturnValues
Astringcontainingasubstringofstringwithallleadingcharactersin
charactersetremoved

Examples
_$(vlstringlefttrim"\t\n""\n\tSTR")
"STR"
_$(vlstringlefttrim"12456789""12463CPOisnotR2D2")
"3CPOisnotR2D2"
_$(vlstringlefttrim"""Therearetoomanyspaceshere")
"Therearetoomanyspaceshere"

vlstringmismatch
Returnsthelengthofthelongestcommonprefixfortwostrings,startingat
specifiedpositions
(vlstringmismatchstr1str2[pos1pos2ignorecasep])

Arguments
str1
Thefirststringtobematched.
str2
Thesecondstringtobematched.
pos1
Anintegeridentifyingthepositiontosearchfrominthefirststring0if
omitted.
pos2
Anintegeridentifyingthepositiontosearchfrominthesecondstring0if
omitted.
ignorecasep
IfTisspecifiedforthisargument,caseisignored,otherwisecaseis
considered.

ReturnValues
Aninteger.

Examples
_$(vlstringmismatch"VLFUN""VLVAR")
3
_$(vlstringmismatch"vlfun""avlvar")
0
_$(vlstringmismatch"vlfun""avlvar"01)
3

_$(vlstringmismatch"VLFUN""VlvAR")
1
_$(vlstringmismatch"VLFUN""VlvAR"00T)
3

vlstringposition
LooksforacharacterwiththespecifiedASCIIcodeinastring
(vlstringpositioncharcodestr[startpos[fromendp]])

Arguments
charcode
Theintegerrepresentationofthecharactertobesearched.
str
Thestringtobesearched.
startpos
Thepositiontobeginsearchingfrominthestring(firstcharacteris0)0if
omitted.
fromendp
IfTisspecifiedforthisargument,thesearchbeginsattheendofthestring
andcontinuesbackwardtopos.

ReturnValues
Anintegerrepresentingthedisplacementatwhichcharcodewasfoundfromthe
beginningofthestringnilifthecharacterwasnotfound.

Examples
_$(vlstringposition(ascii"z")"azbdc")
1
_$(vlstringposition122"azbzc")
1
_$(vlstringposition(ascii"x")"azbzc")
nil
Thesearchstringusedinthefollowingexamplecontainstwo"z"characters.
Readingfromlefttoright,withthefirstcharacterbeingdisplacement0,
thereisonezatdisplacement1andanotherzatdisplacement3:
_$(vlstringposition(ascii"z")"azbzlmnqc")
1
Searchingfromlefttoright(thedefault),the"z"inposition1isthefirst
onevlstringpositionencounters.Butwhensearchingfromrighttoleft,asin
thefollowingexample,the"z"inposition3isthefirstoneencountered:
_$(vlstringposition(ascii"z")"azbzlmnqc"nilt)
3

vlstringrighttrim
Removesthespecifiedcharactersfromtheendofastring

(vlstringrighttrimcharactersetstring)

Arguments
characterset
Astringlistingthecharacterstoberemoved.
string
Thestringtobestrippedofcharacterset.

ReturnValues
Astringcontainingasubstringofstringwithalltrailingcharactersin
charactersetremoved.

Examples
_$(vlstringrighttrim"\t\n""STR\n\t")
"STR"
_$(vlstringrighttrim"1356789""3CPOisnotR2D267891")
"3CPOisnotR2D2"
_$(vlstringrighttrim"""Therearetoomanyspaceshere")
"Therearetoomanyspaceshere"

vlstringsearch
Searchesforthespecifiedpatterninastring
(vlstringsearchpatternstring[startpos])

Arguments
pattern
Astringcontainingthepatterntobesearchedfor.
string
Thestringtobesearchedforpattern.
startpos
Anintegeridentifyingthestartingpositionofthesearch0,ifomitted.

ReturnValues
Anintegerrepresentingthepositioninthestringwherethespecifiedpattern
wasfound,ornilifthepatternisnotfoundthefirstcharacterofthe
stringisposition0.

Examples
_$(vlstringsearch"foo""pfooyeyonyou")
1
_$(vlstringsearch"who""pfooyeyonyou")
nil
_$(vlstringsearch"foo""fooeymorefooey"1)
11

vlstringsubst

Substitutesonestringforanother,withinastring
(vlstringsubstnewstrpatternstring[startpos])

Arguments
newstr
Thestringtobesubstitutedforpattern.
pattern
Astringcontainingthepatterntobereplaced.
string
Thestringtobesearchedforpattern.
startpos
Anintegeridentifyingthestartingpositionofthesearch0,ifomitted.

Notethatthesearchiscasesensitive,andvlstringsubstonlysubstitutes
thefirstoccurrenceitfindsofthestring.

ReturnValues
Thevalueofstringafteranysubstitutionshavebeenmade

Examples
Replacethestring"Ben"with"Obiwan":
_$(vlstringsubst"Obiwan""Ben""BenKenobi")
"ObiwanKenobi"
Replace"Ben"with"Obiwan":
_$(vlstringsubst"Obiwan""Ben""benKenobi")
"benKenobi"
Nothingwassubstitutedbecausevlstringsubstdidnotfindamatchfor"Ben"
the"ben"inthestringthatwassearchedbeginswithalowercase"b".
Replace"Ben"with"Obiwan":
_$(vlstringsubst"Obiwan""Ben""BenKenobiBen")
"ObiwanKenobiBen"

Notethattherearetwooccurrencesof"Ben"inthestringthatwassearched,
butvlstringsubstonlyreplacesthefirstoccurrence.
Replace"Ben"with"Obiwan,"butstartthesearchatthefourthcharacterin
thestring:
_$(vlstringsubst"Obiwan""Ben""Ben\"Ben\"Kenobi"3)
"Ben\"Obiwan\"Kenobi"
Therearetwooccurrencesof"Ben"inthestringthatwassearched,butbecause
vlstringsubstwasinstructedtobeginsearchingatthefourthcharacter,it
foundandreplacedthesecondoccurrence,notthefirst.

vlstringtranslate
Replacescharactersinastringwithaspecifiedsetofcharacters
(vlstringtranslatesourcesetdestsetstr)

Arguments
sourceset
Astringofcharacterstobematched.

destset
Astringofcharacterstobesubstitutedforthoseinsourceset.
str
Astringtobesearchedandtranslated.

ReturnValues
Thevalueofstrafteranysubstitutionshavebeenmade

Examples
_$(vlstringtranslate"abcABC""123123""Aisa,Bisb,CisC")
"1is1,2is2,3is3"
_$(vlstringtranslate"abc""123""Aisa,Bisb,CisC")
"Ais1,Bis2,Cis3"

vlstringtrim
Removesthespecifiedcharactersfromthebeginningandendofastring
(vlstringtrimcharsetstr)

Arguments
charset
Astringlistingthecharacterstoberemoved.
str
Thestringtobetrimmedofcharset.

ReturnValues
Thevalueofstr,afteranycharactershavebeentrimmed.

Examples
_$(vlstringtrim"\t\n""\t\nSTR\n\t")
"STR"
_$(vlstringtrim"thisisjunk""thisisjunkDon'tcallthis
junk!thisisjunk")
"Don'tcallthisjunk!"
_$(vlstringtrim"""Leavemealone")
"Leavemealone"

vlsymbolname
Returnsastringcontainingthenameofasymbol
(vlsymbolnamesymbol)

Arguments
symbol
AnyLISPsymbol.

ReturnValues
Astringcontainingthenameofthesuppliedsymbolargument,inuppercase.

Examples
_$(vlsymbolname'S::STARTUP)
"S::STARTUP"
_$(progn(setqsym'myvar)(vlsymbolnamesym))
"MYVAR"
_$(vlsymbolname1)
ERROR:badargumenttype:symbolp1

vlsymbolvalue
Returnsthecurrentvalueboundtoasymbol
(vlsymbolvaluesymbol)
Thisfunctionisequivalenttotheevalfunction,butdoesnotcalltheLISP
evaluator.

Arguments
symbol
AnyLISPsymbol.

ReturnValues
Thevalueofsymbol,afterevaluation.

Examples
_$(vlsymbolvalue't)
T
_$(vlsymbolvalue'PI)
3.14159
_$(progn(setqsym'PAUSE)(vlsymbolvaluesym))
"\\"

vlsymbolp
Identifieswhetherornotaspecifiedobjectisasymbol

Arguments
(vlsymbolpobject)
object
AnyLISPobject.

ReturnValues
Tifobjectisasymbol,otherwisenil.

Examples
_$(vlsymbolpt)
T
_$(vlsymbolpnil)
nil

_$(vlsymbolp1)
nil
_$(vlsymbolp(list1))
nil

vlunloadvlx
UnloadaVLXapplicationthatisloadedinitsownnamespace
(vlunloadvlxappname)

Arguments
appname
AstringnamingaVLXapplicationthatisloadedinitsownnamespace.Donot
includethe.vlxextension.
ThevlunloadvlxfunctiondoesnotunloadVLXapplicationsthatareloadedin
thecurrentdocument'snamespace.

ReturnValues
Tifsuccessful,otherwisevlunloadvlxresultsinanerror.

Examples
Assumingthatvlxnsisanapplicationthatisloadedinitsownnamespace,the
followingcommandunloadsvlxns:
Command:(vlunloadvlx"vlxns")
T
Tryunloadingvlxnsagain:
Command:(vlunloadvlx"vlxns")
ERROR:LISPApplicationisnotfoundVLXNS
Thevlunloadvlxcommandfailsthistime,becausetheapplicationwasnot
loaded.
SeeAlso
Theloadandvlvlxloadedpfunctions.

vlvbaload
LoadsaVisualBasicproject

Arguments
(vlvbaloadfilename)
filename
AstringnamingtheVisualBasicprojectfiletobeloaded.

ReturnValues
Unspecified,ifsuccessful.

Examples
_$(vlvbaload"c:/programfiles/AutoCAD/sample/vba/
drawline.dvb")
"c:\\programfiles\\AutoCAD\\sample\\vba\\drawline.dvb"

SeeAlso
Thevlvbarunfunction.

vlvbarun
RunsaVisualBasicmacro

Arguments
(vlvbarunmacroname)
macroname
AstringnamingaloadedVisualBasicmacro.

ReturnValues
macroname

Examples
LoadaVBAprojectfile:
_$(vlvbaload"c:/programfiles/AutoCAD/sample/vba/
drawline.dvb")
"c:\\programfiles\\AutoCAD\\sample\\vba\\drawline.dvb"
Runamacrofromtheloadedproject:
_$(vlvbarun"drawline")
"drawline"
SeeAlso
Thevlvbaloadfunction.

vlvlxloadedp
DetermineswhetheraseparatenamespaceVLXiscurrentlyloaded
(vlvlxloadedpappname)

Arguments
appname
AstringnamingaVLXapplication.

ReturnValues
Tiftheapplicationisloaded,nilifitisnotloaded.

Examples
Checktoseeifthevlxnsapplicationisloadedinitsownnamespace:
Command:(vlvlxloadedp"vlxns")
nil
Theapplicationisnotloadedinitsownnamespace.
Nowloadvlxns:
Command:(load"vlxns.vlx")
nil
Checktoseeifthevlxnsapplicationloadedsuccessfully:

Command:(vlvlxloadedp"vlxns")
T
Thisexampleassumesvlxnswasdefinedtoruninitsownnamespace.Ifthe
applicationwasnotdefinedtoruninitsownnamespace,itwouldloadintothe
currentdocument'snamespaceandvlvlxloadedpwouldreturnnil.
SeeAlso
Theloadandvlunloadvlxfunctions.

vlax3Dpoint
CreatesActiveXcompatible(variant)3Dpointstructure
(vlax3Dpointlist)or(vlax3Dpointxy[z])

Arguments
list
Alistof2or3numbers,representingpoints.
x,y
NumbersrepresentingXandYcoordinatesofapoint.
z
AnumberrepresentingtheZcoordinateofapoint.

ReturnValues
Avariantcontainingathreeelementarrayofdoubles.

Examples
_$(vlax3Dpoint520)
#<variant8197...>
_$(vlax3Dpoint'(33.644.090.0))
<variant8197...>
SeeAlso
Thevlaxmakesafearray,vlaxsafearrayfill,and
vlaxsafearrayputelementfunctions.

vlaxaddcmd
AddscommandstotheAutoCADbuiltincommandset
(vlaxaddcmdglobalnamefuncsym[localnamecmdflags])
WithvlaxaddcmdyoucandefineafunctionasanAutoCADcommand,without
usingthec:prefixinthefunctionname.Youcanalsodefineatransparent
AutoLISPcommand,whichisnotpossiblewithac:function.
Warning!Youcannotusethecommandfunctioncallinatransparentlydefined
vlaxaddcmdfunction.DoingsocancauseAutoCADtocloseunexpectedly.
ThevlaxaddcmdfunctionmakesanAutoLISPfunctionvisibleasan
ObjectARXstylecommandattheAutoCADCommandpromptduringthecurrent
AutoCADsession.ThefunctionprovidesaccesstotheObjectARXacedRegCmds
macro,whichprovidesapointertotheObjectARXsystemAcEdCommandStack
object.
Thevlaxaddcmdfunctionautomaticallyassignscommandstocommandgroups.
Whenissuedfromadocumentnamespace,vlaxaddcmdaddsthecommandtoagroup

nameddocIDdocIDisahexadecimalvalueidentifyingthedocument.Ifissued
fromaseparatenamespaceVLX,vlaxaddcmdaddsthecommandtoagroupnamed
VLCDdocID:VLXname,whereVLXnameisthenameoftheapplicationthatissued
vlaxaddcmd.
Itisrecommendedthatyouusethevlaxaddcmdfunctionfroma
separatenamespaceVLX.YoushouldthenexplicitlyloadtheVLXusingthe
APPLOADcommand,ratherthanbyplacingitinoneofthestartupLISPfiles.

Note:Youcannotusevlaxaddcmdtoexposefunctionsthatcreatereactor
objectsorserveasreactorcallbacks.

Arguments
globalname
Astring.
funcsym
AsymbolnaminganAutoLISPfunctionwithzeroarguments.
localname
Astring(defaultstoglobalname).
cmdflags
Aninteger(defaultstoACRX_CMD_MODAL+ACRX_CMD_REDRAW)
Theprimaryflagsare:
ACRX_CMD_MODAL(0)Commandcannotbeinvokedwhileanothercommandisactive.
ACRX_CMD_TRANSPARENT(1)Commandcanbeinvokedwhileanothercommandis
active.
Thesecondaryflagsare:
ACRX_CMD_USEPICKSET(2)Whenthepickfirstsetisretrieveditiscleared
withinAutoCAD.Commandwillbeabletoretrievethepickfirstset.Command
cannotretrieveorsetgrips.
ACRX_CMD_REDRAW(4)Whenthepickfirstsetorgripsetisretrieved,neither
willbeclearedwithinAutoCAD.Commandcanretrievethepickfirstsetandthe
gripset.
IfbothACRX_CMD_USEPICKSETandACRX_CMD_REDRAWareset,theeffectisthesame
asifjustACRX_CMD_REDRAWisset.Formoreinformationontheflags,referto
theCommandStacktopicintheObjectARXReferencemanual.

ReturnValues
Theglobalnameargument,ifsuccessful.Thefunctionreturnsnil,if
acedRegCmds>addCommand(...)returnsanerrorcondition.

Examples
Thehelloautocadfunctioninthefollowingexamplehasnoc:prefix,but
vlaxaddcmdmakesitvisibleasanObjectARXstylecommandattheAutoCAD
Commandprompt:
_$(defunhelloautocad()(princ"helloVisualLISP"))
HELLOAUTOCAD
_$(vlaxaddcmd"helloautocad"'helloautocad)
"helloautocad"
SeeAlso
Thevlaxremovecmdfunction.

vlaxcreateobject
Createsanewinstanceofanapplicationobject
(vlaxcreateobjectprogid)

Usevlaxcreateobjectwhenyouwantanewinstanceofanapplicationtobe
started,andanobjectofthetypespecifiedby<Component>(seetheargument
description)tobecreated.Tousethecurrentinstance,usevlaxgetobject.
However,ifanapplicationobjecthasregistereditselfasasingleinstance
object,onlyoneinstanceoftheobjectiscreated,nomatterhowmanytimes
youcallvlaxcreateobject.

Arguments
progid
AstringcontainingtheprogrammaticidentifierofthedesiredActiveXobject.
Theformatofprogidis:
<Vendor>.<Component>.<Version>
Forexample:
AutoCAD.Drawing.15

ReturnValues
Theapplicationobject(VLAobject).

Examples
CreateaninstanceofanExcelapplication:
_$(vlaxcreateobject"Excel.Application")
#<VLAOBJECT_Application0017b894>

vlaxcurvegetArea
Returnstheareainsidethecurve
(vlaxcurvegetAreacurveobj)

Arguments
curveobj
TheVLAobjecttobemeasured.

ReturnValues
Arealnumberrepresentingtheareaofthecurve,ifsuccessful,otherwisenil.

Examples
Assumethecurvebeingmeasuredistheellipseinthefollowingdrawing:
Samplecurve(ellipse)forvlaxcurvegetarea
TheellipseObjvariablepointstotheellipseVLAobject.
Thefollowingcommandobtainstheareaofthecurve:
_$(vlaxcurvegetAreaellipseObj)
4.712393

vlaxcurvegetClosestPointTo
Returnsthepoint(inWCS)onacurvethatisnearesttothespecifiedpoint
(vlaxcurvegetClosestPointTocurveobjgivenPnt[extend])

Arguments
curveobj

TheVLAobjecttobemeasured.
givenPnt
Apoint(inWCS)forwhichtofindthenearestpointonthecurve.
extend
Ifspecifiedandnotnil,vlaxcurvegetClosestPointToextendsthecurvewhen
searchingforthenearestpoint.

ReturnValues
A3Dpointlistrepresentingapointonthecurve,ifsuccessful,otherwise
nil.

Examples
Assumethatthecurvebeingmeasuredisthearcinthefollowingdrawing:
Returntheclosestpointonthearctothecoordinates6.0,0.5:
_$(vlaxcurvegetClosestPointToarcObj'(6.00.50.0))
(6.01.50.0)
Returntheclosestpointonthearctothecoordinates6.0,0.5,after
extendingthearc:
_$(vlaxcurvegetClosestPointToarcObj'(6.00.50.0)T)
(5.70920.6817530.0)

vlaxcurvegetClosestPointToProjection
Returnstheclosestpoint(inWCS)onacurveafterprojectingthecurveontoa
plane
(vlaxcurvegetClosestPointToProjectioncurveobjgivenPntnormal[extend])

Arguments
curveobj
TheVLAobjecttobemeasured.
givenPnt
Apoint(inWCS)forwhichtofindthenearestpointonthecurve.
normal
Anormalvector(inWCS)fortheplanetoprojectonto.
extend
Ifspecifiedandnotnil,vlaxcurvegetClosestPointToProjectionextendsthe
curvewhensearchingforthenearestpoint.
vlaxcurvegetClosestPointToProjectionprojectsthecurveontotheplane
definedbythegivenPntandnormal,thencalculatesthenearestpointonthat
projectedcurvetogivenPnt.Theresultingpointisthenprojectedbackonto
theoriginalcurve,andvlaxcurvegetClosestPointToProjectionreturnsthat
projectedpoint.

ReturnValues
A3Dpointlistrepresentingapointonthecurve,ifsuccessful,otherwise
nil.

vlaxcurvegetDistAtParam
Returnsthelengthofthecurve'ssegmentfromthecurve'sbeginningtothe

specifiedparameter
(vlaxcurvegetDistAtParamcurveobjparam)

Arguments
curveobj
TheVLAobjecttobemeasured.
param
Anumberspecifyingaparameteronthecurve.

ReturnValues
Arealnumberthatisthelengthuptothespecifiedparameter,ifsuccessful,
otherwisenil.

Examples
AssumethatsplineObjpointstothesplineinthefollowingdrawing:
Samplecurve(spline)forvlaxcurvegetDistAtParam
Obtainthestartparameterofthecurve:
_$(setqstartSpline(vlaxcurvegetStartParamsplineObj))
0.0
Thecurvestartsatparameter0.
Obtaintheendparameterofthecurve:
_$(setqendSpline(vlaxcurvegetEndParamsplineObj))
17.1546
Thecurve'sendparameteris17.1546.
Determinethedistancetoparametermidwayalongthecurve:
_$(vlaxcurvegetDistAtParamsplineObj
(/(endsplinestartspline)2))
8.99417
Thedistancefromthestarttothemiddleofthecurveis8.99417.

vlaxcurvegetDistAtPoint
Returnsthelengthofthecurve'ssegmentbetweenthecurve'sstartpointand
thespecifiedpoint
(vlaxcurvegetDistAtPointcurveobjpoint)

Arguments
curveobj
TheVLAobjecttobemeasured.
point
A3Dpointlist(inWCS)oncurveobj.

ReturnValues
Arealnumberifsuccessful,otherwisenil.

Examples
Forthefollowingexample,assumethatsplineObjpointstothesplineshownin
theexampleforvlaxcurvegetDistAtParam.
SetOSNAPtotangentandselectthepointwherethelineistangenttothe
curve:

_$(setqselPt(getpoint))
(4.914386.047380.0)
Determinethedistancefromthestartofthecurvetotheselectedpoint:
_$(vlaxcurvegetDistAtPointsplineObjselpt)
5.17769

vlaxcurvegetEndParam
Returnstheparameteroftheendpointofthecurve
(vlaxcurvegetEndParamcurveobj)

Arguments
curveobj
TheVLAobjecttobemeasured.

ReturnValues
Arealnumberrepresentinganendparameter,ifsuccessful,otherwisenil.

Examples
AssumingthatellipseObjpointstotheellipseshownintheexamplefor
vlaxcurvegetArea,thefollowingfunctioncallreturnstheendparameterof
thecurve:
_$(vlaxcurvegetendparamellipseObj)
6.28319
Theendparameteris6.28319(twicepi).
SeeAlso
ThevlaxcurvegetStartParamfunction.

vlaxcurvegetEndPoint
Returnstheendpoint(inWCS)ofthecurve
(vlaxcurvegetEndPointcurveobj)

Arguments
curveobj
TheVLAobjecttobemeasured.

ReturnValues
A3Dpointlistrepresentinganendpoint,ifsuccessful,otherwisenil.

Examples
GettheendpointoftheellipseusedtodemonstratevlaxcurvegetArea:
_$(vlaxcurvegetEndPointellipseObj)
(2.02.00.0)

vlaxcurvegetFirstDeriv

Returnsthefirstderivative(inWCS)ofacurveatthespecifiedlocation
(vlaxcurvegetFirstDerivcurveobjparam)

Arguments
curveobj
TheVLAobjecttobemeasured.
param
Anumberspecifyingaparameteronthecurve.

ReturnValues
A3Dvectorlist,ifsuccessful,otherwisenil.

Examples
Forthefollowingexample,assumethatsplineObjpointstothesplineshownin
theexampleofthevlaxcurvegetDistAtParamfunction.
Obtainthestartparameterofthecurve:
_$(setqstartSpline(vlaxcurvegetStartParamsplineObj))
0.0
Obtaintheendparameterofthecurve:
_$(setqendSpline(vlaxcurvegetEndParamsplineObj))
17.1546
Determinethefirstderivativeattheparametermidwayalongthecurve:
_$(vlaxcurvegetFirstDerivsplineObj
(/(endsplinestartspline)2))
(0.4226311.09510.0)

vlaxcurvegetParamAtDist
Returnstheparameterofacurveatthespecifieddistancefromthebeginning
ofthecurve
(vlaxcurvegetParamAtDistcurveobjdist)

Arguments
curveobj
TheVLAobjecttobemeasured.
dist
Anumberspecifyingthedistancefromthebeginningofthecurve.

ReturnValues
Arealnumberrepresentingaparameter,ifsuccessful,otherwisenil.

Examples
AssumingthatsplineObjpointstothesplineshownintheexamplefor
vlaxcurvegetDistAtParam,determinetheparameteratadistanceof1.0from
thebeginningofthespline:
_$(vlaxcurvegetParamAtDistsplineObj1.0)
0.685049

vlaxcurvegetParamAtPoint
Returnstheparameterofthecurveatthepoint
(vlaxcurvegetParamAtPointcurveobjpoint)

Arguments
curveobj
TheVLAobjecttobemeasured.
point
A3Dpointlist(inWCS)oncurveobj.

ReturnValues
Arealnumberrepresentingaparameter,ifsuccessful,otherwisenil.

Examples
AssumingthatellipseObjpointstotheellipseshownintheexamplefor
vlaxcurvegetArea,setOSNAPtotangentandselectthepointwheretheline
istangenttotheellipse:
_$(setqselPt(getpoint))
(7.557655.550660.0)
Gettheparametervalueattheselectedpoint:
_$(vlaxcurvegetParamAtPointellipseObjselPt)
4.58296

vlaxcurvegetPointAtDist
Returnsthepoint(inWCS)alongacurveatthedistancespecifiedbytheuser
(vlaxcurvegetPointAtDistcurveobjdist)

Arguments
curveobj
TheVLAobjecttobemeasured.
dist
Thedistancealongthecurvefromthebeginningofthecurvetothelocationof
thespecifiedpoint.

ReturnValues
A3Dpointlistrepresentingapointonthecurve,ifsuccessful,otherwise
nil.

Examples
AssumingthatsplineObjpointstothesplineshownintheexamplefor
vlaxcurvegetDistAtParam,determinethepointatadistanceof1.0fromthe
beginningofthespline:
_$(vlaxcurvegetPointAtDistsplineObj1.0)
(2.242362.990050.0)

vlaxcurvegetPointAtParam

Returnsthepointatthespecifiedparametervaluealongacurve
(vlaxcurvegetPointAtParamcurveobjparam)

Arguments
curveobj
TheVLAobjecttobemeasured.
param
Anumberspecifyingaparameteronthecurve.

ReturnValues
A3Dpointlistrepresentingapointonthecurve,ifsuccessful,otherwise
nil.

Examples
Forthefollowingexample,assumethatsplineObjpointstothesplineshownin
theexampleforvlaxcurvegetDistAtParam.
Obtainthestartparameterofthecurve:
_$(setqstartSpline(vlaxcurvegetStartParamsplineObj))
0.0
Obtaintheendparameterofthecurve:
_$(setqendSpline(vlaxcurvegetEndParamsplineObj))
17.1546
Determinethepointattheparametermidwayalongthecurve:
_$(vlaxcurvegetPointAtParamsplineObj
(/(endsplinestartspline)2))
(6.713862.827480.0)

vlaxcurvegetSecondDeriv
Returnsthesecondderivative(inWCS)ofacurveatthespecifiedlocation
(vlaxcurvegetSecondDerivcurveobjparam)

Arguments
curveobj
TheVLAobjecttobemeasured.
param
Anumberspecifyingaparameteronthecurve.

ReturnValues
A3Dvectorlist,ifsuccessful,otherwisenil.

Examples
Forthefollowingexample,assumethatsplineObjpointstothesplineshownin
theexampleofthevlaxcurvegetDistAtParamfunction.
Obtainthestartparameterofthecurve:
_$(setqstartSpline(vlaxcurvegetStartParamsplineObj))
0.0
Obtaintheendparameterofthecurve:
_$(setqendSpline(vlaxcurvegetEndParamsplineObj))

17.1546
Determinethesecondderivativeattheparametermidwayalongthecurve:
_$(vlaxcurvegetSecondDerivsplineObj
(/(endsplinestartspline)2))
(0.01659670.1508480.0)

vlaxcurvegetStartParam
Returnsthestartparameteronthecurve
(vlaxcurvegetStartParamcurveobj)

Arguments
curveobj
TheVLAobjecttobemeasured.

ReturnValues
Arealnumberrepresentingthestartparameter,ifsuccessful,otherwisenil.

Examples
AssumingthatellipseObjpointstotheellipseshownintheexamplefor
vlaxcurvegetArea,determinethestartparameterofthecurve:
_$(vlaxcurvegetstartparamellipseObj)
0.0
SeeAlso
ThevlaxcurvegetEndParamfunction.

vlaxcurvegetStartPoint
Returnsthestartpoint(inWCS)ofthecurve
(vlaxcurvegetStartPointcurveobj)

Arguments
curveobj
TheVLAobjecttobemeasured.

ReturnValues
A3Dpointlistrepresentingthestartpoint,ifsuccessful,otherwisenil.

Examples
GetthestartpointoftheellipseusedtodemonstratevlaxcurvegetArea:
_$(vlaxcurvegetStartPointellipseObj)
(2.02.00.0)
Foranellipse,thestartpointsandendpointsarethesame.
Obtainthestartpointofthesplineusedtodemonstrate
vlaxcurvegetDistAtParam:
_$(vlaxcurvegetStartPointsplineObj)
(1.739622.125610.0)

vlaxcurveisClosed
Determinesifthespecifiedcurveisclosed(thatis,thestartpointisthe
sameastheendpoint)
(vlaxcurveisClosedcurveobj)

Arguments
curveobj
TheVLAobjecttobetested.

ReturnValues
Tifthecurveisclosed,otherwisenil.

Examples
DetermineiftheellipseusedtodemonstratevlaxcurvegetAreaisclosed:
_$(vlaxcurveisClosedellipseObj)
T
DetermineifthesplineusedtodemonstratevlaxcurvegetDistAtParamis
closed:
_$(vlaxcurveisClosedsplineObj)
nil

vlaxcurveisPeriodic
Determinesifthespecifiedcurvehasaninfiniterangeinbothdirectionsand
thereisaperiodvaluedT,suchthatapointonthecurveat(u+dT)=point
oncurve(u),foranyparameteru
(vlaxcurveisPeriodiccurveobj)

Arguments
curveobj
TheVLAobjecttobetested.

ReturnValues
Tifthecurveisperiodic,otherwisenil.

Examples
DetermineiftheellipseusedtodemonstratevlaxcurvegetAreaisperiodic:
_$(vlaxcurveisPeriodicellipseObj)
T
DetermineifthesplineusedtodemonstratevlaxcurvegetDistAtParamis
periodic:
_$(vlaxcurveisPeriodicsplineObj)
nil

vlaxcurveisPlanar
Determinesifthereisaplanethatcontainsthecurve
(vlaxcurveisPlanarcurveobj)

Arguments
curveobj
TheVLAobjecttobetested.

ReturnValues
Tifthereisaplanethatcontainsthecurve,otherwisenil.

Examples
Determineifthereisaplanecontainingtheellipseusedtodemonstrate
vlaxcurvegetArea:
_$(vlaxcurveisPlanarellipseObj)
T
Determineifthereisaplanecontainingthesplineusedtodemonstrate
vlaxcurvegetDistAtParam:
_$(vlaxcurveisPeriodicsplineObj)
nil

vlaxdumpobject
Listsanobject'sproperties,andoptionally,themethodsthatapplytothe
object
(vlaxdumpobjectobj[T])

Arguments
obj
AVLAobject.
T
Ifspecified,vlaxdumpobjectalsolistsallmethodsthatapplytoobj.

ReturnValues
T,ifsuccessful.Ifaninvalidobjectnameissupplied,vlaxdumpobject
displaysanerrormessage.

Examples
_$(setqaa(vlaxgetacadobject))
#<VLAOBJECTIAcadApplication00b3b91c>
_$(vlaxdumpobjectaa)
IAcadApplication:AutoCADApplicationInterface
Propertyvalues:
ActiveDocument(RO)=#<VLAOBJECTIAcadDocument01b52fac>
Application(RO)=#<VLAOBJECTIAcadApplication00b3b91c>
Caption(RO)="AutoCAD[Drawing.dwg]"
.
.
.
T
Listanobject'spropertiesandthemethodsthatapplytotheobject:
_$(vlaxdumpobjectaaT)

IAcadApplication:AutoCADApplicationInterface
Propertyvalues:
ActiveDocument(RO)=#<VLAOBJECTIAcadDocument01b52fac>
Application(RO)=#<VLAOBJECTIAcadApplication00b3b91c>
Caption(RO)="AutoCAD[Drawing.dwg]"
.
.
.
Methodssupported:
EndUndoMark()
Eval(1)
GetInterfaceObject(1)
ListAds()
ListArx()
.
.
.
T

vlaxename>vlaobject
TransformsentitytoVLAobject
(vlaxename>vlaobjectentname)

Arguments
entname
Anentityname(enamedatatype).

ReturnValues
AVLAobject.

Examples
_$(setqe(car(entsel)))
<Entityname:27e0540>
_$(vlaxename>vlaobjecte)
#<VLAOBJECTIAcadLWPolyline03f713a0>
SeeAlso
Thevlaxvlaobject>enamefunction.

vlaxerasedp
Determineswhetheranobjectwaserased
(vlaxerasedpobj)

Arguments

obj
AVLAobject.

ReturnValues
Tiftheobjectwaserased,otherwisenil.

vlaxfor
Iteratesthroughacollectionofobjects,evaluatingeachexpression
(vlaxforsymbolcollection[expression1[expression2...]])

Arguments
symbol
AsymboltobeassignedtoeachVLAobjectinacollection.
collection
AVLAobjectrepresentingacollectionobject.
expression1,expression2...
Theexpressionstobeevaluated.

ReturnValues
Thevalueofthelastexpressionevaluatedforthelastobjectinthe
collection.

Examples
Thefollowingcodeissuesvlaxdumpobjectoneverydrawingobjectinthemodel
space:
(vlloadcom)loadActiveXsupport
(vlaxforforitem
(vlagetmodelspace
(vlagetactivedocument(vlaxgetacadobject))
)
(vlaxdumpobjectforitem)listobjectproperties
)

vlaxgetacadobject
RetrievesthetoplevelAutoCADapplicationobjectforthecurrentAutoCAD
session
(vlaxgetacadobject)

ReturnValues
AVLAobject.

Examples
_$(setqaa(vlaxgetacadobject))
#<VLAOBJECTIAcadApplication00b3b91c>

vlaxgetobject
Returnsarunninginstanceofanapplicationobject
(vlaxgetobjectprogid)

Arguments
progid
Astringthatidentifiesthedesiredapplicationobject.Theformatofprogid
is:
appname.objecttype
whereappnameisthenameoftheapplicationandobjecttypeistheapplication
object.Theobjecttypemaybefollowedbyaversionnumber.

Note:Youcanusuallyfindtheprogidforanapplicationinthat
application'sHelp.Forexample,Microsoft(R)Officeapplicationsdocumentthis
informationintheVisualBasic(R)ReferencesectionoftheirHelp.

ReturnValues
Theapplicationobject,ornil,ifthereisnoinstanceofthespecifiedobject
currentlyrunning.

Examples
ObtaintheApplicationobjectfortheExcelprogram:
_$(vlaxgetobject"Excel.Application")
#<VLAOBJECT_Application0017bb5c>

vlaxgetorcreateobject
Returnsarunninginstanceofanapplicationobject,orcreatesanewinstance,
iftheapplicationisnotcurrentlyrunning
(vlaxgetorcreateobjectprogid)

Arguments
progid
AstringcontainingtheprogrammaticidentifierofthedesiredActiveXobject.
Theformatofprogidis:
<Vendor>.<Component>.<Version>
Forexample:
AutoCAD.Drawing.15

ReturnValues
Theobject.

Examples
_$(vlaxgetorcreateobject"Excel.Application")
#<VLAOBJECT_Application0017bb5c>

vlaxgetproperty
RetrievesaVLAobject'sproperty
(vlaxgetpropertyobjectproperty)

Thisfunctionwasformerlyknownasvlaxget.

Arguments
object
AVLAobject.
property
Asymbolorstringnamingthepropertytoberetrieved.

ReturnValues
Thevalueoftheobject'sproperty.

Examples
BeginbyretrievingapointertotherootAutoCADobject:
_$(setqacadObject(vlaxgetacadobject))
#<VLAOBJECTIAcadApplication00a4b2b4>
GettheAutoCADActiveDocumentproperty:
_$(setqacadDocument(vlaxgetpropertyacadObject
'ActiveDocument))
#<VLAOBJECTIAcadDocument00302a18>
Thefunctionreturnsthecurrentdocumentobject.
GettheModelSpacepropertyoftheActiveDocumentobject:
_$(setqmSpace(vlaxgetpropertyacadDocument'Modelspace))
#<VLAOBJECTIAcadModelSpace00c14b44>
Themodelspaceobjectofthecurrentdocumentisreturned.
ConvertadrawingentitytoaVLAobject:
_$(setqvlaobj(vlaxename>vlaobjecte))
#<VLAOBJECTIAcadLWPolyline0467114c>
Getthecolorpropertyoftheobject:
_$(vlaxgetpropertyvlaobj'Color)
256
SeeAlso
Thevlaxpropertyavailablepandvlaxputpropertyfunctions.

vlaximporttypelibrary
Importsinformationfromatypelibrary
(vlaximporttypelibrary:tlbfilenamefilename[:methodsprefixmprefix
:propertiesprefixpprefix:constantsprefixcprefix])

Arguments
filename
Astringnamingthetypelibrary.Afilecanbeoneofthefollowingtypes:
*Atypelibrary(.tlb)orobjectlibrary(.olb)file
*Anexecutable(.exe)file
*Alibrary(.dll)filecontainingatypelibraryresource
*Acompounddocumentholdingatypelibrary
*AnyotherfileformatthatcanbeunderstoodbytheLoadTypeLibAPI
Ifyouomitthepathfromtlbfilename,AutoCADlooksforthefileinthe
SupportFileSearchPath.

mprefix
Prefixtobeusedformethodwrapperfunctions.Forexample,ifthetype
librarycontainsaCalculatemethodandthemprefixparameterissetto"cc",
VisualLISPgeneratesawrapperfunctionnamedccCalculate.Thisparameter
defaultsto"".
pprefix
Prefixtobeusedforpropertywrapperfunctions.Forexample,ifthetype
librarycontainsaWidthpropertywithbothreadandwritepermissions,and
pprefixissetto"cc",thenVisualLISPgenerateswrapperfunctionsnamed
ccgetWidthandccputWidth.Thisparameterdefaultsto"".
cprefix
Prefixtobeusedforconstantscontainedinthetypelibrary.Forexample,if
thetypelibrarycontainsaccMaxCountOfRecordspropertywithbothreadand
writepermissions,andcprefixissetto"cc",VisualLISPgeneratesa
constantnamedccccMaxCountOfRecords.Thisparameterdefaultsto"".

Notetherequireduseofkeywordswhenpassingargumentsto
vlaximporttypelibrary.

ReturnValues
T,ifsuccessful.

Examples
ImportaMicrosoftWordTMtypelibrary,assigningtheprefix"msw"tomethods
andproperties,and"mswc"toconstants:
_$(vlaximporttypelibrary
:tlbfilename"c:/programfiles/microsoftoffice/msword8.olb"
:methodsprefix"msw"
:propertiesprefix"msw"
:constantsprefix"mswc")
T
Remarks
Functionwrapperscreatedbyvlaximporttypelibraryareavailableonlyinthe
contextofthedocumentvlaximporttypelibrarywasissuedfrom.
InthecurrentreleaseofVisualLISP,vlaximporttypelibraryisexecutedat
runtime,ratherthanatcompiletime.InfuturereleasesofVisualLISP,this
maychange.Thefollowingpracticesarerecommendedwhenusing
vlaximporttypelibrary:
*Ifyouwantyourcodetorunondifferentmachines,avoidspecifyingan
absolutepathinthetlbfilenameparameter.
*Ifpossible,avoidusingvlaximporttypelibraryfrominsideanyAutoLISP
expression(thatis,alwayscallitfromatoplevelposition).
*InyourAutoLISPsourcefile,codethevlaximporttypelibrarycallbefore
anycodethatusesmethodorpropertywrappersorconstantsdefinedinthe
typelibrary.
SeeAlso
Thevlaxtypeinfoavailablepfunction.

vlaxinvokemethod
CallsthespecifiedActiveXmethod
(vlaxinvokemethodobjmethodarg[arg...])
ThisfunctionwasknownasvlaxinvokepriortoAutoCAD2000.

Arguments

obj
AVLAobject.
method
Asymbolorstringnamingthemethodtobecalled.
arg
Argumenttobepassedtothemethodcalled.Noargumenttypecheckingis
performed.

ReturnValues
Dependsonthemethodinvoked.

Examples
ThefollowingexampleusestheAddCirclemethodtodrawacircleinthecurrent
AutoCADdrawing.
ThefirstargumenttoAddCirclespecifiesthelocationofthecenterofthe
circle.Themethodrequiresthecentertobespecifiedasavariantcontaining
athreeelementarrayofdoubles.Youcanusevlax3dpointtoconvertan
AutoLISPpointlisttotherequiredvariantdatatype:
_$(setqcircCenter(vlax3dpoint'(3.03.00.0)))
#<variant8197...>
NowusevlaxinvokemethodtodrawacirclewiththeAddCirclemethod:
_$(setqmycircle(vlaxinvokemethodmspace'AddCirclecircCenter
3.0))
#<VLAOBJECTIAcadCircle00bfd6e4>
SeeAlso
Thevlaxgetproperty,vlaxmethodapplicablep,
vlaxpropertyavailablep,andvlaxputpropertyfunctions.

vlaxldatadelete
ErasesLISPdatafromadrawingdictionary
(vlaxldatadeletedictkey[private])

Arguments
dict
AVLAobject,AutoCADdrawingentityobject,orastringnamingaglobal
dictionary.
key
Astringspecifyingthedictionarykey.
private
Ifanonnilvalueisspecifiedforprivateandvlaxldatadeleteiscalled
fromaseparatenamespaceVLX,vlaxldatadeletedeletesprivateLISPdatafrom
dict.(Seevlaxldatagetforexamplesusingthisargument.)

ReturnValues
T,ifsuccessful,otherwisenil(forexample,thedatadidnotexist).

Examples
AddLISPdatatoadictionary:
_$(vlaxldataput"dict""key"'(1))
(1)

UsevlaxldatadeletetodeletetheLISPdata:
_$(vlaxldatadelete"dict""key")
T
Ifvlaxldatadeleteiscalledagaintoremovethesamedata,itreturnsnil
becausethedatadoesnotexistinthedictionary:
_$(vlaxldatadelete"dict""key")
nil
SeeAlso
Thevlaxldataget,andvlaxldataputfunctions.

vlaxldataget
RetrievesLISPdatafromadrawingdictionaryoranobject
(vlaxldatagetdictkey[defaultdata][private])

Arguments
dict
AVLAobject,AutoCADdrawingentityobject,orastringnamingaglobal
dictionary.
key
Astringspecifyingthedictionarykey.
defaultdata
LISPdatatobereturnedifnomatchingkeyexistsinthedictionary.
private
Ifanonnilvalueisspecifiedforprivateandvlaxldatagetiscalledfroma
separatenamespaceVLX,vlaxldatagetretrievesprivateLISPdatafromdict.
Ifyouspecifyprivate,youmustalsospecifydefaultdatayoucanusenilfor
defaultdata.

NotethataseparatenamespaceVLXcanstorebothprivateandnonprivatedata
usingthesamedictandkey.Theprivatedatacanonlybeaccessedbythesame
VLX,butanyapplicationcanretrievethenonprivatedata.

ReturnValues
Thevalueofthekeyitem.

Examples
EnterthefollowingcommandsattheVisualLISPConsolewindow:
_$(vlaxldataput"mydict""mykey""MumboDumbo")
"MumboDumbo"
_$(vlaxldataget"mydict""mykey")
"MumboDumbo"
TotesttheuseofprivatedatafromaVLX
*EnterthefollowingcommandsattheVisualLISPConsolewindow:
_$(vlaxldataput"mydict""mykey""MumboDumbo")
"MumboDumbo"
_$(vlaxldataget"mydict""mykey")
"MumboDumbo"
*EnterthefollowingcodeinafileanduseMakeApplicationtobuildaVLX
fromthefile.UsetheExpertmodeoftheMakeApplicationWizard,and

selecttheSeparateNamespaceoptionintheCompileOptionstab.
(vldocexport'ldataput)
(vldocexport'ldataget)
(vldocexport'ldatagetnilt)
(defunldataput()
(princ"Thisisatestofputtingprivateldata")
(vlaxldataput"mydict""mykey""Mine!Mine!"T)
)
(defunldataget()
(vlaxldataget"mydict""mykey")
)
(defunldatagetnilt()
(vlaxldataget"mydict""mykey"nilT)
)
*LoadtheVLXfile.
*Runldataputtosaveprivatedata:
_$(ldataput)
Thisisatestofputtingprivateldata
Referbacktothecodedefiningldataput:thisfunctionstoresastring
containing"Mine!Mine!"
*RunldatagettoretrieveLISPdata:
_$(ldataget)
"MumboDumbo"
Noticethatthedatareturnedbyldatagetisnotthedatastoredbyldataput.
Thisisbecauseldatagetdoesnotspecifytheprivateargumentinitscallto
vlaxldataget.Sothedataretrievedbyldatagetisthedatasetbyissuing
vlaxldataputfromtheVisualLISPConsoleinstep1.
_$(ldatagetnilt)
"Mine!Mine!"
*RunldatagetnilttoretrieveLISPdata:
_$(ldatagetnilt)
"Mine!Mine!"
Thistimetheprivatedatasavedbyldataputisreturned,becauseldatagetnilt
specifiestheprivateargumentinitscalltovlaxldataget.
*FromtheVisualLISPConsoleprompt,issuethesamecallthatldatagetnilt
usestoretrieveprivatedata:
_$(vlaxldataget"mydict""mykey"nilT)
"MumboDumbo"
Theprivateargumentisignoredwhenvlaxldatagetisissuedoutsideofa
separatenamespaceVLX.Ifnonprivatedataexistsforthespecifieddictand
key(asinthisinstance),thatdatawillberetrieved.
SeeAlso
Thevlaxldataput,andvlaxldatalistfunctions.

vlaxldatalist
ListsLISPdatainadrawingdictionary

(vlaxldatalistdict[private])

Arguments
dict
AVLAobject,AutoCADdrawingentityobject,orastringnamingaglobal
dictionary.
private
IfvlaxldatalistiscalledfromaseparatenamespaceVLXandanonnilvalue
isspecifiedforprivate,vlaxldatalistretrievesonlyprivatedatastoredby
thesameVLX.(Seevlaxldatagetforexamplesusingthisargument.)

ReturnValues
Anassociativelistconsistingofpairs(key.value).

Examples
UsevlaxldataputtostoreLISPdatainadictionary:
_$(vlaxldataput"dict""cay""MumboJumbo")
"MumboJumbo"
_$(vlaxldataput"dict""say""Floobar")
"Floobar"
UsevlaxldatalisttodisplaytheLISPdatastoredin"dict":
_$(vlaxldatalist"dict")
(("say"."Floobar")("cay"."MumboJumbo"))
SeeAlso
Thevlaxldataget,andvlaxldataputfunctions.

vlaxldataput
StoresLISPdatainadrawingdictionaryoranobject
(vlaxldataputdictkeydata[private])

Arguments
dict
AVLAobject,AutoCADdrawingentityobject,orastringnamingaglobal
dictionary.
key
Astringspecifyingthedictionarykey.
data
LISPdatatobestoredinthedictionary.
private
IfvlaxldataputiscalledfromaseparatenamespaceVLXandanonnilvalue
isspecifiedforprivate,vlaxldataputmarksthedataasretrievableonlyby
thesameVLX.

ReturnValues
Thevalueofdata.

Examples
_$(vlaxldataput"dict""key"'(1))
(1)
_$(vlaxldataput"dict""cay""Gumbojumbo")

"Gumbojumbo"
SeeAlso
Thevlaxldataget,andvlaxldatalistfunctions.

vlaxldatatest
Determinesifdatacanbesavedoverasessionboundary
(vlaxldatatestdata)

Arguments
data
AnyLISPdatatobetested.

ReturnValues
T,ifthedatacanbesavedandrestoredoverthesessionboundary,nil
otherwise.

Examples
Determineifastringcanbesavedasldataoverasessionboundary:
_$(vlaxldatatest"Gumbojumbo")
T
Determineifafunctioncanbesavedasldataoverasessionboundary:
_$(vlaxldatatestyinyang)
nil
SeeAlso
Thevlaxldataget,andvlaxldatalist,and
vlaxldataputfunctions.

vlaxmakesafearray
Createsasafearray
(vlaxmakesafearraytype'(lbound.ubound)['(lbound.ubound)...)]
Amaximumof16dimensionscanbedefinedforanarray.Theelementsinthe
arrayareinitializedasfollows:
Numbers
0
Strings
Zerolengthstring.
Booleans
:vlaxfalse
Object
nil
Variant
Uninitialized(vlaxvbEmpty)

Arguments

type
Thetypeofsafearray.Specifyoneofthefollowingconstants:
vlaxvbInteger(2)Integer
vlaxvbLong(3)Longinteger
vlaxvbSingle(4)Singleprecisionfloatingpointnumber
vlaxvbDouble(5)Doubleprecisionfloatingpointnumber
vlaxvbString(8)String
vlaxvbObject(9)Object
vlaxvbBoolean(11)Boolean
vlaxvbVariant(12)Variant
Theintegershowninparenthesesindicatesthevaluetowhichtheconstant
evaluates.Itisrecommendedthatyouspecifytheconstantinyourargument,
nottheintegervalue,incasethevaluechangesinlaterreleasesofAutoCAD.
'(lbound.ubound)
Lowerandupperindexboundariesofadimension.

ReturnValues
Thesafearraycreated.

Examples
Createasingledimensionsafearrayconsistingofdoubles,beginningwithindex
0:
_$(setqpoint(vlaxmakesafearrayvlaxvbDouble'(0.3)))
#<safearray...>
Usethevlaxsafearray>listfunctiontodisplaythecontentsofthesafearray
asalist:
_$(vlaxsafearray>listpoint)
(0.00.00.00.0)
Theresultshowseachelementofthearraywasinitializedtozero.
Createatwodimensionarrayofstrings,witheachdimensionstartingatindex
1:
_$(setqmatrix(vlaxmakesafearrayvlaxvbString'(1.2)'(1.
2)))
#<safearray...>
SeeAlso
Thevlaxmakevariant,vlaxsafearraygetdim,vlaxsafearraygetelement,vlaxsafearraygetlbound,
vlaxsafearraygetubound,vlaxsafearrayputelement,vlaxsafearraytype,andvlaxvariantvalue
functions.Formoreinformationonusingthesefunctions,seeWorkingwithSafearraysintheVisualLISPDeveloper'sGuide.

vlaxmakevariant
Createsavariantdatatype
(vlaxmakevariant[value][type])

Arguments
value
Thevaluetobeassignedtothevariant.Ifomitted,thevariantiscreated
withthevlaxvbEmptytype(uninitialized).
type

Thetypeofvariant.Thiscanberepresentedbyoneofthefollowingconstants:
vlaxvbEmpty(0)Uninitialized(defaultvalue)
vlaxvbNull(1)Containsnovaliddata
vlaxvbInteger(2)Integer
vlaxvbLong(3)Longinteger
vlaxvbSingle(4)Singleprecisionfloatingpointnumber
vlaxvbDouble(5)Doubleprecisionfloatingpointnumber
vlaxvbString(8)String
vlaxvbObject(9)Object
vlaxvbBoolean(11)Boolean
vlaxvbArray(8192)Array
Theintegershowninparenthesesindicatesthevaluetowhichtheconstant
evaluates.Itisrecommendedthatyouspecifytheconstantinyourargument,
nottheintegervalue,becausethevaluemaychangeinlaterreleasesof
AutoCAD.
Ifyoudonotspecifyatype,vlaxmakevariantassignsadefaultdatatype
basedonthedatatypeofthevalueitreceives.Thefollowinglistidentifies
thedefaultvariantdatatypeassignedtoeachLISPdatatype:
nilvlaxvbEmpty
:vlaxnullvlaxvbNull
integervlaxvbLong
realvlaxvbDouble
stringvlaxvbString
VLAobjectvlaxvbObject
:vlaxtrue,:vlaxfalsevlaxvbBoolean
variantSameasthetypeofinitialvalue
vlaxmakesafearrayvlaxvbArray

ReturnValues
Thevariantcreated.

Examples
Createavariantusingthedefaultsforvlaxmakevariant:
_$(setqvarnil(vlaxmakevariant))
#<variant0>
Thefunctioncreatesanuninitialized(vlaxvbEmpty)variantbydefault.You
canaccomplishthesamethingexplicitlywiththefollowingcall:
_$(setqvarnil(vlaxmakevariantnil))
#<variant0>
Createanintegervariantandsetitsvalueto5:
_$(setqvarint(vlaxmakevariant5vlaxvbInteger))
#<variant25>
Repeatthepreviouscommand,butomitthetypeargumentandseewhathappens:
_$(setqvarint(vlaxmakevariant5))
#<variant35>
Bydefault,vlaxmakevariantassignedthespecifiedintegervaluetoaLong
integerdatatype,notInteger,asyoumightexpect.Thishighlightsthe
importanceofexplicitlystatingthetypeofvariantyouwantwhenworkingwith

numbers.
Omittingthetypeargumentforastringproducespredictableresults:
_$(setqvarstr(vlaxmakevariant"ghost"))
#<variant8ghost>
Tocreateavariantcontainingarrays,youmustspecifytypevlaxvbArray,
alongwiththetypeofdatainthearray.Forexample,tocreateavariant
containinganarrayofdoubles,firstsetavariable'svaluetoanarrayof
doubles:
_$(setq4dubs(vlaxmakesafearrayvlaxvbDouble'(0.3)))
#<safearray...>
Thentakethearrayofdoublesandassignittoavariant:
_$(vlaxmakevariant4dubs)
#<variant8197...>
SeeAlso
Thevlaxvarianttype,
andvlaxvariantvaluefunctions.Formoreinformationonusingvariants,see
WorkingwithVariantsintheVisualLISPDeveloper'sGuide.

vlaxmapcollection
Appliesafunctiontoallobjectsinacollection
(vlaxmapcollectionobjfunction)

Arguments
obj
AVLAobjectrepresentingacollection.
function
Asymbolorlambdaexpressiontobeappliedtoobj.

ReturnValues
Theobjfirstargument.

Examples
(vlaxmapcollection(vlagetModelSpaceacadDocument)'vlaxdump
object)
IAcadLWPolyline:AutoCADLightweightPolylineInterface
Propertyvalues:
Application(RO)=#<VLAOBJECTIAcadApplication00a4ae24>
Area(RO)=2.46556
Closed=0
Color=256
ConstantWidth=0.0
Coordinate=...Indexedcontentsnotshown...
Coordinates=(8.499177.0015511.29963.7313714.85.74379...)
Database(RO)=#<VLAOBJECTIAcadDatabase01e3da44>
Elevation=0.0
Handle(RO)="53"
HasExtensionDictionary(RO)=0

Hyperlinks(RO)=#<VLAOBJECTIAcadHyperlinks01e3d7d4>
Layer="0"
Linetype="BYLAYER"
LinetypeGeneration=0
LinetypeScale=1.0
Lineweight=1
Normal=(0.00.01.0)
ObjectID(RO)=28895576
ObjectName(RO)="AcDbPolyline"
PlotStyleName="ByLayer"
Thickness=0.0
Visible=1
T

vlaxmethodapplicablep
Determinesifanobjectsupportsaparticularmethod
(vlaxmethodapplicablepobjmethod)

Arguments
obj
AVLAobject.
method
Asymbolorstringcontainingthenameofthemethodtobechecked.

ReturnValues
T,iftheobjectsupportsthemethod,nilotherwise.

Examples
ThefollowingcommandsareissuedagainstaLightweightPolylineobject:
_$(vlaxmethodapplicablepWhatsMyLine'copy)
T
_$(vlaxmethodapplicablepWhatsMyLine'AddBox)
nil
SeeAlso
Thevlaxpropertyavailablepfunction.

vlaxobjectreleasedp
Determinesifanobjecthasbeenreleased
(vlaxobjectreleasedpobj)

Note:ErasingaVLAobject(usingcommandERASEorvlaerase)doesnotrelease
theobject.AVLAobjectisnotreleaseduntilyoueitherinvoke
vlaxreleaseobjectontheobject,normalAutoLISPgarbagecollectionoccurs,
orthedrawingdatabaseisdestroyedattheendofthedrawingsession.

Arguments
obj
AVLAobject.

ReturnValues
T,iftheobjectisreleased(noAutoCADdrawingobjectisattachedtoobj),
nil,iftheobjecthasnotbeenreleased.

Examples
AttachanExcelapplicationtothecurrentAutoCADdrawing:
_$(setqexcelobj(vlaxgetobject"Excel.Application"))
#<VLAOBJECT_Application00168a54>
ReleasetheExcelobject:
_$(vlaxreleaseobjectexcelobj)
1
Issuevlaxobjectreleasedptoverifytheobjectwasreleased:
_$(vlaxobjectreleasedpexcelobj)
T

vlaxproductkey
ReturnstheAutoCADWindowregistrypath
(vlaxproductkey)
TheAutoCADregistrypathcanbeusedtoregisteranapplicationfordemand
loading.

ReturnValues
AstringcontainingtheAutoCADregistrypath.

Examples
_$(vlaxproductkey)
"Software\\Autodesk\\AutoCAD\\R15.0\\ACAD1:409"

vlaxpropertyavailablep
Determinesifanobjecthasaspecifiedproperty
(vlaxpropertyavailablepobjprop[checkmodify])

Arguments
obj
AVLAobject.
property
Asymbolorstringnamingthepropertytobechecked.
checkmodify
IfTisspecifiedforthisargument,vlaxpropertyavailablepalsochecksthat
thepropertycanbemodified.

ReturnValues

T,iftheobjecthasthespecifiedproperty,otherwisenil.IfTisspecified
forthecheckmodifyargument,vlaxpropertyavailablepreturnsnilifeither
thepropertyisnotavailableorthepropertycannotbemodified.

Examples
ThefollowingexamplesapplytoaLightweightPolylineobject:
_$(vlaxpropertyavailablepWhatsMyLine'Color)
T
_$(vlaxpropertyavailablepWhatsMyLine'center)
nil
ThefollowingexamplesapplytoaCircleobject:
_$(vlaxpropertyavailablepmyCircle'area)
T

Notehowsupplyingtheoptionalthirdargumentchangestheresult:
_$(vlaxpropertyavailablepmyCircle'areaT)
nil
Thefunctionreturnsnilbecause,althoughthecirclehasan"area"property,
thatpropertycannotbemodified.
SeeAlso
Thevlaxputpropertyfunctions.

vlaxputproperty
SetthepropertyofanActiveXobject
(vlaxputpropertyobjpropertyarg)
Thisfunctionwasformerlyknownasvlaxput.

Arguments
obj
AVLAobject.
property
Asymbolorstringnamingthepropertytobeset.
arg
Thevaluetobeset.

ReturnValues
Nil,ifsuccessful.

Examples
Coloranobjectred:
_$(vlaxputpropertyvlaobj'Color1)
nil
SeeAlso
Thevlaxpropertyavailablepfunctions.

vlaxreadenabledp

Determinesifanobjectcanberead
(vlaxreadenabledpobj)

Arguments
obj
AVLAobject.

ReturnValues
T,iftheobjectisreadable,otherwisenil.

vlaxreleaseobject
Releasesadrawingobject
(vlaxreleaseobjectobj)

Arguments
obj
AVLAobject.
Afterrelease,thedrawingobjectisnolongeraccessiblethroughobj.

ReturnValues
Unspecified.

vlaxremovecmd
Removesasinglecommandoracommandgroup
(vlaxremovecmdglobalname)
RemovesasinglecommandorthewholecommandgroupforthecurrentAutoCAD
session.

Arguments
globalname
Eitherastringnamingthecommand,orT.IfglobalnameisT,thewhole
commandgroupVLCAppName(forexample,VLCVLIDE)isdeleted.

ReturnValues
T,ifsuccessful,nilotherwise(forexample,thecommandisnotdefined).

Examples
Removeacommanddefinedwithvlaxaddcmd:
_$(vlaxremovecmd"helloautocad")
T
Repeatthevlaxremovecmd:
_$(vlaxremovecmd"helloautocad")
nil
Thistimevlaxremovecmdreturnsnil,becausethespecifiedcommanddoesnot
existanymore.
SeeAlso

Thevlaxaddcmdfunction.

vlaxsafearrayfill
Storesdataintheelementsofasafearray
(vlaxsafearrayfillvar'elementvalues)

Arguments
var
Avariablewhosedatatypeisasafearray.
'elementvalues
Alistofvaluestobestoredinthearray.Youcanspecifyasmanyvaluesas
thereareelementsinthearray.Ifyouspecifyfewervaluesthanthereare
elements,theremainingelementsretaintheircurrentvalue.
Formultidimensionarrays,elementvaluesmustbealistoflists,witheach
listcorrespondingtoadimensionofthearray.

ReturnValues
var

Examples
Createasingledimensionarrayofdoubles:
_$(setqsa(vlaxmakesafearrayvlaxvbdouble'(0.2)))
#<safearray...>
Usevlaxsafearrayfilltopopulatethearray:
_$(vlaxsafearrayfillsa'(123))
#<safearray...>
Listthecontentsofthearray:
_$(vlaxsafearray>listsa)
(1.02.03.0)
Usevlaxsafearrayfilltosetthefirstelementinthearray:
_$(vlaxsafearrayfillsa'(66))
#<safearray...>
Listthecontentsofthearray:
_$(vlaxsafearray>listsa)
(66.02.03.0)
Noticethatonlythefirstelementinthearrayhasbeenchangedtheremaining
elementsareunaffectedandretainthevalueyoupreviouslysetthemto.Ifyou
needtochangethesecondorthirdelementsandleavethefirstelement
unaffected,usevlaxputelement.
Instructvlaxsafearrayfilltosetfourelementsinanarraythatcontains
onlythreeelements:
_$(vlaxsafearrayfillsa'(1234))
Error:Assertionfailed:safearrayfillfailed.Toomanyelements.
Thevlaxsafearrayfillfunctionreturnsanerrorifyouspecifymoreelements
thanthearraycontains.
Toassignvaluestoamultidimensionalarray,specifyalistofliststo
vlaxsafearrayfill,witheachlistcorrespondingtoadimension.Thefollowing
commandcreatesatwodimensionarrayofstringscontainingthreeelementsin
eachdimension:

_$(setqmat2(vlaxmakesafearrayvlaxvbString'(0.1)'(1.3)))
#<safearray...>
Usevlaxsafearrayfilltopopulatethearray:
_$(vlaxsafearrayfillmat2'(("a""b""c")("d""e""f")))
#<safearray...>
Callthevlaxsafearray>listfunctiontoconfirmthecontentsofmat2:
_$(vlaxsafearray>listmat2)
(("a""b""c")("d""e""f"))
SeeAlso
Thevlaxsafearraygetdim,
vlaxsafearraygetlbound,
vlaxsafearrayputelement,
vlaxvariantvalue
functions.

vlaxsafearraygetdim
Returnsthenumberofdimensionsinasafearrayobject
(vlaxsafearraygetdimvar)

Arguments
var
Avariablewhosedatatypeisasafearray.

ReturnValues
Anintegeridentifyingthenumberofdimensionsinvar.Anerroroccursifvar
isnotasafearray.

Examples
Setsainttoasingledimensionsafearraywithonedimension:
_$(setqsaint(vlaxmakesafearrayvlaxvbinteger'(1.4)))
#<safearray...>
Usevlaxsafearraygetdimtoreturnthenumberofdimensionsinsaint:
_$(vlaxsafearraygetdimsaint)
1
SeeAlso
Thevlaxsafearraygetlbound,and
vlaxsafearraygetuboundfunctions.

vlaxsafearraygetelement
Returnsanelementfromanarray
(vlaxsafearraygetelementvarelement...)

Arguments
var
Avariablewhosedatatypeisasafearray.
element...

Integersspecifyingtheindexesoftheelementtoberetrieved.Foranarray
withonedimension,specifyasingleinteger.Formultidimensionarrays,
specifyasmanyindexesastherearedimensions.

ReturnValues
Thevalueoftheelement.

Examples
Createanarraywithtwodimensions,eachdimensionstartingatindex1:
_$(setqmatrix(vlaxmakesafearrayvlaxvbString'(1.2)'(1.
2)))
#<safearray...>
Usevlaxsafearrayputelementtopopulatethearray:
_$(vlaxsafearrayputelementmatrix11"a")
"a"
_$(vlaxsafearrayputelementmatrix12"b")
"b"
_$(vlaxsafearrayputelementmatrix21"c")
"c"
_$(vlaxsafearrayputelementmatrix22"d")
"d"
Usevlaxsafearraygetelementtoretrievethesecondelementinthefirst
dimensionofthearray:
_$(vlaxsafearraygetelementmatrix12)
"b"
SeeAlso
Thevlaxsafearraygetdim,
vlaxsafearraygetubound,and
vlaxsafearrayputelementfunctions.

vlaxsafearraygetlbound
Returnsthelowerboundary(startingindex)ofadimensionofanarray
(vlaxsafearraygetlboundvardim)

Arguments
var
Avariablewhosedatatypeisasafearray.
dim
Adimensionofthearray.Thefirstdimensionisdimension1.

ReturnValues
Anintegerrepresentingthelowerboundary(startingindex)ofthedimension.
Ifvarisnotanarray,ordimisinvalid(forexample,0,oranumbergreater
thanthenumberofdimensionsinthearray),anerrorresults.

Examples
Thefollowingexamplesevaluateasafearraydefinedasfollows:
(vlaxmakesafearrayvlaxvbString'(1.2)'(0.1)))
Getthestartingindexvalueofthearray'sfirstdimension:

_$(vlaxsafearraygetlboundtmatrix1)
1
Thefirstdimensionstartswithindex1.
Getthestartingindexvalueoftheseconddimensionofthearray:
_$(vlaxsafearraygetlboundtmatrix2)
0
Theseconddimensionstartswithindex0.
SeeAlso
Thevlaxsafearraygetdim,and
vlaxsafearraygetuboundfunctions.

vlaxsafearraygetubound
Returnstheupperboundary(endindex)ofadimensionofanarray
(vlaxsafearraygetuboundvardim)

Arguments
var
Avariablewhosedatatypeisasafearray.
dim
Adimensionofthearray.Thefirstdimensionisdimension1.

ReturnValues
Anintegerrepresentingtheupperboundary(endindex)ofthedimension.Ifvar
isnotanarray,ordimisinvalid(forexample,0,oranumbergreaterthan
thenumberofdimensionsinthearray),anerrorresults.

Examples
Thefollowingexamplesevaluateasafearraydefinedasfollows:
(vlaxmakesafearrayvlaxvbString'(1.2)'(0.1)))
Gettheendindexvalueofthearray'sfirstdimension:
_$(vlaxsafearraygetuboundtmatrix1)
2
Thefirstdimensionendswithindex2.
Gettheendindexvalueoftheseconddimensionofthearray:
_$(vlaxsafearraygetuboundtmatrix2)
1
Theseconddimensionstartswithindex1.
SeeAlso
Thevlaxsafearraygetdim,and
vlaxsafearraygetlboundfunctions.

vlaxsafearrayputelement
Addsanelementtoanarray
(vlaxsafearrayputelementvarindex...value)

Arguments
var
Avariablewhosedatatypeisasafearray.
index...
Asetofindexvaluespointingtotheelementyouareassigningavalueto.For
asingledimensionarray,specifyoneindexvalueforatwodimensionarray,
specifytwoindexvalues,andsoon.
value
Thevaluetoassignthesafearrayelement.

ReturnValues
Thevalueassignedtotheelement.

Examples
Createasingledimensionarrayconsistingofdoubles:
_$(setqpoint(vlaxmakesafearrayvlaxvbDouble'(0.2)))
#<safearray...>
Usevlaxsafearrayputelementtopopulatethearray:
_$(vlaxsafearrayputelementpoint0100)
100
_$(vlaxsafearrayputelementpoint1100)
100
_$(vlaxsafearrayputelementpoint20)
0
Createatwodimensionarrayconsistingofstrings:
_$(setqmatrix(vlaxmakesafearrayvlaxvbString'(1.2)'(1.
2)))
#<safearray...>
Usevlaxsafearrayputelementtopopulatethearray:
_$(vlaxsafearrayputelementmatrix11"a")
"a"
_$(vlaxsafearrayputelementmatrix12"b")
"b"
_$(vlaxsafearrayputelementmatrix21"c")
"c"
_$(vlaxsafearrayputelementmatrix22"d")
"d"

Notethatyoucanalsopopulatearraysusingthevlaxsafearrayfillfunction.
Thefollowingfunctioncallaccomplishesthesametaskasthree
vlaxsafearrayputelementcalls:
(vlaxsafearrayfillmatrix'(("a""b")("c""d")))
SeeAlso
Thevlaxsafearrayfill,and
vlaxsafearraytypefunctions.

vlaxsafearraytype

Returnsthedatatypeofasafearray
(vlaxsafearraytypevar)

Arguments
var
Avariablecontainingasafearray.

ReturnValues
Ifvarcontainsasafearray,oneofthefollowingintegersisreturned:
2
Integer(vlaxvbInteger)
3
Longinteger(vlaxvbLong)
4
Singleprecisionfloatingpointnumber(vlaxvbSingle)
5
Doubleprecisionfloatingpointnumber(vlaxvbDouble)
8
String(vlaxvbString)
9
Object(vlaxvbObject)
11
Boolean(vlaxvbBoolean)
12
Variant(vlaxvbVariant)
Ifvardoesnotcontainasafearray,anerrorresults.

Examples
Createasingledimensionarrayofdoublesandatwodimensionarrayof
strings:
_$(setqpoint(vlaxmakesafearrayvlaxvbDouble'(0.2)))
#<safearray...>
_$(setqmatrix(vlaxmakesafearrayvlaxvbString'(1.2)'(1.
2)))
#<safearray...>
Usevlaxsafearraytypetoverifythedatatypeofthesafearrays:
_$(vlaxsafearraytypepoint)
5
_$(vlaxsafearraytypematrix)
8
SeeAlso
Thevlaxmakesafearrayfunction.

vlaxsafearray>list

Returnstheelementsofasafearrayinlistform
(vlaxsafearray>listvar)

Arguments
var
Avariablecontainingasafearray.

ReturnValues
Alist.

Examples
Createasingledimensionarrayofdoubles:
_$(setqpoint(vlaxmakesafearrayvlaxvbDouble'(0.2)))
#<safearray...>
Usevlaxsafearrayputelementtopopulatethearray:
_$(vlaxsafearrayputelementpoint0100)
100
_$(vlaxsafearrayputelementpoint1100)
100
_$(vlaxsafearrayputelementpoint20)
0
Convertthearraytoalist:
_$(setqpointlist(vlaxsafearray>listpoint))
(100.0100.00.0)
Thefollowingexampledemonstrateshowatwodimensionarrayofstringsis
displayedbyvlaxsafearray>list:
_$(vlaxsafearray>listmatrix)
(("a""b")("c""d"))
SeeAlso
Thevlaxsafearrayfill,and
vlaxsafearrayputelementfunctions.

vlaxtmatrix
Returnsasuitablerepresentationfora4x4transformationmatrixtobeused
inVLAmethods
(vlaxtmatrixlist)

Arguments
list
Alistoffourlists,eachcontainingfournumbers,representingtransformation
matrixelements.

ReturnValues
Avariantoftypesafearray,representingthe4x4transformationmatrix.

Examples
Defineatransformationmatrixandassignitsvaluetovariabletmatrix:
_$(setqtmatrix(vlaxtmatrix'((1110)(1230)(2345)(29
83))))

#<variant8197...>
Usevlaxsafearray>listtoviewthevalueoftmatrixinlistform:
_$(vlaxsafearray>list(vlaxvariantvaluetmatrix))
((1.01.01.00.0)(1.02.03.00.0)(2.03.04.05.0)(2.09.08.0
3.0))
Thefollowingcodeexamplecreatesalineandrotatesit90degreesusinga
transformationmatrix:
(defunExample_TransformBy()/lineObjstartPtendPtmatList
transMat)
(vlloadcom)LoadActiveXsupport
(setqacadObject(vlaxgetacadobject))
(setqacadDocument(vlagetActiveDocumentacadObject))
(setqmSpace(vlagetModelSpaceacadDocument))
Createaline
(setqstartPt(getpoint"Pickthestartpoint"))
(setqendPt(vlax3dpoint(getpointstartPt"Picktheend
point")))
(setqlineObj(vlaaddlinemSpace(vlax3dpointstartPt)endPt))
InitializethetransMatvariablewithatransformationmatrix
thatwillrotateanobjectby90degreesaboutthepoint(0,0,0).
BeginbyCreatingalistoffourlists,eachcontainingfour
numbers,representingtransformationmatrixelements.
(setqmatList(list'(0100)'(1000)'(0010)'(0001)))
Usevlaxtmatrixtoconvertthelisttoavariant.
(setqtransmat(vlaxtmatrixmatlist))
Transformthelineusingthedefinedtransformationmatrix
(vlatransformbylineObjtransMat)
(vlazoomallacadObject)
(princ"Thelineistransformed")
(princ)
)

vlaxtypeinfoavailablep
DetermineswhetherTypeLibinformationispresentforthespecifiedtypeof
object
VisualLISPrequiresTypeLibinformationtodeterminewhetheramethodor
propertyisavailableforanobject.SomeobjectsmaynothaveTypeLib
information(forexample,AcadDocument).
(vlaxtypeinfoavailablepobj)

Arguments
obj
AVLAobject.

ReturnValues
T,ifTypeLibinformationisavailable,otherwisenil.

SeeAlso
Thevlaximporttypelibraryfunction.

vlaxvariantchangetype
Returnsthevalueofavariantafterchangingitfromonedatatypetoanother
(vlaxvariantchangetypevartype)
Thevlaxvariantchangetypefunctionreturnsthevalueofthespecified
variableafterconvertingthatvaluetothespecifiedvarianttype.

Arguments
var
Avariablewhosevalueisavariant.
type
Thetypeofvarianttoreturn,usingthevalueofvar(thevalueofvaris
unchanged).Thetypevaluecanberepresentedbyoneofthefollowing
constants:
vlaxvbEmpty(0)Uninitialized
vlaxvbNull(1)Containsnovaliddata
vlaxvbInteger(2)Integer
vlaxvbLong(3)Longinteger
vlaxvbSingle(4)Singleprecisionfloatingpointnumber
vlaxvbDouble(5)Doubleprecisionfloatingpointnumber
vlaxvbString(8)String
vlaxvbObject(9)Object
vlaxvbBoolean(11)Boolean
vlaxvbArray(8192)Array
Theintegershowninparenthesesindicatesthevaluetowhichtheconstant
evaluates.Itisrecommendedthatyouspecifytheconstantinyourargument,
nottheintegervalue,incasethevaluechangesinlaterreleasesofAutoCAD.

ReturnValues
Thevalueofvar,afterconvertingittothespecifiedvarianttype,ornil,if
varcouldnotbeconvertedtothespecifiedtype.

Examples
Setavariablenamedvarinttoavariantvalue:
_$(setqvarint(vlaxmakevariant5))
#<variant35>
Setavariablenamedvarintstrtothevaluecontainedinvarint,butconvert
thatvaluetoastring:
_$(setqvarintStr(vlaxvariantchangetypevarintvlaxvbstring))
#<variant85>
Checkthevalueofvarintstr:
_$(vlaxvariantvaluevarintStr)
"5"
Thisconfirmsthatvarintstrcontainsastring.
SeeAlso

Thevlaxvariantvaluefunctions.

vlaxvarianttype
Determinesthedatatypeofavariant
(vlaxvarianttypevar)

Arguments
var
Avariablewhosevalueisavariant.

ReturnValues
Ifvarcontainsavariant,oneofthefollowingintegersisreturned:
0
Uninitialized(vlaxvbEmpty)
1
Containsnovaliddata(vlaxvbNull)
2
Integer(vlaxvbInteger)
3
Longinteger(vlaxvbLong)
4
Singleprecisionfloatingpointnumber(vlaxvbSingle)
5
Doubleprecisionfloatingpointnumber(vlaxvbDouble)
8
String(vlaxvbString)
9
Object(vlaxvbObject)
11
Boolean(vlaxvbBoolean)
8192+n
Safearray(vlaxvbArray)ofsomedatatype.Forexample,anarrayofdoubles
(vlaxvbDouble)returns8197(8192+5).
Ifvardoesnotcontainavariant,anerrorresults.

Examples
Setavarianttonilanddisplaythevariant'sdatatype:
_$(setqvarnil(vlaxmakevariantnil))
#<variant0>
_$(vlaxvarianttypevarnil)
0
Setavarianttoanintegervalueandexplicitlydefinethevariantasan
integerdatatype:
_$(setqvarint(vlaxmakevariant5vlaxvbInteger))

#<variant25>
_$(vlaxvarianttypevarint)
2
Setavarianttoanintegervalueanddisplaythevariant'sdatatype:
_$(setqvarint(vlaxmakevariant5))
#<variant35>
_$(vlaxvarianttypevarint)
3
Noticethatwithoutexplicitlydefiningthedatatypetovlaxmakevariant,an
integerassignmentresultsinaLongintegerdatatype.
Setavarianttoastringanddisplaythevariant'sdatatype:
_$(setqvarstr(vlaxmakevariant"ghost"))
#<variant8ghost>
_$(vlaxvarianttypevarstr)
8
Createasafearrayofdoubles,assignthesafearraytoavariant,anddisplay
thevariant'sdatatype:
_$(setq4dubs(vlaxmakesafearrayvlaxvbDouble'(0.3)))
#<safearray...>
_$(setqvar4dubs(vlaxmakevariant4dubs))
#<variant8197...>
_$(vlaxvarianttypevar4dubs)
8197
Avarianttypevaluegreaterthan8192indicatesthatthevariantcontainssome
typeofsafearray.Subtract8192fromthereturnvaluetodeterminethedata
typeofthesafearray.Inthisexample,81978192=5(vlaxvbDouble).
Assignarealvaluetoavariable,thenissuevlaxvarianttypetocheckthe
variable'sdatatype:
_$(setqnotvar6.0)
6.0
_$(vlaxvarianttypenotvar)
ERROR:badargumenttype:variantp6.0
Thislastexampleresultsinanerror,becausethevariablepassedto
vlaxvarianttypedoesnotcontainavariant.
SeeAlso
Thevlaxvariantchangetype,
andvlaxvariantvaluefunctions.

vlaxvariantvalue
Returnsthevalueofavariant
(vlaxvariantvaluevar)

Arguments
var
Avariablewhosevalueisavariant.

ReturnValues
Thevalueofthevariable.Ifthevariabledoesnotcontainavariant,anerror
occurs.

Examples
_$(vlaxvariantvaluevarstr)
"ghost"
_$(vlaxvariantvaluevarint)
5
_$(vlaxvariantvaluenotvar)
ERROR:badargumenttype:variantp6.0
Thelastexampleresultsinanerror,becausenotvardoesnotcontaina
variant.
SeeAlso
Thevlaxmakevariantfunctions.

vlaxvlaobject>ename
TransformsaVLAobjecttoanAutoLISPentity
(vlaxvlaobject>enameobj)

Arguments
obj
AVLAobject.

ReturnValues
AnAutoLISPentityname(enamedatatype).

Examples
_$(vlaxvlaobject>enamevlaobj)
<Entityname:27e0540>
SeeAlso
Thevlaxename>vlaobjectfunction.

vlaxwriteenabledp
DeterminesifanAutoCADdrawingobjectcanbemodified
(vlaxwriteenabledpobj)

Arguments
obj
AVLAobjectorAutoLISPentityobject(ename).

ReturnValues
T,iftheAutoCADdrawingobjectcanbemodified,niliftheobjectcannotbe
modified.

vlispcompile

CompilesAutoLISPsourcecodeintoaFASfile
(vlispcompile'modefilename[outfilename])

Note:TheVisualLISPIDEmustbeopeninorderforvlispcompiletowork.
Arguments
mode
Thecompilermode,whichcanbeoneofthefollowingsymbols:
stStandardbuildmode
lsmOptimizeandlinkindirectly
lsaOptimizeandlinkdirectly
filename
AstringidentifyingtheAutoLISPsourcefile.Ifthesourcefileisinthe
AutoCADSupportFileSearchPath,youcanomitthepathwhenspecifyingthe
filename.Ifyouomitthefileextension,.lspisassumed.
outfilename
Astringidentifyingthecompiledoutputfile.Ifyoudonotspecifyanoutput
file,vlispcompilenamestheoutputwiththesamenameastheinputfile,but
replacestheextensionwith.fas.

Notethatifyouspecifyanoutputfilenamebutdonotspecifyapathnamefor
eithertheinputortheoutputfile,vlispcompileplacestheoutputfilein
theAutoCADinstalldirectory.

ReturnValues
T,ifcompilationissuccessful,nilotherwise.

Examples
Assumingthatyinyang.lspresidesinadirectorythatisintheAutoCADSupport
FileSearchPath,thefollowingcommandcompilesthisprogram:
_$(vlispcompile'st"yinyang.lsp")
T
Theoutputfileisnamedyinyang.fasandresidesinthesamedirectoryasthe
sourcefile.
Thefollowingcommandcompilesyinyang.lspandnamestheoutputfile
GoodKarma.fas:
(vlispcompile'st"yinyang.lsp""GoodKarma.fas")

NotethattheoutputfilefromthepreviouscommandresidesintheAutoCAD
installdirectory,notthedirectorywhereyinyang.lspresides.Thefollowing
commandcompilesyinyang.lspanddirectstheoutputfiletothec:\mydocuments
directory:
(vlispcompile'st"yinyang.lsp""c:/mydocuments/GoodKarma")
Thislastexampleidentifiesthefullpathofthefiletobecompiled:
(vlispcompile`st"c:/programfiles/AutoCAD/Sample/
yinyang.lsp")
Theoutputfilefromthiscommandisnamedyinyang.fasandresidesinthesame
directoryastheinputfile.
SeeAlso
TheCompilingaProgramfromaFiletopicintheVisualLISPDeveloper'sGuide.

vlracdbreactor
Constructsareactorobjectthatnotifieswhenanobjectisaddedto,modified

in,orerasedfromadrawingdatabase
Thevlracdbreactorfunctionconstructsadatabasereactorobject.
(vlracdbreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwithareactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheDatabaseReactorEvents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
objThedatabaseobject(AutoLISPentity)associatedwiththeevent
+++
|Databasereactorevents|
+++
|Name|Event|
+++
|:vlrobjectAppended|Anobjecthasbeenappendedtothedrawing|
||database.|
+++
|:vlrobjectUnAppended|Anobjecthasbeendetachedfromthedrawing|
||database,e.g.,byusingUNDO.|
+++
|:vlrobjectReAppended|Adetachedobjecthasbeenrestoredinthe|
||drawingdatabase,e.g.,byusingREDO.|
+++
|:vlrobjectOpenedForModify|Anobjectisabouttobechanged.|
+++
|:vlrobjectModified|Anobjecthasbeenchanged.|
+++
|:vlrobjectErased|Anobjecthasbeenflaggedasbeingerased.|
+++
|:vlrobjectUnErased|Anobject'serasedflaghasbeenremoved.|
+++

vlradd
Enablesadisabledreactorobject
(vlraddobj)

Arguments
obj
AVLRobjectrepresentingthereactortobeenabled.

ReturnValues
Theobjargument.
SeeAlso
Thevlraddedpandvlrremovefunctions.

vlraddedp
Teststodetermineifareactorobjectisenabled
(vlraddedpobj)

Arguments
obj
AVLRobjectrepresentingthereactortobetested.

ReturnValues
Tifthespecifiedreactorisenabled,ornilifthereactorisdisabled.
SeeAlso
Thevlraddfunction.

vlrbeepreaction
Producesabeepsound
(vlrbeepreaction[args])

Arguments
Thisisapredefinedcallbackfunctionthatacceptsavariablenumberof
arguments,dependingonthereactortype.Thefunctioncanbeassignedtoan
eventhandlerfordebugging.

vlrcommandreactor
Constructsaneditorreactorthatnotifiesofacommandevent
(vlrcommandreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata
istobeassociatedwiththereactor.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheCommandReactorEvents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistcontainingasingleelement,thestringidentifyingthecommand.

ReturnValues
Thereactor_objectargument.
+++
|Commandreactorevents|
+++
|Eventname|Description|
+++
|:vlrunknownCommand|AcommandnotknowntoAutoCADwasissued.|
+++
|:vlrcommandWillStart|AnAutoCADcommandhasbeencalled.|
+++
|:vlrcommandEnded|AnAutoCADcommandhascompleted.|
+++
|:vlrcommandCancelled|AnAutoCADcommandhasbeencanceled.|
+++
|:vlrcommandFailed|AnAutoCADcommandfailedtocomplete.|
+++

vlrcurrentreactionname
Returnsthename(symbol)ofthecurrentevent,ifcalledfromwithina
reactor'scallback
(vlrcurrentreactionname)

ReturnValues
Asymbolindicatingtheeventthattriggeredthereactor.

vlrdata
Returnsapplicationspecificdataassociatedwithareactor
(vlrdataobj)

Arguments
obj
AVLRobjectrepresentingthereactorobjectfromwhichtoextractdata.

ReturnValues
Theapplicationspecificdataobtainedfromthereactorobject.

Examples
ThefollowingexampleobtainsastringassociatedwiththecircleReactorVLR
object:
_$(vlrdatacircleReactor)
"CircleReactor"

vlrdataset
Overwritesapplicationspecificdataassociatedwithareactor
(vlrdatasetobjdata)

Note:Thevlrdatasetfunctionshouldbeusedwithcaretoavoidcreationof
circularstructures.

Arguments
obj
AVLRobjectrepresentingthereactorobjectwhosedataistobeoverwritten.
data
AnyAutoLISPdata.

ReturnValues
Thedataargument.

Examples
Returntheapplicationspecificdatavalueattachedtoareactor:
_$(vlrdatacircleReactor)
"CircleReactor"

Replacesthetextstringusedtoidentifythereactor:
_$(vlrdatasetcircleReactor"CircleAreaReactor")
"CircleAreaReactor"
Verifythechange:
_$(vlrdatacircleReactor)
"CircleAreaReactor"

vlrdeepclonereactor
Constructsaneditorreactorobjectthatnotifiesofadeepcloneevent
(vlrdeepclonereactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheDeepClonereactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableDeepClone
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|DeepClonereactorevents|
+++
|Eventname|Description|
+++
|:vlrbeginDeepClone|Adeepcloneoperationisbeginning.|
+++
|:vlrbeginDeepCloneXlation|Adeepcloneoperationhastwostages.First,|
||eachobjectandanyownedobjectsarecloned.|
||Second,anyobjectIDreferencesare|
||translatedtotheirclonedIDs.Thiscallback|
||occursbetweenthesetwostages.|
+++
|:vlrabortDeepClone|Adeepcloneoperationisaborting.|
+++
|:vlrendDeepClone|Adeepcloneoperationisending.|
+++
++++
|DeepClonereactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrbeginDeepClone|0||
|:vlrabortDeepClone|||
|:vlrendDeepClone|||
++++
|:vlrbeginDeepCloneXlation|1|Anintegercontainingthe|
|||returnerrorstatusif|
|||thisvalueindicatesan|
|||error,thedeepclone|
|||operationisterminated.|
++++

vlrdocmanagerreactor
Constructsareactorobjectthatnotifiesofeventsrelatingto
drawingdocuments
(vlrdocmanagerreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheDocManagerreactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableDocManager
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|DocManagerreactorevents|
+++
|Eventname|Description|
+++
|:vlrdocumentCreated|Anewdocumentwascreatedfora|
||drawing(neworopen).Usefulfor|
||updatingyourperdocumentstructures.|
+++
|:vlrdocumentToBeDestroyed|Adocumentwillbedestroyed.|
+++
|:vlrdocumentLockModeWillChange|Acommandisabouttostartorfinish|
||modifyingelementsinthedocument,and|
||isobtainingorreleasingalockonthe|
||document.|
+++
|:vlrdocumentLockModeChangeVetoed|Areactorinvokedvetoonitselffroma|
||:vlrdocumentLockModeChangedcallback.|
+++
|:vlrdocumentLockModeChanged|Thelockonthedocumenthasbeen|
||obtainedorreleased.|
+++
|:vlrdocumentBecameCurrent|Thecurrentdocumenthasbeenchanged.|
||Thisdoesnotnecessarilyimplythat|
||thedocumenthasbeenactivated,|
||becausechangingthecurrentdocument|
||isnecessaryforsomeoperations.To|
||obtainuserinput,thedocumentmustbe|
||activatedaswell.|
+++
|:vlrdocumentToBeActivated|Acurrentlyinactivedocumenthasjust|
||receivedtheactivatesignal,implying|
||thatitisabouttobecomethecurrent|
||document.|
+++
|:vlrdocumentToBeDeactivated|Anotherwindow(insideoroutsideof|
||AutoCAD)hasbeenactivated.|
+++
++++
|DocManagerreactorcallbackdata|
++++
|Name|List|Parameters|
||length||
++++
|:vlrdocumentCreated|1|Theaffecteddocument|
|:vlrdocumentToBeDestroyed||object(VLAobject).|
|:vlrdocumentBecameCurrent|||
|:vlrdocumentToBeActivated|||

|:vlrdocumentToBeDeactivated|||
++++
|:vlrdocumentLockModeChangeVetoed|2|Firstparameteristhe|
|||affecteddocumentobject|
|||(VLAobject).Second|
|||parameteristheglobal|
|||commandstringpassedin|
|||forthelockrequest.If|
|||thecallbackisbeingmade|
|||onbehalfofanunlock|
|||request,thestringwillbe|
|||prefixedwith"#".|
++++
|:vlrdocumentLockModeWillChange|5|Firstparameteristhe|
|:vlrdocumentLockModeChanged||affecteddocumentobject|
|||(VLAobject).Second|
|||parameterisaninteger|
|||indicatingthelock|
|||currentlyineffectforthe|
|||documentobject.Third|
|||parameterisaninteger|
|||indicatingthelockmode|
|||thatwillbeineffect|
|||afterthelockis|
|||applied.Fourthparameteris|
|||thestrongestlockmode|
|||fromallotherexecution|
|||contexts.Fifthparameteris|
|||theglobalcommandstring|
|||passedinforthelock|
|||request.Ifthecallbackis|
|||beingmadeonbehalfofan|
|||unlockrequest,thestring|
|||willbeprefixedwith|
|||"#".Lockmodesmaybeany|
|||ofthefollowing:1Auto|
|||WriteLock2Not|
|||Locked4Shared|
|||Write8Read10Exclusive|
|||Write|
++++

vlrdwgreactor
Constructsaneditorreactorobjectthatnotifiesofadrawingevent(for
example,openingorclosingadrawingfile)
(vlrdwgreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheDWGreactoreventstable
below,andcallback_functionisasymbolrepresentingafunctiontobecalled
whentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableDWGreactor
callbackdata.

ReturnValues
Thereactor_objectargument.
+++
|DWGreactorevents|
+++
|Eventname|Description|
+++

|:vlrbeginClose|Thedrawingdatabaseistobeclosed.|
+++
|:vlrdatabaseConstructed|Adrawingdatabasehasbeenconstructed.|
+++
|:vlrdatabaseToBeDestroyed|Thecontentsofthedrawingdatabaseisabout|
||tobedeletedfrommemory.|
+++
|vlrbeginDwgOpen|AutoCADisabouttoopenadrawingfile.|
+++
|:vlrendDwgOpen|AutoCADhasendedtheopenoperation.|
+++
|:vlrdwgFileOpened|AnewdrawinghasbeenloadedintotheAutoCAD|
||drawingwindow.|
+++
|vlrbeginSave|AutoCADisabouttosavethedrawingfile.|
+++
|vlrsaveComplete|AutoCADhassavedthecurrentdrawingtodisk.|
+++
++++
|DWGreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrbeginClose|0||
|:vlrdatabaseConstructed|||
|:vlrdatabaseToBeDestroyed|||
++++
|:vlrbeginDwgOpen|1|Astringidentifyingthefileto|
|:vlrendDwgOpen||open.|
|:vlrdwgFileOpened|||
++++
|:vlrbeginSave|1|Astringcontainingthedefault|
|||filenameforsavemaybe|
|||changedbytheuser|
++++
|:vlrsaveComplete|1|Astringcontainingtheactual|
|||filenameusedforthesave.|
++++

vlrdxfreactor
Constructsaneditorreactorobjectthatnotifiesofaneventrelatedto
readingorwritingaDXFfile
(vlrdxfreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheDXFreactoreventstable
below,andcallback_functionisasymbolrepresentingafunctiontobecalled
whentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableDXFreactor
callbackdata.

ReturnValues
Thereactor_objectargument.
+++
|DXFreactorevents|
+++
|Eventname|Description|
+++
|:vlrbeginDxfIn|ThecontentsofaDXFfileistobeappendedtothe|
||drawingdatabase.|
+++

|:vlrabortDxfIn|TheDXFimportwasnotsuccessful.|
+++
|:vlrdxfInComplete|TheDXFimportwassuccessful.|
+++
|:vlrbeginDxfOut|AutoCADisabouttoexportthedrawingdatabaseinto|
||aDXFfile.|
+++
|:vlrabortDxfOut|TheDXFexportoperationfailed.|
+++
|:vlrdxfOutComplete|TheDXFexportoperationwassuccessful.|
+++
++++
|DXFreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrbeginDxfIn|0||
|:vlrabortDxfIn|||
|:vlrdxfInComplete,|||
|:vlrbeginDxfOut|||
|:vlrabortDxfOut|||
|:vlrdxfOutComplete|||
++++

vlreditorreactor
Constructsaneditorreactorobject
(vlreditorreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheEditorreactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableEditor
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Editorreactorevents|
+++
|Eventname|Description|
+++
|:vlrbeginClose|Thedrawingdatabaseistobeclosed.|
+++
|:vlrbeginDxfIn|ThecontentsofaDXFfileistobeappended|
||tothedrawingdatabase.|
+++
|:vlrabortDxfIn|TheDXFimportwasnotsuccessful.|
+++
|:vlrdxfInComplete|TheDXFimportcompletedsuccessfully.|
+++
|:vlrbeginDxfOut|AutoCADisabouttoexportthedrawing|
||databaseintoaDXFfile.|
+++
|:vlrabortDxfOut|DXFexportoperationfailed.|
+++
|:vlrdxfOutComplete|DXFexportoperationcompletedsuccessfully.|
+++
|:vlrdatabaseToBeDestroyed|Thecontentsofthedrawingdatabaseisabout|
||tobedeletedfrommemory.|
+++

|:vlrunknownCommand|AcommandnotknowntoAutoCADwasissued.|
+++
|:vlrcommandWillStart|AnAutoCADcommandhasbeencalled.|
+++
|vlrcommandEnded|AnAutoCADcommandhascompleted.|
+++
|:vlrcommandCancelled|AnAutoCADcommandhasbeencanceled.|
+++
|:vlrcommandFailed|AnAutoCADcommandfailedtocomplete.|
+++
|:vlrlispWillStart|AnAutoLISPexpressionistobeevaluated.|
+++
|:vlrlispEnded|EvaluationofanAutoLISPexpressionhas|
||completed.|
+++
|:vlrlispCancelled|EvaluationofanAutoLISPexpressionhasbeen|
||canceled.|
+++
|:vlrbeginDwgOpen|AutoCADisabouttoopenadrawingfile.|
+++
|:vlrendDwgOpen|AutoCADhasendedtheopenoperation.|
+++
|:vlrdwgFileOpened|AnewdrawinghasbeenloadedintotheAutoCAD|
||drawingwindow.|
+++
|:vlrbeginSave|AutoCADisabouttosavethedrawingfile.|
+++
|:vlrsaveComplete|AutoCADhassavedthecurrentdrawingtodisk.|
+++
|:vlrsysVarWillChange|AutoCADisabouttochangethevalueofa|
||systemvariable.|
+++
|:vlrsysVarChanged|Thevalueofasystemvariablehaschanged.|
+++
++++
|Editorreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrlispEnded|0||
|:vlrlispCancelled|||
|:vlrbeginClose|||
|:vlrbeginDxfIn|||
|:vlrabortDxfIn|||
|:vlrdxfInComplete|||
|:vlrbeginDxfOut|||
|:vlrabortDxfOut|||
|:vlrdxfOutComplete|||
|:vlrdatabaseToBeDestroyed|||
++++
|:vlrunknownCommand|1|Astringcontainingthe|
|:vlrcommandWillStart||commandname.|
|:vlrcommandEnded|||
|:vlrcommandCancelled|||
|:vlrcommandFailed|||
++++
|:vlrlispWillStart|1|Astringcontainingthefirst|
|||lineoftheAutoLISP|
|||expressiontoevaluate.|
++++
|:vlrbeginDwgOpen|1|Astringidentifyingthefile|
|:vlrendDwgOpen||toopen.|
|:vlrdwgFileOpened|||
++++
|:vlrbeginSave|1|Astringcontainingthe|
|||defaultfilenameforsave|
|||thismaybechangedbythe|
|||user.|
++++
|:vlrsaveComplete|1|Astringidentifyingthe|
|||actualfilenameusedforthe|
|||save.|
++++
|:vlrsysVarWillChange|1|Astringnamingthesystem|
|||variable.|
++++
|:vlrsysVarChanged|2|Firstparameterisastring|
|||namingthesystem|
|||variable.Secondparameteris|
|||anintegerindicatingwhether|
|||thechangewassuccessful(1=|
|||success,0=failed).|
++++

vlrinsertreactor
Constructsaneditorreactorobjectthatnotifiesofaneventrelatedtoblock
insertion
(vlrinsertreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheInsertreactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableInsert
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Insertreactorevents|
+++
|Eventname|Description|
+++
|:vlrbeginInsert|Ablockisabouttobeinsertedintothedrawing|
||database.|
+++
|:vlrbeginInsertM|A3Dtransformationmatrixisabouttobeinserted|
||intothedrawingdatabase.|
+++
|:vlrotherInsert|Ablockormatrixhasbeenaddedtothedrawing|
||database.Thisnotificationissentafterthe|
||insertprocesscompletescopyingtheobjectinto|
||thedatabase,butbeforeIDtranslationorentity|
||transformationoccurs.|
+++
|:vlrendInsert|Usuallyindicatesaninsertoperationonthe|
||drawingdatabaseiscomplete.However,insome|
||cases,thetransformhasnotyethappened,orthe|
||blockthatwascreatedhasnotyetbeenappended.|
||Thismeanstheobjectscopiedarenotyet|
||graphical,andyoucannotusetheminselection|
||setsuntilthe:vlrcommandEndednotificationis|
||received.|
+++
|:vlrabortInsert|Insertoperationwasterminatedanddidnot|
||complete,leavingthedatabaseinanunstablestate.|
+++
++++
|Insertreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrbeginInsert|3|Firstparameterisa|
|||VLAobjectpointingtothe|
|||databaseinwhichtheblockis|
|||beinginserted.Second|
|||parameterisastringnaming|
|||theblocktobeinserted.Third|
|||parameterisaVLAobject|
|||identifyingthesource|
|||databaseoftheblock.|
++++
|:vlrbeginInsertM|3|Firstparameterisa|
|||VLAobjectpointingtothe|
|||databaseinwhichthe3D|
|||transformationmatrixisbeing|

|||inserted.Secondparameteris|
|||the3Dtransformationmatrix|
|||tobeinserted.Thirdparameter|
|||isaVLAobjectidentifying|
|||thesourcedatabaseofthe|
|||matrix.|
++++
|:vlrotherInsert|2|Firstparameterisa|
|||VLAobjectpointingtothe|
|||databaseinwhichtheblockor|
|||matrixisbeing|
|||inserted.Secondparameterisa|
|||VLAobjectidentifyingthe|
|||sourcedatabaseoftheblock|
|||ormatrix.|
++++
|:vlrendInsert|1|VLAobjectpointingtotarget|
|:vlrabortInsert||database.|
++++

vlrlinkerreactor
Constructsareactorobjectthatnotifiesyourapplicationeverytimean
ObjectARXapplicationisloadedorunloaded
(vlrlinkerreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedinthetableLinkerreactor
events,andcallback_functionisasymbolrepresentingafunctiontobecalled
whentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistcontainingthenameoftheObjectARXprogramthatwasloadedor
unloaded(astring).

ReturnValues
Thereactor_objectargument.
+++
|Linkerreactorevents|
+++
|Name|Event|
+++
|:vlrrxAppLoaded|ThedynamiclinkerhasloadedanewObjectARX|
||program.Theprogramhasfinishedits|
||initialization.|
+++
|:vlrrxAppUnLoaded|ThedynamiclinkerhasunloadedanObjectARX|
||program.Theprogramalreadyhasdoneitscleanup.|
+++

Examples

_$(vlrlinkerreactornil
'((:vlrrxAppLoaded.myvlrtracereaction)))
#<VLRLinkerReactor>

vlrlispreactor

ConstructsaneditorreactorobjectthatnotifiesofaLISPevent
(vlrlispreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheLispreactoreventstable
below,andcallback_functionisasymbolrepresentingafunctiontobecalled
whentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableLispreactor
callbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Lispreactorevents|
+++
|Eventname|Description|
+++
|:vlrlispWillStart|AnAutoLISPexpressionistobeevaluated.|
+++
|:vlrlispEnded|EvaluationofanAutoLISPexpressionhascompleted.|
+++
|:vlrlispCancelled|EvaluationofanAutoLISPexpressionhasbeen|
||canceled.|
+++
++++
|Lispreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrlispEnded|0||
|:vlrlispCancelled|||
++++
|:vlrlispWillStart|1|Astringcontainingthefirst|
|||lineoftheAutoLISPexpression|
|||toevaluate.|
++++

vlrmiscellaneousreactor
Constructsaneditorreactorobjectthatdoesnotfallunderanyothereditor
reactortypes
(vlrmiscellaneousreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheMiscellaneousreactor
eventstablebelow,andcallback_functionisasymbolrepresentingafunction
tobecalledwhentheeventfires.Eachcallbackfunctionacceptstwo
arguments:

reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableMiscellaneous
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Miscellaneousreactorevents|
+++
|Eventname|Description|
+++
|:vlrpickfirstModified|Thepickfirstselectionsetofthecurrent|
||documenthasbeenmodified.|
+++
|:vlrlayoutSwitched|Thelayoutwasswitched.|
+++
++++
|Miscellaneousreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrpickfirstModified|0||
++++
|:vlrlayoutSwitched|1|Astringnamingthe|
|||layoutswitchedto.|
++++

vlrmousereactor
Constructsaneditorreactorobjectthatnotifiesofamouseevent(for
example,adoubleclick)
(vlrmousereactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheMousereactoreventstable
below,andcallback_functionisasymbolrepresentingafunctiontobecalled
whentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableMousereactor
callbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Mousereactorevents|
+++
|Eventname|Description|
+++
|:vlrbeginDoubleClick|Theuserhasdoubleclicked.|
+++
|:vlrbeginRightClick|Theuserhasrightclicked.|
+++
++++
|Mousereactorcallbackdata|
++++
|Name|Listlength|Parameters|

++++
|:vlrbeginDoubleClick|1|A3Dpointlist(listof3|
|:vlrbeginRightClick||reals)showingthepoint|
|||clickedon,inWCS.|
++++

vlrnotification
Determineswhetherornotareactorwillfireifitsassociatednamespaceis
notactive
(vlrnotificationreactor)

Arguments
reactor
AVLRobject.

ReturnValues
Asymbol,whichcanbeeither'alldocuments(thereactorfireswhetherornot
itsassociateddocumentisactive),or'activedocumentonly(thereactorfires
onlyifitsassociateddocumentisactive).

vlrobjectreactor
Constructsanobjectreactorobject
(vlrobjectreactorownersdatacallbacks)
Thereactorobjectisaddedtothedrawingdatabase,butdoesnotbecome
persistent.

Arguments
owners
AnAutoLISPlistofVLAobjectsidentifyingthedrawingobjectstobewatched.
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedinthetableObjectevents,and
callback_functionisasymbolrepresentingafunctiontobecalledwhenthe
eventfires.Eachcallbackfunctionacceptsthreearguments:
ownerTheowneroftheVLAobjecttheeventappliesto.
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableObjectevents
callbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Objectevents|
+++
|Name|Event|
+++
|:vlrcancelled|Themodificationoftheobjecthasbeencanceled.|
+++
|:vlrcopied|Theobjecthasbeencopied.|

+++
|:vlrerased|Eraseflagoftheobjecthasbeenset.|
+++
|:vlrunerased|Eraseflagoftheobjecthasbeenreset.|
+++
|:vlrgoodbye|Theobjectisabouttobedeletedfrommemory.|
+++
|:vlropenedForModify|Theobjectisabouttobemodified.|
+++
|:vlrmodified|Theobjecthasbeenmodified.Ifthemodification|
||wascanceled,also:vlrcancelledand|
||:vlrmodifyUndonewillbefired.|
+++
|:vlrsubObjModified|Asubentityoftheobjecthasbeenmodified.This|
||eventistriggeredformodificationstoverticesof|
||polylinesormeshes,andforattributesownedby|
||blockReferences.|
+++
|:vlrmodifyUndone|Theobject'smodificationwasundone.|
+++
|:vlrmodifiedXData|Theobject'sextendedentitydatahavebeenmodified.|
+++
|:vlrunappended|Theobjecthasbeendetachedfromthedrawing|
||database.|
+++
|:vlrreappended|Theobjecthasbeenreattachedtothedrawing|
||database.|
+++
|:vlrobjectClosed|Theobject'smodificationhasbeenfinished.|
+++
++++
|Objecteventscallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrcancelled|0||
|:vlrerased,|||
|:vlrunerased|||
|:vlrgoodbye|||
|:vlropenedForModify|||
|:vlrmodified|||
|:vlrmodifyUndone|||
|:vlrmodifiedXData|||
|:vlrunappended|||
|:vlrreappended|||
|:vlrobjectClosed|||
++++
|:vlrcopied|1|Theobjectcreatedbythecopy|
|||operation(ename).|
++++
|:vlrsubObjModified|1|Thesubobject(ename)thathas|
|||beenmodified.|
++++

Examples

ThefollowingcodeattachesanobjectreactortothemyCircleobject.It
definesthereactortorespondwhenevertheobjectismodified(:vlrmodified)
andtocalltheprintradiusfunctioninresponsetothemodificationevent:
(setqcircleReactor(vlrobjectreactor(listmyCircle)
"CircleReactor"'((:vlrmodified.printradius))))

vlrowneradd
Addsanobjecttothelistofownersofanobjectreactor
(vlrowneraddreactorowner)
Thisfunctionaddsanewsourceofreactoreventsthereactorwillreceive
eventsfromthespecifiedobject.

Arguments
reactor
AVLRobject.
owner

AVLAobjecttobeaddedtothelistofnotifiersforthisreactor.

ReturnValues
TheVLAobjecttowhichthereactorhasbeenadded.

Examples
Inthefollowingexample,anarcobjectnamed"archie"isaddedtotheowner
listofreactorcircleReactor:
_$(vlrowneraddcircleReactorarchie)
#<VLAOBJECTIAcadArc03ad0bcc>
SeeAlso
Thevlrownerremovefunction.

vlrownerremove
Removesanobjectfromthelistofownersofanobjectreactor
(vlrownerremovereactorowner)

Arguments
reactor
AVLRobject.
owner
AVLAobjecttoberemovedfromthelistofnotifiersforthisreactor.

ReturnValues
TheVLAobjectfromwhichthereactorwasremoved.

Examples
_$(vlrownerremovecircleReactorarchie)
#<VLAOBJECTIAcadArc03ad0bcc>
SeeAlso
Thevlrowneraddfunction.

vlrowners
Returnsthelistofownersofanobjectreactor
(vlrownersreactor)

Arguments
reactor
AVLRobject.

ReturnValues
Alistofobjectsthatnotifythespecifiedreactor.

Examples
_$(vlrownerscircleReactor)
(#<VLAOBJECTIAcadCircle01db98f4>#<VLAOBJECTIAcadCircle
01db9724>#<VLAOBJECTIAcadCircle01db93d4>#<VLAOBJECT
IAcadCircle01db9084>)

vlrpers
Makesareactorpersistent
(vlrpersreactor)

Arguments
reactor
AVLRobject.

ReturnValues
Thespecifiedreactorobject,ifsuccessful,nilotherwise.

Examples
Defineareactor:
_$(setqcircleReactor(vlrobjectreactor
(listmyCircle)"Radiussize"'((:vlrmodified.printradius))))
#<VLRObjectReactor>
Makethereactorpersistent:
_$(vlrperscircleReactor)
#<VLRObjectReactor>

vlrperslist
Returnsalistofpersistentreactorsinthecurrentdrawingdocument
(vlrperslist[reactor])

Arguments
reactor
Thereactorobjecttobelisted.Ifreactorisnotspecified,vlrperslist
listsallpersistentreactors.

ReturnValues
Alistofreactorobjects.

Examples
_$(vlrperslist)
(#<VLRObjectReactor>#<VLRObjectReactor>
(#<VLRObjectReactor>)

vlrpersp
Determineswhetherornotareactorispersistent
(vlrperspreactor)

Arguments
reactor

AVLRobject.

ReturnValues
Thespecifiedreactorobject,ifitispersistentnil,ifthereactoris
transient.

Examples
Makeareactorpersistent:
_$(vlrperscircleReactor)
#<VLRObjectReactor>
Verifythatareactorispersistent:
_$(vlrperspcircleReactor)
#<VLRObjectReactor>
Changethepersistentreactortotransient:
_$(vlrpersreleasecircleReactor)
#<VLRObjectReactor>
Verifythatthereactorisnolongerpersistent:
_$(vlrperspcircleReactor)
nil

vlrpersrelease
Makesareactortransient
(vlrpersreleasereactor)

Arguments
reactor
VLRobject.

ReturnValues
Thespecifiedreactorobject,ifsuccessful,nilotherwise.

vlrreactionname
Returnsalistofallpossiblecallbackconditionsforthisreactortype
(vlrreactionnamesreactortype)

Arguments
reactortype
Oneofthefollowingsymbols:
:VLRAcDbReactor
:VLRCommandReactor
:VLRDeepCloneReactor
:VLRDocManagerReactor
:VLRDWGReactor
:VLRDXFReactor
:VLREditorReactor
:VLRInsertReactor
:VLRLinkerReactor
:VLRLispReactor
:VLRMiscellaneousReactor
:VLRMouseReactor

:VLRObjectReactor
:VLRSysVarReactor
:VLRToolbarReactor
:VLRUndoReactor
:VLRWblockReactor
:VLRWindowReactor
:VLRXREFReactor

ReturnValues
Alistofsymbolsindicatingthepossibleeventsforthespecifiedreactor
type.

Examples
_$(vlrreactionnames:VLREditorReactor)
(:vlrunknownCommand:vlrcommandWillStart:vlrcommandEnded....

vlrreactionset
Addsorreplacesacallbackfunctioninareactor
(vlrreactionsetreactoreventfunction)

Arguments
reactor
AVLRobject.
event
Asymboldenotingoneoftheeventtypesavailableforthisreactortype.
function
AsymbolrepresentingtheAutoLISPfunctiontobeaddedorreplaced.

ReturnValues
Unspecified.

Examples
ThefollowingcommandchangesthecircleReactorreactortocalltheprintarea
functionwhenanobjectismodified:
_$(vlrreactionsetcircleReactor:vlrmodified'printarea)
PRINTAREA

vlrreactions
Returnsalistofpairs(eventname.callback_function)forthereactor
(vlrreactionsreactor)

Arguments
reactor
AVLRobject.

Examples
_$(vlrreactionscircleReactor)
((:vlrmodified.PRINTRADIUS))

vlrreactors
Returnsalistofexistingreactors
(vlrreactors[reactortype...])

Arguments
reactortype
Oneormoreofthefollowingsymbols:
:VLRAcDbReactor
:VLRCommandReactor
:VLRDeepCloneReactor
:VLRDocManagerReactor
:VLRDWGReactor
:VLRDXFReactor
:VLREditorReactor
:VLRInsertReactor
:VLRLinkerReactor
:VLRLispReactor
:VLRMiscellaneousReactor
:VLRMouseReactor
:VLRObjectReactor
:VLRSysVarReactor
:VLRToolbarReactor
:VLRUndoReactor
:VLRWblockReactor
:VLRWindowReactor
:VLRXREFReactor
Ifyouspecifyreactortypearguments,vlrreactorsreturnslistsofthe
reactortypesyouspecified.Ifyouomitreactortype,vlrreactorsreturnsall
existingreactors.

ReturnValues
Alistofreactorlists,ornil,iftherearenoreactorsofanyspecified
type.Eachreactorlistbeginswithasymbolidentifyingthereactortype,
followedbypointerstoeachreactorofthattype.

Examples
Listallreactorsinadrawing:
_$(vlrreactors)
((:VLRObjectReactor#<VLRObjectReactor>)(:VLREditorReactor
#<VLREditorReactor>))
Listallobjectreactors:
_$(vlrreactors:vlrobjectreactor)
((:VLRObjectReactor#<VLRObjectReactor>))
vlrreactorsreturnsalistcontainingasinglereactorlist.
Listalldatabasereactors:
_$(vlrreactors:vlracdbreactor)
nil
Therearenodatabasereactorsdefined.
ListallDWGreactors:
_$(vlrreactors:vlrdwgreactor)
((:VLRDWGReactor#<VLRDWGReactor>#<VLRDWGReactor>))
vlrreactorsreturnsalistcontainingalistofDWGreactors.

vlrremove

Disablesareactor
(vlrremovereactor)

Arguments
reactor
AVLRobject.

ReturnValues
Thereactorargument,ornil,ifunsuccessful.

Examples
ThefollowingcommanddisablesthecircleReactorreactor:
_$(vlrremovecircleReactor)
#<VLRObjectreactor>
SeeAlso
Thevlrremoveallfunction.

vlrremoveall
Disablesallreactorsofthespecifiedtype
(vlrremoveall[reactortype])

Arguments
reactortype
Oneofthefollowingsymbols:
:VLRAcDbReactor
:VLRCommandReactor
:VLRDeepCloneReactor
:VLRDocManagerReactor
:VLRDWGReactor
:VLRDXFReactor
:VLREditorReactor
:VLRInsertReactor
:VLRLinkerReactor
:VLRLispReactor
:VLRMiscellaneousReactor
:VLRMouseReactor
:VLRObjectReactor
:VLRSysVarReactor
:VLRToolbarReactor
:VLRUndoReactor
:VLRWblockReactor
:VLRWindowReactor
:VLRXREFReactor
Ifnoreactortypeisspecified,vlrremovealldisablesallreactors.

ReturnValues
Alistoflists.Thefirstelementofeachlistidentifiesthetypeofreactor,
andtheremainingelementsidentifythedisabledreactorobjects.Thefunction
returnsniliftherearenoreactorsactive.

Examples
Thefollowingfunctioncalldisablesalleditorreactors:
_$(vlrremoveall:vlreditorreactor)
((:VLREditorReactor#<VLREditorReactor>))
Thefollowingcalldisablesallreactors:
_$(vlrremoveall)

((:VLRObjectReactor#<VLRObjectReactor>#<VLRObjectReactor>
#<VLRObjectReactor>)(:VLREditorReactor#<VLREditorReactor>))
SeeAlso
Thevlrremovefunction.

vlrsetnotification
Defineswhetherornotareactor'scallbackfunctionwillexecuteifits
associatednamespaceisnotactive
(vlrsetnotificationreactor'range)

Arguments
reactor
AVLRobject.
'range
Therangeargumentisasymbolthatcanbeeither'alldocuments(executethe
callbackwhetherornotthereactorisassociatedwiththeactivedocument),or
'activedocumentonly(executethecallbackonlyifthereactorisassociated
withtheactivedocument).

ReturnValues
TheVLRobject.

Examples
Setareactortoexecuteitscallbackfunctionevenifitsassociatednamespace
isnotactive:
_$(vlrsetnotificationcircleReactor'alldocuments)
#<VLRObjectReactor>

vlrsysvarreactor
Constructsaneditorreactorobjectthatnotifiesofachangetoasystem
variable
(vlrsysvarreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheSysVarreactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableSysVar
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.

+++
|SysVarreactorevents|
+++
|Eventname|Description|
+++
|:vlrsysVarWillChange|AutoCADisabouttochangethevalueofasystem|
||variable.|
+++
|:vlrsysVarChanged|Thevalueofasystemvariablehaschanged.|
+++
++++
|SysVarreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrsysVarWillChange|1|Astringidentifyingthe|
|||systemvariablename.|
++++
|:vlrsysVarChanged|2|Firstparameterisastring|
|||identifyingthesystem|
|||variablename.Secondparameter|
|||issymbolindicatingwhether|
|||ornotthechangewas|
|||successful(Tifsuccessful,|
|||nilifnot).|
++++

vlrtoolbarreactor
Constructsaneditorreactorobjectthatnotifiesofachangetothebitmapsin
atoolbar
(vlrtoolbarreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheToolbarreactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableToolbar
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Toolbarreactorevents|
+++
|Eventname|Description|
+++
|:vlrtoolbarBitmapSizeWillChange|ThesizeoftheAutoCADtoolbariconsis|
||abouttochange.|
+++
|:vlrtoolbarBitmapSizeChanged|ThesizeoftheAutoCADtoolbaricons|
||haschanged.|
+++
++++
|Toolbarreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrtoolbarBitmapSizeWillChange|1|T,ifthetoolbarisbeing|
|:vlrtoolbarBitmapSizeChanged||settolargebitmaps,nil|
|||ifthetoolbarisbeing|

|||settosmallbitmaps.|
++++

vlrtracereaction
Apredefinedcallbackfunctionthatprintsoneormorecallbackargumentsin
theTracewindow
(vlrtracereaction)
Thisfunctioncanbeusedasadebuggingtooltoverifythatareactorhas
fired.

Examples
Defineacommandreactorandassignvlrtracereactionasthecallback
function:
_$(VLRReactionSet(VLRCommandReactor):VLRcommandWillStart
'VLRtracereaction)
VLRtracereaction
AttheAutoCADCommandprompt,enterthefollowing:
_.LINE
Respondtothecommandprompts,thenactivatetheVLISPwindowandopenthe
Tracewindow.YoushouldseethefollowingintheTracewindow:
"Reaction"::VLRcommandWillStart"argumentlist":
(#<VLRCOMMANDREACTOR>("LINE"))
Theoutputfromvlrtracereactionidentifiesthetypeoftriggerevent,the
reactortype,andthecommandthattriggeredthereactor.

vlrtype
Returnsasymbolrepresentingthereactortype
(vlrtypereactor)

Arguments
reactor
AVLRobject.

ReturnValues
Asymbolidentifyingthereactortype.Thefollowingtableliststhetypesthat
maybereturnedbyvlrtype:
+++
|Reactortypes|
+++
|Reactortype|Description|
+++
|:VLRAcDbReactor|Databasereactor.|
+++
|:VLRCommandReactor|Aneditorreactornotifyingofacommandevent.|
+++
|:VLRDeepCloneReactor|Aneditorreactornotifyingofadeepclone|
||event.|
+++
|:VLRDocManagerReactor|Documentmanagementreactor.|
+++
|:VLRDWGReactor|Aneditorreactornotifyingofadrawingevent|
||(forexample,openingorclosingadrawing|
||file).|
+++
|:VLRDXFReactor|Aneditorreactornotifyingofanevent|
||relatedtoreadingorwritingofaDXFfile.|
+++

|:VLREditorReactor|Generaleditorreactormaintainedfor|
||backwardcompatibility.|
+++
|:VLRInsertReactor|Aneditorreactornotifyingofanevent|
||relatedtoblockinsertion.|
+++
|:VLRLinkerReactor|Linkerreactor.|
+++
|:VLRLispReactor|AneditorreactornotifyingofaLISPevent.|
+++
|:VLRMiscellaneousReactor|Aneditorreactorthatdoesnotfallunderany|
||oftheothereditorreactortypes.|
+++
|:VLRMouseReactor|Aneditorreactornotifyingofamouseevent|
||(forexample,adoubleclick).|
+++
|:VLRObjectReactor|Objectreactor.|
+++
|:VLRSysVarReactor|Aneditorreactornotifyingofachangetoa|
||systemvariable.|
+++
|:VLRToolbarReactor|Aneditorreactornotifyingofachangetothe|
||bitmapsinatoolbar.|
+++
|:VLRUndoReactor|Aneditorreactornotifyingofanundoevent.|
+++
|:VLRWblockReactor|Aneditorreactornotifyingofanevent|
||relatedtowritingablock.|
+++
|:VLRWindowReactor|Aneditorreactornotifyingofanevent|
||relatedtomovingorsizinganAutoCADwindow.|
+++
|:VLRXREFReactor|Aneditorreactornotifyingofanevent|
||relatedtoattachingormodifyingXREFs.|
+++

Examples

_$(vlrtypecircleReactor)
:VLRObjectReactor

vlrtypes
Returnsalistofallreactortypes
(vlrtypes)

ReturnValues
(:VLRLinkerReactor:VLREditorReactor:VLRAcDbReactor....)

vlrundoreactor
Constructsaneditorreactorobjectthatnotifiesofanundoevent
(vlrundoreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheUndoreactoreventstable
below,andcallback_functionisasymbolrepresentingafunctiontobecalled
whentheeventfires.Eachcallbackfunctionacceptstwoarguments:

reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableUndoreactor
callbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Undoreactorevents|
+++
|Eventname|Description|
+++
|:vlrundoSubcommandAuto|TheUNDOcommand'sAutooptionhasbeen|
||executed.|
+++
|:vlrundoSubcommandControl|TheUNDOcommand'sControloptionhasbeen|
||executed.|
+++
|:vlrundoSubcommandBegin|TheUNDOcommand'sBEGINorGROUPoptionis|
||beingperformed.BEGINandGROUPmarkthe|
||beginningofaseriesofcommandsthatcanbe|
||undoneasoneunit.|
+++
|:vlrundoSubcommandEnd|TheUNDOcommand'sENDoptionisbeing|
||performed.UNDO/ENDmarkstheendofaseries|
||ofcommandsthatcanbeundoneasoneunit.|
+++
|:vlrundoSubcommandMark|TheUNDOcommand'sMARKoptionisabouttobe|
||executed.Thisplacesamarkerintheundo|
||filesoUNDO/BACKcanundobacktothemarker.|
+++
|:vlrundoSubcommandBack|TheUNDOcommand'sBACKoptionisabouttobe|
||performed.UNDO/BACKundoeseverythingbackto|
||themostrecentMARKmarkerorbacktothe|
||beginningoftheundofileifnoMARKmarker|
||exists.|
+++
|:vlrundoSubcommandNumber|TheUNDOcommand'sNUMBERoptionisaboutto|
||beexecuted(thedefaultactionoftheUNDO|
||command).|
+++
++++
|Undoreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrundoSubcommandAuto|2|Firstparameterisaninteger|
|||indicatingtheactivity.The|
|||valueisalways4,indicating|
|||thatnotificationoccurredafter|
|||theoperationwas|
|||performed.Secondparameterisa|
|||symbolindicatingthestateof|
|||Automode.ValueisTifAuto|
|||modeisturnedon,nilifAuto|
|||modeisturnedoff.|
++++
|:vlrundoSubcommandControl|2|Firstparameterisaninteger|
|||indicatingtheactivity.The|
|||valueisalways4,indicating|
|||thatnotificationoccurredafter|
|||theoperationwas|
|||performed.Secondparameterisan|
|||integerindicatingtheControl|
|||optionselected.Thiscanbeone|
|||ofthefollowing:0NONEwas|
|||selected1ONEwas|
|||selected2ALLwasselected|
++++
|:vlrundoSubcommandBegin|1|Anintegervalueof0,|
|:vlrundoSubcommandEnd||indicatingthatnotification|
|:vlrundoSubcommandMark||occursbeforetheactual|
|:vlrundoSubcommandBack||operationisperformed.|
++++
|:vlrundoSubcommandNumber|2|Firstparameterisaninteger|
|||indicatingtheactivity.The|
|||valueisalways0,indicating|
|||thatnotificationoccursbefore|
|||theactualoperationis|
|||performed.Secondparameterisan|
|||integerindicatingthenumberof|

|||stepsbeingundone.|
++++

vlrwblockreactor
Constructsaneditorreactorobjectthatnotifiesofaneventrelatedto
writingablock
(vlrwblockreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheWblockreactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableWblock
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Wblockreactorevents|
+++
|Eventname|Description|
+++
|:VLRwblockNotice|Awblockoperationisabouttostart.|
+++
|:VLRbeginWblockPt|Awblockoperationisbeingperformedonasetof|
||entities.|
+++
|:VLRbeginWblockId|Awblockoperationisbeingperformedona|
||specifiedblock.|
+++
|:VLRbeginWblock|Awblockoperationisbeingperformedonan|
||entiredatabase.Notificationdoesnotoccur|
||untilalltheentitiesinthesourcedatabase's|
||modelspacearecopiedintothetargetdatabase.|
+++
|:VLRendWblock|Awblockoperationcompletedsuccessfully.|
+++
|:VLRbeginWblockObjects|wblockhasjustinitializedtheobjectID|
||translationmap.|
+++
++++
|Wblockreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:VLRwblockNotice|1|Databaseobject(VLAobject)|
|||fromwhichtheblockwillbe|
|||created.|
++++
|:VLRbeginWblockPt|3|Firstparameteristhetarget|
|||databaseobject|
|||(VLAobject).Secondparameter|
|||isthesourcedatabaseobject|
|||(VLAobject)containingthe|
|||objectsbeingwblocked.Third|
|||parametersisa3Dpointlist|
|||(inWCS)tobeusedasthe|
|||basepointinthetarget|
|||database.|
++++
|:VLRbeginWblockId|3|Firstparameteristhetarget|

|||databaseobject|
|||(VLAobject).Secondparameter|
|||isthesourcedatabaseobject|
|||(VLAobject)containingthe|
|||objectsbeingwblocked.Third|
|||parameteristheobjectIDof|
|||theBlockTableRecordbeing|
|||wblocked.|
++++
|:VLRbeginWblock|2|Firstparameteristhetarget|
|:VLRotherWblock||databaseobject|
|||(VLAobject).Secondparameter|
|||isthesourcedatabaseobject|
|||(VLAobject)containingthe|
|||objectsbeingwblocked.|
++++
|:VLRabortWblock|1|Thetargetdatabaseobject|
|:VLRendWblock||(VLAobject).|
++++
|:VLRbeginWblockObjects|2|Firstparameteristhesource|
|||databaseobject(VLAobject)|
|||containingtheobjectsbeing|
|||wblocked.Secondparameteris|
|||anIDmap.|
++++

vlrwindowreactor
Constructsaneditorreactorobjectthatnotifiesofaneventrelatedtomoving
orsizinganAutoCADwindow
(vlrwindowreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheWindowreactorevents
tablebelow,andcallback_functionisasymbolrepresentingafunctiontobe
calledwhentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableWindow
reactorcallbackdata.

ReturnValues
Thereactor_objectargument.
+++
|Windowreactorevents|
+++
|Eventname|Description|
+++
|:vlrdocFrameMovedOrResized|AnMDIchildframewindow(adocument|
||window)hasbeenmovedorresized.|
+++
|:vlrmainFrameMovedOrResized|ThemainAutoCADwindowhasbeenmovedor|
||resized.|
+++
++++
|Windowreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:vlrdocFrameMovedOrResized|2|Thefirstparameterisan|
|:vlrmainFrameMovedOrResized||integercontainingtheHWNDof|
|||thewindow.Thesecond|
|||parameterindicateswhether|
|||thewindowhasbeenmovedor|

|||resized.ThevalueisTifthe|
|||windowhasbeenmoved,nilif|
|||thewindowhasbeenresized.|
++++

vlrxrefreactor
Constructsaneditorreactorobjectthatnotifiesofaneventrelatedto
attachingormodifyingXREFs
(vlrxrefreactordatacallbacks)

Arguments
data
AnyAutoLISPdatatobeassociatedwiththereactorobject,ornil,ifnodata.
callbacks
Alistofpairsofthefollowingform:
(eventname.callback_function)
whereeventnameisoneofthesymbolslistedintheXREFreactoreventstable
below,andcallback_functionisasymbolrepresentingafunctiontobecalled
whentheeventfires.Eachcallbackfunctionacceptstwoarguments:
reactor_objectTheVLRobjectthatcalledthecallbackfunction.
listAlistofextradataelementsassociatedwiththeparticularevent.The
contentsofthislistforparticulareventsisshowninthetableXREFreactor
callbackdata.

ReturnValues
Thereactor_objectargument.
+++
|XREFreactorevents|
+++
|Eventname|Description|
+++
|:VLRbeginAttach|AnXREFisabouttobeattached.|
+++
|:VLRotherAttach|Anexternalreferenceisbeingaddedto|
||thedrawingdatabase.Thiseventoccurs|
||afterobjectsarecloned,butbeforeany|
||translation.Thiscallbackfunctionis|
||sentjustafterbeginDeepCloneXlation|
||notification,butonlyoccursfortheXREF|
||attachprocess.|
+++
|:VLRabortAttach|AnXREFattachoperationwasterminated|
||beforesuccessfulcompletion.|
+++
|:VLRendAttach|AnXREFattachoperationcompleted|
||successfully.|
+++
|:VLRredirected|AnobjectIDintheXREFdrawingisbeing|
||modifiedtopointtotheassociatedobject|
||inthedrawingbeingXREFedinto.|
+++
|:VLRcomandeered|TheobjectIDoftheobjectisbeing|
||appendedtothesymboltableofthe|
||drawingbeingXREFedinto.|
+++
|:VLRbeginRestore|AnexistingXREFisabouttoberesolved|
||(typicallywhenadrawingwithXREFsis|
||loading).|
+++
|:VLRabortRestore|AnXREFunloadorreloadwasterminated|
||beforesuccessfulcompletion.|
+++
|:VLRendRestore|AnexistingXREFhasbeenresolved|
||(typicallywhenadrawingwithXREFshas|
||completedloading).|
+++
|:VLRxrefSubcommandBindItem|TheBINDsubcommandofXREFwasinvoked,|
||orapreexistingxrefisbeingbound.|

||NotethattheBINDsubcommandis|
||interactiveandtriggersmultipleevents.|
+++
|:VLRxrefSubcommandAttachItem|TheATTACHsubcommandofXREFwasinvoked,|
||orapreexistingxrefisbeing|
||resolved.NotethattheATTACHsubcommand|
||isinteractiveandtriggersmultiple|
||events.|
+++
|:VLRxrefSubcommandOverlayItem|TheOVERLAYsubcommandofXREFwas|
||invoked,orapreexistingxrefisbeing|
||resolved.NotethattheOVERLAYsubcommand|
||isinteractiveandtriggersmultiple|
||events.|
+++
|:VLRxrefSubcommandDetachItem|TheDETACHsubcommandofXREFwas|
||invoked.NotethattheOVERLAYsubcommand|
||isinteractiveandtriggersmultiple|
||events.|
+++
|:VLRxrefSubcommandPathItem|ThePATHsubcommandofXREFwas|
||invoked.NotethatthePATHsubcommandis|
||interactiveandtriggersmultipleevents.|
+++
|:VLRxrefSubcommandReloadItem|TheRELOADsubcommandofXREFwasinvoked,|
||orapreexistingxrefisbeing|
||reloaded.NotethattheRELOADsubcommand|
||isinteractiveandtriggersmultiple|
||events.|
+++
|:VLRxrefSubcommandUnloadItem|TheUNLOADsubcommandofXREFwasinvoked,|
||orapreexistingxrefisbeingunloaded.|
+++
++++
|XREFreactorcallbackdata|
++++
|Name|Listlength|Parameters|
++++
|:VLRbeginAttach|3|Firstparameterisa|
|||VLAobjectpointingtothe|
|||targetdrawing|
|||database.Secondparameteris|
|||astringcontainingthefile|
|||nameofthexrefbeing|
|||attached.Thirdparameteris|
|||aVLAobjectpointingtothe|
|||drawingdatabasethat|
|||containstheobjectsbeing|
|||attached.|
++++
|:VLRotherAttach|2|Firstparameterisa|
|||VLAobjectpointingtothe|
|||targetdrawing|
|||database.Secondparameteris|
|||aVLAobjectpointingtothe|
|||drawingdatabasethat|
|||containstheobjectsbeing|
|||attached.|
++++
|:VLRabortAttach|1|AVLAobjectpointingtothe|
|||drawingdatabasethat|
|||containstheobjectsbeing|
|||attached.|
++++
|:VLRendAttach|1|AVLAobjectpointingtothe|
|||targetdrawingdatabase.|
++++
|:VLRredirected|2|Firstparameterisan|
|||integercontainingthe|
|||objectIDfortheredirected|
|||symboltablerecord(STR)in|
|||thedrawingbeingXREFed|
|||to.Secondparameterisan|
|||integercontainingthe|
|||objectIDfortheobjectin|
|||thexrefdrawing.|
++++
|:VLRcomandeered|3|Firstparameterisa|
|||VLAobjectpointingtothe|
|||databasereceivingthe|
|||XREF.Secondparameterisan|
|||integercontainingthe|
|||objectIDoftheobject|
|||beingcommandeered.Third|

|||parameterisaVLAobject|
|||pointingtothedrawing|
|||databasethatcontainsthe|
|||objectsbeingattached.|
++++
|:VLRbeginRestore|3|Firstparameterisa|
|||VLAobjectpointingtothe|
|||databasereceivingthe|
|||XREF.Secondparameterisa|
|||stringcontainingtheXREF|
|||blocktablerecord(BTR)|
|||name.Thirdparameterisa|
|||VLAobjectpointingtothe|
|||drawingdatabasethat|
|||containstheobjectsbeing|
|||attached.|
++++
|:VLRabortRestore|1|AVLAobjectpointingtothe|
|:VLRendRestore||targetdrawingdatabase.|
++++
|:VLRxrefSubcommandBindItem|2|Firstparameterisan|
|||integerindicatingthe|
|||activitytheBINDis|
|||carryingout.Possible|
|||valuesare:0BIND|
|||subcommandinvoked.2xref|
|||withtheindicatedobjectID|
|||isbeingbound.3xrefwith|
|||theindicatedobjectIDwas|
|||successfullybound.4BIND|
|||subcommandcompleted.5BIND|
|||operationisabouttoeither|
|||terminateorfailto|
|||completeonthespecified|
|||objectID.6BINDoperation|
|||haseitherterminatedor|
|||failedtocompleteonthe|
|||specifiedobjectID.7Sent|
|||foranXDepblockboundby|
|||XBind.8Sentforallother|
|||symbols:Layers,Linetypes,|
|||TextStyles,and|
|||DimStyles.Secondparameter|
|||isanintegercontainingthe|
|||objectIDofthexrefbeing|
|||bound,or0ifnot|
|||applicable.|
++++
|:VLRxrefSubcommandAttachItem|2|Firstparameterisan|
|||integerindicatingthe|
|||activitytheATTACHis|
|||carryingout.Possible|
|||valuesare:0BIND|
|||subcommandinvoked.2xref|
|||withtheindicatedobjectID|
|||isbeingbound.3xrefwith|
|||theindicatedobjectIDwas|
|||successfullybound.4BIND|
|||subcommandcompleted.5BIND|
|||operationisabouttoeither|
|||terminateorfailto|
|||completeonthespecified|
|||objectID.6BINDoperation|
|||haseitherterminatedor|
|||failedtocompleteonthe|
|||specifiedobjectID.Second|
|||parameterisastring|
|||identifyingthefilebeing|
|||attached,ornilifnot|
|||applicable.|
++++
|:VLRxrefSubcommandOverlayItem|2|Firstparameterisan|
|||integerindicatingthe|
|||activitytheOVERLAYis|
|||carryingout.Possible|
|||valuesare:0BIND|
|||subcommandinvoked.2xref|
|||withtheindicatedobjectID|
|||isbeingbound.3xrefwith|
|||theindicatedobjectIDwas|
|||successfullybound.4BIND|
|||subcommandcompleted.5BIND|
|||operationisabouttoeither|
|||terminateorfailto|
|||completeonthespecified|

|||objectID.6BINDoperation|
|||haseitherterminatedor|
|||failedtocompleteonthe|
|||specifiedobjectID.Second|
|||parameterisastring|
|||identifyingthefilebeing|
|||overlaid,ornilifnot|
|||applicable.|
++++
|:VLRxrefSubcommandDetachItem|2|Firstparameterisan|
|||integerindicatingthe|
|||activitytheDETACHis|
|||carryingout.Possible|
|||valuesare:0BIND|
|||subcommandinvoked.2xref|
|||withtheindicatedobjectID|
|||isbeingbound.3xrefwith|
|||theindicatedobjectIDwas|
|||successfullybound.4BIND|
|||subcommandcompleted.5BIND|
|||operationisabouttoeither|
|||terminateorfailto|
|||completeonthespecified|
|||objectID.6BINDoperation|
|||haseitherterminatedor|
|||failedtocompleteonthe|
|||specifiedobjectID.Second|
|||parameterisaninteger|
|||containingtheobjectIDof|
|||thexrefbeingdetached,or|
|||0ifnotapplicable.|
++++
|:VLRxrefSubcommandPathItem|3|Firstparameterisan|
|||integerindicatingthe|
|||activitytheDETACHis|
|||carryingout.Possible|
|||valuesare:0BIND|
|||subcommandinvoked.2xref|
|||withtheindicatedobjectID|
|||isbeingbound.3xrefwith|
|||theindicatedobjectIDwas|
|||successfullybound.4BIND|
|||subcommandcompleted.5BIND|
|||operationisabouttoeither|
|||terminateorfailto|
|||completeonthespecified|
|||objectID.6BINDoperation|
|||haseitherterminatedor|
|||failedtocompleteonthe|
|||specifiedobjectID.Second|
|||parameterisaninteger|
|||containingtheobjectIDof|
|||thexrefbeingoperatedon,|
|||or0ifnotapplicable.Third|
|||parameterisastring|
|||identifyingthenewpath|
|||nameofthexref,ornilif|
|||notapplicable.|
++++
|:VLRxrefSubcommandReloadItem|2|Firstparameterisan|
|||integerindicatingthe|
|||activitytheRELOADis|
|||carryingout.Possible|
|||valuesare:0BIND|
|||subcommandinvoked.2xref|
|||withtheindicatedobjectID|
|||isbeingbound.3xrefwith|
|||theindicatedobjectIDwas|
|||successfullybound.4BIND|
|||subcommandcompleted.5BIND|
|||operationisabouttoeither|
|||terminateorfailto|
|||completeonthespecified|
|||objectID.6BINDoperation|
|||haseitherterminatedor|
|||failedtocompleteonthe|
|||specifiedobjectID.Second|
|||parameterisaninteger|
|||containingtheobjectIDof|
|||thexrefbeingreloaded,or|
|||0ifnotapplicable.|
++++
|:VLRxrefSubcommandUnloadItem|2|Firstparameterisan|
|||integerindicatingthe|
|||activitytheUNLOADis|

|||carryingout.Possible|
|||valuesare:0BIND|
|||subcommandinvoked.2xref|
|||withtheindicatedobjectID|
|||isbeingbound.3xrefwith|
|||theindicatedobjectIDwas|
|||successfullybound.4BIND|
|||subcommandcompleted.5BIND|
|||operationisabouttoeither|
|||terminateorfailto|
|||completeonthespecified|
|||objectID.6BINDoperation|
|||haseitherterminatedor|
|||failedtocompleteonthe|
|||specifiedobjectID.Second|
|||parameterisaninteger|
|||containingtheobjectIDof|
|||thexrefbeingunloaded,or|
|||0ifnotapplicable.|
++++

vports
Returnsalistofviewportdescriptorsforthecurrentviewportconfiguration
(vports)

ReturnValues
Oneormoreviewportdescriptorlistsconsistingoftheviewportidentification
numberandthecoordinatesoftheviewport'slowerleftandupperright
corners.
IftheAutoCADTILEMODEsystemvariableissetto1(on),thereturnedlist
describestheviewportconfigurationcreatedwiththeAutoCADVPORTScommand.
Thecornersoftheviewportsareexpressedinvaluesbetween0.0and1.0,with
(0.0,0.0)representingthelowerleftcornerofthedisplayscreen'sgraphics
area,and(1.0,1.0)theupperrightcorner.IfTILEMODEis0(off),the
returnedlistdescribestheviewportobjectscreatedwiththeMVIEWcommand.
Theviewportobjectcornersareexpressedinpaperspacecoordinates.Viewport
number1isalwayspaperspacewhenTILEMODEisoff.

Examples
GivenasingleviewportconfigurationwithTILEMODEon,thevportsfunction
mightreturnthefollowing:
((1(0.00.0)(1.01.0)))
Givenfourequalsizedviewportslocatedinthefourcornersofthescreenwhen
TILEMODEison,thevportsfunctionmightreturnthefollowinglists:
((5(0.50.0)(1.00.5))
(2(0.50.5)(1.01.0))
(3(0.00.5)(0.51.0))
(4(0.00.0)(0.50.5)))
Thecurrentviewport'sdescriptorisalwaysfirstinthelist.Intheprevious
example,viewportnumber5isthecurrentviewport.
================================WFunctions===================================

wcmatch
Performsawildcardpatternmatchonastring
(wcmatchstringpattern)

Arguments
string

Astringtobecompared.Thecomparisoniscasesensitive,soupperand
lowercasecharactersmustmatch.
pattern
Astringcontainingthepatterntomatchagainststring.Thepatterncan
containthewildcardpatternmatchingcharactersshowninthetableWildcard
characters.Youcanusecommasinapatterntoentermorethanonepattern
condition.Onlythefirst500characters(approximately)ofthestringand
patternarecomparedanythingbeyondthatisignored.
Bothargumentscanbeeitheraquotedstringorastringvariable.Itisvalid
tousevariablesandvaluesreturnedfromAutoLISPfunctionsforstringand
patternvalues.

ReturnValues
Ifstringandpatternmatch,wcmatchreturnsT,otherwise,wcmatchreturnsnil.
+++
|Wildcardcharacters|
+++
|Character|Definition|
+++
|#(pound)|Matchesanysinglenumericdigit|
+++
|@(at)|Matchesanysinglealphabeticcharacter|
+++
|.(period)|Matchesanysinglenonalphanumericcharacter|
+++
|*(asterisk)|Matchesanycharactersequence,includinganempty|
||one,anditcanbeusedanywhereinthesearch|
||pattern:atthebeginning,middle,orend|
+++
|?(questionmark)|Matchesanysinglecharacter|
+++
|~(tilde)|Ifitisthefirstcharacterinthepattern,it|
||matchesanythingexceptthepattern|
+++
|[...]|Matchesanyoneofthecharactersenclosed|
+++
|[~...]|Matchesanysinglecharacternotenclosed|
+++
|(hyphen)|Usedinsidebracketstospecifyarangeforasingle|
||character|
+++
|,(comma)|Separatestwopatterns|
+++
|`(reversequote)|Escapesspecialcharacters(readsnextcharacter|
||literally)|
+++

Examples

ThefollowingcommandtestsastringtoseeifitbeginswiththecharacterN:
Command:(wcmatch"Name""N*")
T
Thefollowingexampleperformsthreecomparisons.Ifanyofthethreepattern
conditionsismet,wcmatchreturnsT.Inthiscasethetestsare:doesthe
stringcontainthreecharactersdoesthestringnotcontainanmanddoesthe
stringbeginwiththeletter"N."Ifanyofthethreepatternconditionsis
met,wcmatchreturnsT:
:(wcmatch"Name""???,~*m*,N*")
T
Inthisexample,thelastconditionwasmet,sowcmatchreturnedT.
UsingEscapeCharacterswithwcmatch
Totestforawildcardcharacterinastring,youcanusethesingle
reversequotecharacter(`)toescapethecharacter.Escapemeansthatthe
characterfollowingthesinglereversequoteisnotreadasawildcard
characteritiscomparedatitsfacevalue.Forexample,tosearchforacomma
anywhereinthestring"Name",enterthefollowing:
Command:(wcmatch"Name""*`,*")
nil
BoththeCandAutoLISPprogramminglanguagesusethebackslash(\)asan

escapecharacter,soyouneedtwobackslashes(\\)toproduceonebackslashin
astring.Totestforabackslashcharacteranywherein"Name",usethe
followingfunctioncall:
Command:(wcmatch"Name""*`\\*")
nil
Allcharactersenclosedinbrackets([...])arereadliterally,sothereis
noneedtoescapethem,withthefollowingexceptions:thetildecharacter(~)
isreadliterallyonlywhenitisnotthefirstbracketedcharacter(asin
"[A~BC]")otherwiseitisreadasthenegationcharacter,meaningthatwcmatch
shouldmatchallcharactersexceptthosefollowingthetilde(asin"[~ABC]").
Thedashcharacter()isreadliterallyonlywhenitisthefirstorlast
bracketedcharacter(asin"[ABC]"or"[ABC]")orwhenitfollowsaleading
tilde(asin"[~ABC]").Otherwise,thedashcharacter()isusedwithin
bracketstospecifyarangeofvaluesforaspecificcharacter.Therangeworks
onlyforsinglecharacters,so"STR[138]"matchesSTR1,STR2,STR3,andSTR8,
and"[AZ]"matchesanysingleuppercaseletter.
Theclosingbracketcharacter(])isalsoreadliterallyifitisthefirst
bracketedcharacterorifitfollowsaleadingtilde(asin"[]ABC]"or
"[~]ABC]").

Note:Becauseadditionalwildcardcharactersmightbeaddedinfuture
releasesofAutoLISP,itisagoodideatoescapeallnonalphanumeric
charactersinyourpatterntoensureupwardcompatibility.

while
Evaluatesatestexpression,andifitisnotnil,evaluatesotherexpressions
repeatsthisprocessuntilthetestexpressionevaluatestonil
(whiletestexpr[expr...])
Thewhilefunctioncontinuesuntiltestexprisnil.

Arguments
testexpr
Theexpressioncontainingthetestcondition.
expr
Oneormoreexpressionstobeevaluateduntiltestexprisnil.

ReturnValues
Themostrecentvalueofthelastexpr.

Examples
Thefollowingcodecallsuserfunctionsomefunctentimes,withtestsetto1
through10.Itthenreturns11,whichisthevalueofthelastexpression
evaluated:
(setqtest1)
(while(<=test10)
(somefunctest)
(setqtest(1+test))
)

writechar
Writesonecharactertothescreenortoanopenfile
(writecharnum[filedesc])

Arguments
num
ThedecimalASCIIcodeforthecharactertobewritten.
filedesc
Afiledescriptorforanopenfile.

ReturnValues
Thenumargument.

Examples
ThefollowingcommandwritestheletterCtothecommandwindow,andreturns
thesuppliednumargument:
Command:(writechar67)
C67
Assumingthatfisthedescriptorforanopenfile,thefollowingcommand
writestheletterCtothatfile:
Command:(writechar67f)
67

NotethatwritecharcannotwriteaNULLcharacter(ASCIIcode0)toafile.
SeeAlso
TheCustomizationGuideforalistofASCIIcodes.

writeline
Writesastringtothescreenortoanopenfile
(writelinestring[filedesc])

Arguments
string
Astring.
filedesc
Afiledescriptorforanopenfile.

ReturnValues
Thestring,quotedinthenormalmanner.Thequotesareomittedwhenwritingto
afile.

Examples
Openanewfile:
Command:(setqf(open"c:\\mydocuments\\new.tst""w"))
#<file"c:\\mydocuments\\new.tst">
Usewritelinetowritealinetothefile:
Command:(writeline"Toboldlygowherenomadhasgonebefore."f)
"Toboldlygowherenomadhasgonebefore."
Thelineisnotphysicallywrittenuntilyouclosethefile:
Command:(closef)
nil
================================XFunctions===================================

xdroom
Returnstheamountofextendeddata(xdata)spacethatisavailableforan
object(entity)
(xdroomename)
Becausethereisalimit(currently,16kilobytes)ontheamountofextended
datathatcanbeassignedtoanentitydefinition,andbecausemultiple
applicationscanappendextendeddatatothesameentity,thisfunctionis
providedsoanapplicationcanverifythereisroomfortheextendeddatathat
itwillappend.Itcanbecalledinconjunctionwithxdsize,whichreturnsthe
sizeofanextendeddatalist.

Arguments
ename
Anentityname(enamedatatype).

ReturnValues
Anintegerreflectingthenumberofbytesofavailablespace.Ifunsuccessful,
xdroomreturnsnil.

Examples
Thefollowingexamplelooksuptheavailablespaceforextendeddataofa
viewportobject:
Command:(xdroomvpname)
16162
Inthisexample,16,162bytesoftheoriginal16,383bytesofextendeddata
spaceareavailable,meaningthat221bytesareused.

xdsize
Returnsthesize(inbytes)thatalistoccupieswhenitislinkedtoanobject
(entity)asextendeddata
(xdsizelst)

Arguments
lst
Avalidlistofextendeddatathatcontainanapplicationnamepreviously
registeredwiththeuseoftheregappfunction.SeetheExamplessectionof
thisfunctionforlstexamples.

ReturnValues
Anintegerreflectingthesize,inbytes.Ifunsuccessful,xdsizereturnsnil.
Bracefields(groupcode1002)mustbebalanced.Aninvalidlstgeneratesan
errorandplacestheappropriateerrorcodeintheERRNOvariable.Ifthe
extendeddatacontainsanunregisteredapplicationname,youseethiserror
message(assumingthatCMDECHOison):
Invalidapplicationnamein1001group

Examples
Thelstcanstartwitha3groupcode(theextendeddatasentinel),butitis
notrequired.Becauseextendeddatacancontaininformationfrommultiple
applications,thelistmusthaveasetofenclosingparentheses.
(3("MYAPP"(1000."SUITOFARMOR")
(1002."{")

(1040.0.0)
(1040.1.0)
(1002."}")
)
)
Hereisthesameexamplewithoutthe3groupcode.Thislistisjustthecdr
ofthefirstexample,butitisimportantthattheenclosingparenthesesare
included:
(("MYAPP"(1000."SUITOFARMOR")
(1002."{")
(1040.0.0)
(1040.1.0)
(1002."}")
)
)
================================ZFunctions===================================

zerop
Verifiesthatanumberevaluatestozero
(zeropnumber)

Arguments
number
Anumber.

ReturnValues
Tifnumberevaluatestozero,otherwisenil.

Examples
Command:(zerop0)
T
Command:(zerop0.0)
T
Command:(zerop0.0001)
nil
=========================ExternallyDefinedCommands===========================
AutoCAD(R)commandsdefinedbyObjectARX(R)orAutoLISP(R)applicationsare
calledexternallydefined.AutoLISPapplicationsmayneedtoaccessexternally
definedcommandsdifferentlyfromthewaytheyaccessbuiltinAutoLISP
functions.Manyexternallydefinedcommandshavetheirownprogramming
interfacesthatallowAutoLISPapplicationstotakeadvantageoftheir
functionality.
Foradditionalinformationonthecommandsdescribedinthisappendix,seethe
CommandReference.

3dsin

Importsa3DStudio(.3ds)file(Externallydefined:renderARXapplication)
(c:3dsinmode[multimatcreate]file)

Arguments
mode
Anintegerthatspecifieswhetherthecommandistobeusedinteractively(mode
=1)ornoninteractively(mode=0).
multimat
Anintegerthatspecifieshowtotreatobjectswithmultiplematerials.
Requiredifmodeissetto0.Allowablevaluesare:
0Createanewobjectforeachmaterial
1Assignthefirstmaterialtothenewobject
create
Anintegerthatspecifieshowtoorganizenewobjects.Thismodealwaysimports
alltheobjectsinthe.3dsfile.Requiredifmodeissetto0.Allowable
valuesare:
0Createalayerforeach3DSobject
1Createalayerforeach3DScolor
2Createalayerforeach3DSmaterial
3Placeallnewobjectsonasinglelayer
file
Astringspecifyingthe3DSfiletoimportthe.3dsfileextensionis
required.
Mode0alwaysimportsalltheobjectsinthe3DSfile.

Examples
Openthe3DStudiofileglobe.3dsforimportandprompttheuserforimport
specifics:
(c:3dsin1"globe.3ds")
Importallofshadow.3dswithnouserinput,splittingobjectswithmultiple
materialsandputtingallnewobjectsonthesamelayer:
Command:(c:3dsin003"c:/mydocuments/caddrawings/shadow.3ds")
InitializingRender...
Initializingpreferences...done.
ProcessingobjectB_Leg01
ConvertingmaterialSKIN
ProcessingobjectB_Leg02
ProcessingobjectCentral_01
ProcessingobjectCentral_02
ProcessingobjectF_Leg01
ProcessingobjectF_Leg02
ProcessingobjectM_Quad01
ProcessingobjectML_Feele01
ProcessingobjectML_Feele02
ProcessingobjectPre_Quad01
ProcessingobjectPre_Quad02
3DStudiofileimportcompleted
1

3dsout
Exportsa3DStudiofile(Externallydefined:renderARXapplication)
(c:3dsoutssetomodedivsmoothweldfile)

Arguments
sset
AselectionsetcontainingtheAutoCADobjectstoexport.
omode
Aninteger(0or1)thatspecifiestheoutputmodefortherepresentationof
AutoCADdata.Currently,3dsoutoutputisthesamewhetheromodeissetto0or
1
div
AnintegerthatspecifieshowtodivideAutoCADobjectsinto3DStudioobjects.
Allowablevaluesare:
0CreateoneobjectforeachAutoCADlayer
1CreateoneobjectforeachAutoCADcolor
2CreateoneobjectforeachAutoCADobjecttype
smooth
Anintegerthatspecifiesthethresholdangleforautomaticsmoothing.If
smoothissetto1,noautosmoothingisdoneifsmoothissetto0360,
AutoCADgeneratessmoothingwhentheanglebetweenfacenormalsislessthan
thisvalue.
weld
Arealnumberthatspecifiesthedistancethresholdforweldingnearby
vertices.Ifweldissettoavaluelessthan0,weldingisdisabledifweld
issettoavaluegreaterthanorequalto0,AutoCADweldsverticescloser
thanthisvalue.
file
Astringspecifyingthenameofthe3DStudiofiletocreatethe.3dsfile
extensionisrequired.

Examples
Exportallofadrawing,creating3DStudioobjectsbasedondrawinglayer,
usingasmoothingthresholdof30degreesandaweldingdistanceof0.1:
(c:3dsout(ssget"X")00300.1"testav.3ds")

align
Translatesandrotatesobjects,allowingthemtobealignedwithotherobjects
(Externallydefined:geom3dARXapplication)
(alignarg1arg2...)

Arguments
arg1arg2...

ArgumentstotheAutoCADaligncommand.Theorder,number,andtypeof
argumentsforthealignfunctionarethesameasifyouwereenteringALIGNat
thecommandline.
Toindicateanullresponse(auserpressingENTER),specifyniloranempty
string("").

ReturnValues
Tifsuccessful,otherwisenil.

Examples
Thefollowingexamplespecifiestwopairsofsourceanddestinationpoints,
whichperforma2Dmove:
(setqss(ssget))
(alignsss1d1s2d2"""2d")

cal
Invokestheonlinegeometrycalculatorandreturnsthevalueoftheevaluated
expression(Externallydefined:geomcalARXapplication)
(c:calexpression)

Arguments
expression
Aquotedstring.RefertoCALintheCommandReferenceforadescriptionof
allowableexpressions.

ReturnValues
Theresultoftheexpression.

Examples
ThefollowingexampleusescalinanAutoLISPexpressionwiththetrans
function:
(trans(c:cal"[1,2,3]+MID")12)

fog
Addsdistancefromtheview(Externallydefined:renderARXapplication)
(c:fogenabled[color[near_dist[far_dist[near_percent[far_percent
[background]]]]]])

Arguments
enabled
Astringthatturnsfogonandoffwithoutaffectingothersettings.Defaultis
ON.
color
A3DpointspecifyingastandardAutoCADcolor.Defaultis(111).
near_dist
Arealnumberdefiningwherethefogstarts.Defaultis0.0.
far_dist
Arealnumberdefiningwherethefogends.Defaultis1.0.
near_percent
Arealnumberdefiningthepercentageoffogatthestartofthebank.Default
is0.0.
far_percent
Arealnumberdefiningthepercentageoffogattheendofthebank.Defaultis

1.0.
background
Astringthatappliesfogtothebackgroundaswellastothegeometry.Default
isOFF(donotapplyfogtothebackground).
WiththeFOGcommand,youcanprovidevisualinformationaboutthedistanceof
objectsfromtheview'seye.Tomaximizefog,addwhitetoanimageto
maximizedepthcueing,addblack.
Nilormissingtrailingargumentsarenotchanged.

light
Creates,modifies,anddeleteslightsandlightingeffects(Externallydefined:
renderARXapplication)
(c:lightmode[options])

Arguments
mode
Astringindicatingtheactiontobeperformed.Allowablemodevaluesare:
ASetorretrieveambientlightintensity
DDeleteexistinglights
LListalllightsinthedrawingorreturnadefinitionofaspecifiedlight
MModifyexistinglights
NDCreateanewdistantlight
NPCreateanewpointlight
NSCreateanewspotlight
RRenameanexistinglight
options
Theoptionsalloweddependonthemodeandarelistedseparatelyforeachmode.

Note:Thiscommandisnotallowedinpaperspace.
AAmbientLight
Setorretrievetheambientlightintensity.
(c:light"A"[intensity[color]])

Arguments
intensity
Arealnumberfrom0.0to1.0ifintensityisomitted,itdefaultsto1.0.
color
AlistthatspecifiesanyRGBtripletifomitted,itdefaultsto(1.01.0
1.0).

Examples
Tosetambientlightintensityto0.6,issuethefollowing:
Command:(c:light"A"0.6)
1
Toretrievethecurrentambientlightintensity,omittheintensityargument:
Command:(c:light"A")
(0.6(1.01.01.0))

Theintensityreturnedis0.6,andthecoloris1.01.01.0.
DDeleteLights
Deleteexistinglights.
(c:light"D"name)

Arguments
name
Astringspecifyingthenameofthelighttodelete.

Examples
Thefollowingfunctioncalldeletesalightnamed"OLDLGT":
(c:light"D""OLDLGT")
LListLights
Listalllightsinthedrawingorreturnadefinitionofthespecifiedlight.
(c:light"L"[name])

Arguments
name
Astringspecifyingthenameofthelighttolist.Ifyouomitthename
argument,c:lightreturnsalistofallthelightsdefinedinthedrawing.

Examples
Thefollowingcommandlistsalllightsdefinedinthecurrentdrawing:
Command:(c:light"L")
("BUDLIGHT""LIGHT01")
Thefollowingcommandliststhepropertiesofalightnamed"LIGHT01":
Command:(c:light"L""LIGHT01")
("P"<Entityname:4cf3ae8>1.0(26.560943.42348.6995)(0.00.00.0)
(0.7058820.7058820.705882)512nilnil3.0"OFF"0nil)
MModifyLights
Modifiesexistinglights.
(c:light"M"name[intensity[from[to[color[shadowmapsize[hotspot[falloff
[shadowsoftness[shadow[shadowobjects[month[day[hour[minute[daylight
[latitude[longitude[attenuation]]]]]]]]]]]]]]]]]])

Arguments
TheargumentsfortheModifymodearedescribedinthefollowingtable:
+++++
|LIGHT"M"modearguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Uniquelightname|None|
+++++
|intensity|REAL|Arealnumberfrom|Basedon|
|||0.0tothedefault|attenuation|
|||maximum||
+++++
|from|LIST|Lightlocation|Current|
||||lookfrompoint|
+++++
|to|LIST|Lighttarget|Currentlookat|
||||point|
+++++
|color|LIST|AnyRGBtriplet|1.0,1.0,1.0|
+++++
|shadowmapsize|INT|Integerfrom0to|0|
|||4096(thesize,in||
|||pixels,ofoneside||
|||oftheshadowmap)||

+++++
|hotspot|REAL|Angleofthe|44.0|
|||brightnessbeamin||
|||degrees(mustbein||
|||therangeof1160)||
+++++
|falloff|REAL|Anglethatincludes|45.0|
|||therapiddecay||
|||area,indegrees||
|||(mustbeinthe||
|||range0160and||
|||greaterthanthe||
|||hotspotvalue)||
+++++
|shadowsoftness|REAL|Realnumberinthe|0.0|
|||range0.010.0||
+++++
|shadow|STR|Shadowcasting|0.0|
|||toggle.Valid||
|||valuesare:"off"||
|||(noshadows)and||
|||"on"(castshadows)||
+++++
|shadowobjects|ENAME|Aselectionof|0.0|
|||objectsthatbound||
|||theshadowmaps||
+++++
|month|INT|Integerfrom1to12|9|
+++++
|day|INT|Integerfrom1to31|21|
+++++
|hour|INT|Integerfrom0to24|15|
+++++
|minute|INT|Integerfrom0to59|0|
+++++
|daylight|STR|Daylightsavings|"off"|
|||toggle.Valid||
|||valuesare:"off"||
|||(nodaylight||
|||savings)and"on"||
|||(daylightsavings)||
+++++
|latitude|REAL|Realnumberinthe|37.62|
|||range090||
+++++
|longitude|REAL|Realnumberinthe|122.37|
|||range0180||
+++++
|timezone|INT|Integerfrom12to|8(PST)|
|||12,representing||
|||thehoursbehind||
|||GreenwichMeanTime||
|||(GMT)||
+++++
|attenuation|INT|0=noattenuation|1|
|||1=inverselinear||
|||attenuation||
|||2=inversesquare||
|||attenuation||
+++++
Thehotspotandfalloffargumentsapplyonlytospotlights.Youmustpassthem
asnilwhenyoucreateanewdistantlight.
Youcanspecifynilforanyargumentthatdoesnotapplytothetypeoflight
youaremodifying,orifyouwantthepropertyaffectedbytheargumentto
retainitscurrentvalue.Youcanomitanyargumentslocatedattheendofthe
argumentlist(forexample,attenuation,orattenuationandtimezone,or
attenuation,timezone,andlongitude...).

Examples
Thefollowingcodechangesthecolorofthedistantlightnamed"D1"toblue:
(c:light"M""D1"nilnilnil'(0.00.01.0))
NDNewDistantLight
Createanewdistantlight.
(c:light"ND"name[intensity[from[to[color[shadowmapsize[nil[nil
[shadowsoftness[shadow[month[day[hour[minute[daylightsavings[latitude
[longitude[timezone[attenuation[shadowobjects]]]]]]]]]]]]]]]]]]])

Arguments

TheargumentsfortheNewDistantLightmodearedescribedinthefollowing
table:
+++++
|LIGHT"ND"modearguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Uniquelightname|None|
+++++
|intensity|REAL|Arealnumberfrom|Basedon|
|||0.0tothedefault|attenuation|
|||maximum||
+++++
|from|LIST|Lightlocation|Current|
||||lookfrompoint|
+++++
|to|LIST|Lighttarget|Currentlookat|
||||point|
+++++
|color|LIST|AnyRGBtriplet|1.0,1.0,1.0|
+++++
|shadowmapsize|INT|Integerfrom0to|0|
|||4096(thesize,in||
|||pixels,ofoneside||
|||oftheshadowmap)||
+++++
|hotspot|REAL|Angleofthe|44.0|
|||brightnessbeamin||
|||degrees(mustbein||
|||therangeof1160)||
+++++
|falloff|REAL|Anglethatincludes|45.0|
|||therapiddecay||
|||area,indegrees||
|||(mustbeinthe||
|||range0160and||
|||greaterthanthe||
|||hotspotvalue)||
+++++
|shadowsoftness|REAL|Realnumberinthe|0.0|
|||range0.010.0||
+++++
|shadow|STR|Shadowcasting|0.0|
|||toggle.Valid||
|||valuesare:"off"||
|||(noshadows)and||
|||"on"(castshadows)||
+++++
|month|INT|Integerfrom1to12|9|
+++++
|day|INT|Integerfrom1to31|21|
+++++
|hour|INT|Integerfrom0to24|15|
+++++
|minute|INT|Integerfrom0to59|0|
+++++
|daylight|STR|Daylightsavings|"off"|
|||toggle.Valid||
|||valuesare:"off"||
|||(nodaylight||
|||savings)and"on"||
|||(daylightsavings)||
+++++
|latitude|REAL|Realnumberinthe|37.62|
|||range090||
+++++
|longitude|REAL|Realnumberinthe|122.37|
|||range0180||
+++++
|timezone|INT|Integerfrom12to|8(PST)|
|||12,representing||
|||thehoursbehind||
|||GreenwichMeanTime||
|||(GMT)||
+++++
|shadowobjects|ENAME|Aselectionof|0.0|
|||objectsthatbound||
|||theshadowmaps||
+++++
NPNewPointLight
Createanewpointlight.

(c:light"NP"name[intensity[from[nil[color
[shadowmapsize[nil[nil[shadowsoftness[shadow
[attenuation[shadowobjects]]]]]]]]]]])

Arguments
TheargumentsfortheNewPointLightmodearedescribedinthefollowing
table:
+++++
|LIGHT"NP"modearguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Uniquelightname|None|
+++++
|intensity|REAL|Arealnumberfrom|Basedon|
|||0.0tothedefault|attenuation|
|||maximum||
+++++
|from|LIST|Lightlocation|Current|
||||lookfrompoint|
+++++
|color|LIST|AnyRGBtriplet|1.0,1.0,1.0|
+++++
|shadowmapsize|INT|Integerfrom0to|0|
|||4096(thesize,in||
|||pixels,ofoneside||
|||oftheshadowmap)||
+++++
|shadowsoftness|REAL|Realnumberinthe|0.0|
|||range0.010.0||
+++++
|shadow|STR|Shadowcasting|0.0|
|||toggle.Valid||
|||valuesare:"off"||
|||(noshadows)and||
|||"on"(castshadows)||
+++++
|attenuation|INT|0=noattenuation|1|
|||1=inverselinear||
|||attenuation||
|||2=inversesquare||
|||attenuation||
+++++
|shadowobjects|ENAME|Aselectionof|0.0|
|||objectsthatbound||
|||theshadowmaps||
+++++
Threeargumentsto(afterfrom),hotspot,andfalloff(after
shadowmapsize)donotapplytopointlights.Youmustpassthemasnilwhen
youcreateanewpointlight.

Examples
Forexample,thefollowingcodecreatesanewpointlightnamedNEWPT1.
(c:light"NP""NEWPT1")
NEWPT1wouldhavethedefaultintensity,thecurrentattenuationsetting,the
defaultlocationlookingatthecurrentview,andthedefaultcolorofwhite.

Note:Forpointlights,thedefaultmaximumintensitydependsonthecurrent
point/spotlightattenuationsetting.Withnoattenuation,itis1.00with
inverselinearattenuation,itistwicethedrawing'smaximumextentsdistance
andwithinversesquareattenuation,itisthesquareoftwicethemaximum
extentsdistance.
NSNewSpotlight
Createsanewspotlight.
(c:light"NS"name[intensity[from[to[color[shadowmapsize[hotspot[falloff
[shadowsoftness[shadow[attenuation[shadowobjects]]]]]]]]]]])

Arguments
TheargumentsfortheNewSpotlightmodearedescribedinthefollowingtable:
+++++
|LIGHT"NS"modearguments|
+++++
|Argument|Datatype|Description|Default|
+++++

|name|STR|Uniquelightname|None|
+++++
|intensity|REAL|Arealnumberfrom|Basedon|
|||0.0tothedefault|attenuation|
|||maximum||
+++++
|from|LIST|Lightlocation|Current|
||||lookfrompoint|
+++++
|to|LIST|Lighttarget|Currentlookat|
||||point|
+++++
|color|LIST|AnyRGBtriplet|1.0,1.0,1.0|
+++++
|shadowmapsize|INT|Integerfrom0to|0|
|||4096(thesize,in||
|||pixels,ofoneside||
|||oftheshadowmap)||
+++++
|hotspot|REAL|Angleofthe|44.0|
|||brightnessbeamin||
|||degrees(mustbein||
|||therangeof1160)||
+++++
|falloff|REAL|Anglethatincludes|45.0|
|||therapiddecay||
|||area,indegrees||
|||(mustbeinthe||
|||range0160and||
|||greaterthanthe||
|||hotspotvalue)||
+++++
|shadowsoftness|REAL|Realnumberinthe|0.0|
|||range0.010.0||
+++++
|shadow|STR|Shadowcasting|0.0|
|||toggle.Valid||
|||valuesare:"off"||
|||(noshadows)and||
|||"on"(castshadows)||
+++++
|attenuation|INT|0=noattenuation|1|
|||1=inverselinear||
|||attenuation||
|||2=inversesquare||
|||attenuation||
+++++
|shadowobjects|ENAME|Aselectionof|0.0|
|||objectsthatbound||
|||theshadowmaps||
+++++

Examples

Thefollowingcodecreatesanewspotlightnamed"GSPOT":
Command:(c:light"NS""GSPOT"43.82'(12.06.024.0)'(78.078.0
24.0)nilnil30.032.0)
1
GSPOTisaspotlightwithanintensityof43.82.Itscoloristhedefault
(white).Thespotlight'slocationis(12,6,24),anditstargetis(78,78,24).
Itsconeis32degreeswide,withahotspotof30degrees.

Note:Forspotlights,thedefaultmaximumintensitydependsonthecurrent
point/spotlightattenuationsetting.Withnoattenuation,itis1.00with
inverselinearattenuation,itistwicethedrawing'smaximumextentsdistance
andwithinversesquareattenuation,itisthesquareoftwicethemaximum
extentsdistance.
RRenameLight
Renamealight.
(c:light"R"old_namenew_name)

Arguments
old_name
Astringspecifyingthenameofthelighttorename.
new_name

Astringspecifyingthelight'snewname.
Thefollowingfunctioncallchangesthelightnamed"GSPOT"to"HOTSPOT":

Examples
Command:(c:light"R""GSPOT""HOTSPOT")
1

lsedit
Createsormodifieslandscapeobjects(Externallydefined:renderARX
application)
(c:lseditmode[options])
Thisformofthec:lseditisusedtocreateormodifyinstancesoflandscape
objectsinthedrawing.
(c:lsedit"LIST"object)
Thisformofc:lseditliststheattributesofthespecifiedlandscapeobject.
Thelistreturnedidentifiesthename,height,position,andviewalignmentof
thespecifiedobject.
(c:lseditobjectheight[position[alignment]])
Thisformoflseditmodifiesalandscapeobject.

Arguments
TheargumentsfortheLSEDITcommandaredescribedinthefollowingtable:
+++++
|LSEDITarguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|object|ENAME|Handleofthelandscape|None|
|||object||
+++++
|height|REAL|Heightoftheobjectin|None|
|||drawingunits.Ifnil,the||
|||currentvalueisunchanged.||
+++++
|position|LIST(ofreals)|Thepositionofthebaseof|None|
|||theobject.Ifnil,the||
|||currentvalueisunchanged.||
+++++
|alignment|INT|Specifiesthegeometryand|None|
|||alignmentofthe||
|||entry:0viewalignedsingle||
|||face||
|||1nonviewalignedsingle||
|||face||
|||2nonviewalignedcrossing||
|||faces||
|||3viewalignedcrossing||
|||facesIfnil,thecurrent||
|||valueisunchanged.||
+++++

Examples

Modifyalandscapeobject,where<ename>istheAutoCADname(entsel)ofthe
objecttomodifyleavealignmentunchanged:
(c:lsedit<ename>35.0'(10.023.0)nil)

lslib
Managesthelandscapelibrary(Externallydefined:renderARXapplication)

(c:lslibmode[options])

Arguments
mode
Themodeargumentcanbeoneofthefollowing:
ADDAddanentrytoalandscapelibrary
DELETEDeleteanentryfromalandscapelibrary
MODIFYModifyanentryinalandscapelibrary
OPENOpenalandscapelibrary
SAVESavethecurrentlandscapelibrary
LISTListtheentriesinthecurrentlandscapelibrary
options
Theallowableoptionsargumentsvarydependingonmode.Seethedescriptionof
eachmodetodeterminetheallowableoptions.
ADD
Addanentrytothecurrentlibrary.
(c:lslib"ADD"nametexturemapopacitymapalignment)

Arguments
name
Astringnamingtheentryinthelandscapelibrary.
texturemap
Astringnamingtheimagefilefortheentry.
opacitymap
Astringnamingtheopacityimagefortheentry.
alignment
Anintegerspecifyingthegeometryandalignmentoftheentry.Canbeoneof
thefollowing:
0viewalignedsingleface
1nonviewalignedsingleface
2nonviewalignedcrossingfaces
3viewalignedcrossingfaces
Therearenodefaultvaluesforanyofthesearguments.

Examples
Addanentrycalled"Mapletree"tothecurrentlandscapelibrary:
(c:lslib"ADD""Mapletree""maple.tga""mapleo.tga"0)
DELETE
Removeanentryfromthecurrentlibrary.
(c:lslib"DELETE"name)

Arguments
name
Astringnamingtheentryinthelandscapelibrary.

Examples
Removetheentrycalled"Mapletree"fromthecurrentlandscapelibrary:
(c:lslib"delete""Mapletree")

MODIFY
(c:lslib"MODIFY"nametexturemap[opacitymap[alignment]])
Changeanentryinthecurrentlibrary.Thetexturemap,opacitymap,and
alignmentargumentscanbepassedasnil,inwhichcasethevalueisunchanged.

Arguments
name
Astringnamingtheentryinthelandscapelibrary.
texturemap
Astringnamingtheimagefilefortheentry.
opacitymap
Astringnamingtheopacityimagefortheentry.
alignment
Anintegerspecifyingthegeometryandalignmentoftheentry.Canbeoneof
thefollowing:
0viewalignedsingleface
1nonviewalignedsingleface
2nonviewalignedcrossingfaces
3viewalignedcrossingfaces
Therearenodefaultvaluesforanyofthesearguments.

Examples
Changethe"Mapletree"tobenonviewalignedwithcrossingfaces:
(c:lslib"MODIFY""Mapletree"nilnil2)
OPEN
Openanewlibraryandmakeitthecurrentlibrary.
(c:lslib"OPEN"name)

Arguments
name
Astringnamingthelandscapelibrarytoopen.

Examples
OpentheTREES.LLIfileandmakeitthecurrentlandscapelibrary:
(c:lslib"OPEN""TREES.LLI")
SAVE
Savethecurrentlandscapelibraryasthenamedfile.
(c:lslib"SAVE"name)

Arguments
name
Astringnamingthelandscapelibraryfile.

Examples
SavethefileasTREES.LLI:
(c:lslib"SAVE""TREES.LLI")
LIST
Listsalltheelementsinthecurrentlibrary.Thiscommandtakesnoarguments.
Thelistincludeslandscapeentriesoftheform'("NAME""TEXMAP""OPMAP"
ALIGN).

(c:lslib"LIST")

Examples
ThefollowingillustratesoutputfromtheLISToption:
(("Bush#1""8bush02l.tga""8bush02o.tga"0)
("Cactus""8plnt15l.tga""8plnt15o.tga"0)
("DawnRedwood""8tree39l.tga""8tree39o.tga"0))

lsnew
Createlandscapeobjects(Externallydefined:renderARXapplication)
(c:lsnewobjecttypeheightpositionalignment)
TheLSNEWcommandisusedtocreateinstancesoflandscapeobjectsinthe
drawing.

Arguments
objecttype
Astringnamingthelandscapelibraryentry.
height
Arealnumberindicatingtheheightoftheobjectindrawingunits.
position
Alistofrealsindicatingthepositionofthebaseoftheobject.
alignment
Anintegerspecifyingthegeometryandalignmentoftheentry.Canbeoneof
thefollowing:
0viewalignedsingleface
1nonviewalignedsingleface
2nonviewalignedcrossingfaces
3viewalignedcrossingfaces
Therearenodefaultvaluesforanyofthesearguments.

Examples
Createanewinstanceof"Cactus"thatis25unitstall,locatedat0,1,3,
andhasasinglenonviewalignedface.
Command:(c:lsnew"Cactus"25.0'(0.01.03.0)1)
1

matlib
Managesmaterialslibraries(Externallydefined:renderARXapplication)
(c:matlibmodename[file])

Arguments
mode
Astringthatspecifiestheactionthatthisfunctionperforms.Canbeoneof
thefollowing:
IImportamaterialfromalibrary.

EExportamaterialtoalibrary.
DDeleteamaterialfromthedrawing.
CDeleteunattachedmaterialsfromthedrawing.
LListmaterials
name
Astringthatspecifiesthenameofthematerialtoimport,export,ordelete.
file
Astringthatspecifiesthenameofthematerialslibrary.file.Thefile
argumentmustincludethe.mliextension

Examples
ImportsthematerialBRASSfromthestandardAutoCADRendermaterialslibrary,
render.mli:
Command:(c:matlib"I""brass""c:/acad2000/support/render.mli")
1
ThefileargumentisnotusedwiththeDeletemode:
(c:matlib"D""steel")

mirror3d
Reflectsselectedobjectsaboutauserspecifiedplane(Externallydefined:
geom3dARXapplication)
(mirror3darg1arg2...)

Arguments
Theorder,number,andtypeofargumentsforthemirror3dfunctionarethesame
asifyouwereenteringtheMIRROR3DAutoCADcommand.Tosignifyauser
pressingENTERwithouttypinganyvalues,useniloranemptystring("").

ReturnValues
Tifsuccessful,otherwisenil.

Examples
ThefollowingexamplemirrorstheselectedobjectsabouttheXYplanethat
passesthroughthepoint0,0,5,andthendeletestheoldobjects:
(setqss(ssget))
(mirror3dss"XY"'(005)"Y")

render
Createsarealisticallyshadedimageofa3Dwireframemodelusinggeometry,
lighting,andsurfacefinishinformation(Externallydefined:renderARX
application)
(c:render[filename|point1point2])

Arguments
filename
Astringnamingarenderingfile.
Ifthefilenameargumentispresent,therenderingiswrittentoafileofthat
name.Ifadrivertorendertoafilehasn'tbeenconfigured,thefilename

argumentisignored.Thecurrentconfigurationmustspecifyrenderingtoa
file.
point1
Alistofrealsindicatingthefirstcropwindowpoint.
point1
Alistofrealsindicatingthesecondcropwindowpoint.
Therenderingiscontrolledbythecurrentsettingssetthesebyusingthe
c:rpreffunction.Forexample:
(c:rpref"Toggle""CropWindow""On")

Note:WhenthecurrentrenderingpreferencesspecifyQueryforSelectionand
thePICKFIRSTsystemvariableisturnedon,andwhenaselectionsetiscurrent
asyouinvokec:render,theobjectsinthesetarerenderedwithnofurther
prompting.
SettingtheRendertoFileOptions
Setstherendertofileoptionsforrendering.
(c:rfileoptfileformatxresyresaratiocolormode<modespecificoptions>)

Arguments
Thefollowingtabledescribesthec:rfileoptarguments.
++++
|RFILEOPTarguments|
++++
|Argument|Datatype|Description|
++++
|fileformat|STR|Identifierfortherequested|
|||format:TGATargaformat|
|||PCXZSoftbitmapformat|
|||BMPMicrosoftWindowsformat|
|||PSPostScript|
|||TIFFTaggedImageFileFormat|
++++
|xres|INT|Xresolutionoftheoutputfile(valid|
|||valuesrangefrom1to4096)|
++++
|yres|INT|Yresolutionoftheoutputfile(valid|
|||valuesrangefrom1to4096)|
++++
|aratio|REAL|Pixelaspectratio|
++++
|colormode|STR|Eachfileformatacceptsasubsetofthe|
|||followingvalues:MONOMonochrome|
|||G8256graylevels|
|||C8256colors|
|||C1616bitcolor|
|||C2424bitcolor|
|||C3224bitcolorwith8bitsofalpha|
++++
TGA
SpecifiestheTargaformat.
(c:rfileopt"TGA"xresyresaratiocolormode
interlacecompressbottomup)

Arguments
++++
|TGAformatarguments|
++++
|Argument|Datatype|Description|
++++
|colormode|STR|Colormode:G8,C8,C24,orC32|
++++
|interlace|INT|Interlacemode:1nointerlace|
|||22:1interlace|
|||44:1interlace|
++++
|compress|STR|Compression(default=|
|||"COMP"):COMPCompressionon|
|||nilNocompression|
++++
|bottomup|STR|Bottomup(default="UP"):UPbottomup|

|||niltopdown|
++++

Examples

(C:RFILEOPT"TGA"6404801.0"C32"1"COMP""UP")
PCX
SpecifiestheZSoftBitmapformat.
(c:rfileopt"PCX"xresyresaratiocolormode)

Arguments
++++
|PCXformatarguments|
++++
|Argument|Datatype|Description|
++++
|colormode|STR|Colormode:MONO,G8,orC8|
++++

Examples

(C:RFILEOPT"PCX"6404801.0"G8")
BMP
SpecifiestheMicrosoftWindowsbitmapformat.
(c:rfileopt"BMP"xresyresaratiocolormode)

Arguments
++++
|BMPformatarguments|
++++
|Argument|Datatype|Description|
++++
|colormode|STR|Colormode:MONO,G8,orC8|
++++

Examples

(C:RFILEOPT"BMP"6404801.0"C8")
PS
SpecifiesthePostScriptformat.
(c:rfileopt"PS"xresyresaratiocolormodeportraitimagesize[size])

Arguments
++++
|PSformatarguments|
++++
|Argument|Datatype|Description|
++++
|colormode|STR|Colormode:MONO,G8,C8,orC24|
++++
|portrait|STR|Landscapeorportrait(default="L"):|
|||PPortrait|
|||LLandscape|
++++
|imagesize|STR|Type(default="A")AAuto|
|||IImage|
|||CCustom|
++++
|size|INT|Sizeoftheimage|
++++

Examples

(C:RFILEOPT"PS"6404801.0"C24""P""C"640)
TIFF
SpecifiestheTaggedImageFileformat.
(c:rfileopt"TIFF"xresyresaratiocolormode)

Arguments
++++
|TIFFformatarguments|
++++

|Argument|Datatype|Description|
++++
|colormode|STR|Colormode:MONO,G8,C8,C24,orC32|
++++

Examples

(C:RFILEOPT"TIFF"6404801.0"C24")

renderupdate
Regeneratetheent2facefileonthenextrendering(Externallydefined:render
ARXapplication)
(c:renderupdate[RU_value])
Usetherenderupdatecommandwithnoargumentstoregeneratetheen2facefile
onthenextrendering.

Arguments
RU_value
Astringspecifyingoneofthefollowing:
ALWAYSGenerateanewgeometryfileforeachrendering.
OFFReturnRendertothenormalgeometrycachingmode.

rpref
Setsrenderingpreferences(Externallydefined:renderARXapplication)
(c:rprefmodeoption[setting])
Thec:rpreffunctiondetermineswhichrenderingparameterswillbeused,and
whichrenderingbehaviorwillbethedefault.

Arguments
mode
Astringthatcanbeoneofthefollowing:
DESTDestinationofviewport,Renderwindow,orfile
ICONScaleoftheLightandMaterialsiconblocks
ROPTMorerenderingoptions
SELECTWhethertopromptforobjectselection
STYPERenderingtypeofRender,PhotoReal,orPhotoRaytrace
TOGGLERenderingoptions
option
Dependsonmode.
setting
Dependsonmode.
SeeAlsoSettingtheRendertoFileOptions.
DESTDestinationPreference
Selectswhichoutputdeviceisused.
(c:rpref"DEST"option)

Arguments

option
Astringthatspecifiestherenderingdestination.Canbeoneofthefollowing:
FRAMEBUFFERRendertodisplay
HARDCOPYRendertoRenderwindow
FILERendertofile

Examples
Thefollowingcallspecifiesrenderingtoafile:
(c:rpref"DEST""FILE")
ICONIconPreference
Specifiesthesizeofthelightormaterialiconblockinadrawing.
(c:rpref"ICON"option)

Arguments
option
Arealthatspecifiesthesizeoftheiconblock.Thedefaultvalueis1.00.

Examples
Thefollowingfunctioncallchangestheiconscaleto50percent:
(c:rpref"ICON"0.5)
STYPERenderingTypePreference
SpecifieswhichtypeofRenderisused.
(c:rpref"STYPE"option)

Arguments
option
Astringthatspecifiestherenderingtype.Canbeoneofthefollowing:
ARENDERBasicrendering
ASCANPhotoRealrendering
ARAYPhotoRaytracerendering

Examples
Thefollowingcodespecifiesthatthenextrenderingwillbegeneratedbythe
basicAutoCADrenderer.
(c:rpref"STYPE""ARENDER")
SELECTSelectionPreference
Specifieswhethertopromptforobjectselectionbeforegeneratingarendering.
(c:rpref"SELECT"option)

Arguments
option
Astringthatspecifiestheprompting.Canbeoneofthefollowing:
ALLRenderfullscene
ASKPromptforobjectselection

Examples
Thefollowingcallsetsrenderingtopromptforobjectselection:
(c:rpref"SELECT""ASK")
TOGGLETogglePreference

Controlsvariousrenderingoptions.
(c:rpref"TOGGLE"optionsetting)

Arguments
option
Astringthatspecifiestheprompting.Canbeoneofthefollowing:
CACHERendertoacachefile.Aslongasthedrawinggeometryorviewis
unchanged,thecachedfileisusedforsubsequentrenderings,eliminatingthe
needtoretessellate.
SHADOWRenderwithshadows.
SMOOTHRenderwithsmoothing.
MERGEMergeobjectswithbackground.
FINISHApplymaterials.
SKIPRDLGDonotdisplaytheRenderdialogbox.
setting
Astringthatspecifiesthestateofthetoggle.Possiblevaluesforsetting
are"ON"and"OFF".

Examples
ThefollowingcallsturnoffMergerenderingandturnonshadows:
(c:rpref"TOGGLE""MERGE""OFF")
(c:rpref"TOGGLE""SMOOTH""ON")

replay
DisplaysaBMP,TGA,orTIFFimage(Externallydefined:renderARXapplication)
(c:replayfilenametype[xoffyoffxsizeysize])
WiththeREPLAYcommand,youcandisplayBMP,TGA,orTIFFfilesontheAutoCAD
renderingdisplay.Usethiscommand'sfunctiontoreplaytheimagefileat
variousoffsetsandsizes.

Arguments
filename
Astringnamingtheimagefile.
type
Astringidentifyingthefiletype.CanbeBMP,TGA,orTIFF.
xoff
AnintegerspecifyingtheimageXoffsetinpixels.Defaultis0.
yoff
AnintegerspecifyingtheimageYoffsetinpixels.Defaultis0.
xsize
ImageXsizeinpixels.DefaultistheactualXsize.
ysize
ImageYsizeinpixels.DefaultistheactualYsize.

Examples
Thefollowingcallreplaysanimagenamedtest.tga,displayingpixelsstarting
fromthelowerleftoftheimage(zerooffset)outto500pixelswideand400
pixelsinheight:

(c:replay"TEST""TGA"00500400)

rotate3d
Rotatesanobjectaboutanarbitrary3Daxis(Externallydefined:geom3dARX
application)
(rotate3dargs...)

Arguments
args
Theorder,number,andtypeofargumentsfortherotate3dfunctionarethesame
asifyouwereenteringthematthecommandlineseeROTATE3DintheCommand
Referenceformoreinformation.
Tosignifyanullresponse(userpressingENTERwithoutspecifyingany
arguments),useniloranemptystring("").

ReturnValues
Ifsuccessful,rotate3dreturnsTotherwiseitreturnsnil.

Examples
Thefollowingexamplerotatestheselectedobjects30degreesabouttheaxis
specifiedbypointsp1andp2.
(setqss(ssget))
(rotate3dssp1p230)
AutoLISPsupportfortherotate3dfunctionisimplementedwiththeuseofthe
SAGETlibrary.

scene
Createsnewscenesandmodifiesordeletesexistingscenesinpaperspaceonly
(Externallydefined:renderARXapplication)
(c:scenemode[options])

Arguments
mode
Astringthatcanbeoneofthefollowing:
DDeletesanexistingscene
LListsallscenesinthedrawingorreturnsadefinitionofthespecified
scene
MModifiesanexistingscene
NCreatesanewscene
RRenamesanexistingscene
SSetsthecurrentscene
options
Theallowableoptionsdependonthemodespecified.
DDeleteScene
Deletesanexistingscene.
(c:scene"D"name)

Arguments

name
Astringthatspecifiesthenameofthescenetodelete.
thedeletedsceneisthecurrentscene,NONEbecomesthecurrentscene.

Examples
(c:scene"D""PLANVIEW")
LListScene
Listsallscenesinthedrawingorreturnsadefinitionofthespecifiedscene.
(c:scene"L"[name])

Arguments
name
Astringthatspecifiesthenameofthescenetolist.Ifthenameargumentis
omitted,c:scenereturnsalistofallthescenesdefinedinthedrawing.

ReturnValues
Whenyouspecifyname,c:scenereturnsthedefinitionofthenamedscene.

Examples
Thefollowingcodereturnsalistofscenenamesdefinedinthedrawing.
Command:(c:scene"L")
("""SCENE1""SCENE2""SCENE3")
Theemptystring("")isthedefaultscene,*NONE*,whichcan'tbemodified.
Thefollowingfunctioncallreturnsadefinitionofthenamedscene:
Command:(c:scene"L""SCENE2")
(TT)
("VIEW1"nil)
("VIEW2"("LIGHT1""LIGHT2"))
MModifyScene
Modifiesanexistingscene.
(c:scene"M"name[view[lights]])
TheoptionsfortheModifymodearethesameasthosefortheNewmode,except
thatyoucanpassviewasniltomodifyonlythelights.

Note:Youmustpassthelightsargumentasalistevenwhenyouspecifyonly
onelight.
Forexample,thefollowingcallmodifiesascenenamedSCENE1tousethenamed
viewFRONTandallthelightsinthedrawing:
(c:scene"M""SCENE1""FRONT"(C:LIGHT"L"))
ThefollowingcallmodifiesSCENE1tousethenamedviewBACKandonlythe
lightsP1andP2:
(c:scene"M""SCENE1""BACK"'("P1""P2"))
NNewScene
Createsanewscene.
(c:scene"N"name[view[lights]])

Arguments
name
Astringthatspecifiesthenameofthenewscene.
view

EitherastringidentifyinganAutoCADnamedview,orthesymbolTtoindicate
CURRENTview.
lights
Thelightsargumentcanbeoneofthefollowing:
*Alistofstringscontaininglightnamestobeused.
*ThesymbolT,indicatingALLlightsinthedrawing.
*Nil,indicatingnolightsinthedrawing.
+++++++++
|*SCENE"N"modeargument|||||
+++++++++
|*Argument|*|*|*|||||
||Data|Description|Default|||||
||type|||||||
+++++++++
|||||*|*LIST|*Listof|*ALLlightsin|
|||||lights|(of|light|thedrawing|
||||||strings)|names.||
|||||||Mustuse|An|
||||||T(SYM)|alist|"overtheshoulder"|
||||||nil|evenif|distantlight|
|||||||specifying||
|||||||asingle||
|||||||light.||
|||||||UseALL||
|||||||lightsin||
|||||||the||
|||||||drawing||
|||||||Useno||
|||||||lightsin||
|||||||the||
|||||||drawing||
+++++++++

Examples

TocreateanewscenenamedDEFAULTusingtheCURRENTviewandALLlights,
issuethefollowingfunctioncall:
(c:scene"N""DEFAULT")
TocreateanewscenenamedDULLusingtheCURRENTviewandthedefault,
"overtheshoulder"lighting,usethefollowingcall:
(c:scene"N""DULL"Tnil)
TocreateanewscenenamedSPECIALusingthenamedviewMY_VIEWandtheSUN,
LAMP,andSPOTlights,issuethefollowingfunctioncall:
(c:scene"N""SPECIAL""MY_VIEW"'("SUN""LAMP"SPOT"))
RRenameScene
Renamesascene.
(c:scene"R"old_namenew_name)

Arguments
old_name
Astringthatspecifiesthenameoftheoriginalscene.
new_name
Astringthatspecifiesthenewnameforthescene.

Examples
Renameascenefrom"SPECIAL"to"BRIGHT":
(c:scene"R""SPECIAL""BRIGHT")
SSetScene
Setsthecurrentscene.
(c:scene"S"[name])

Arguments
old_name

Astringthatspecifiesthenameofthescenetomakecurrent.

ReturnValues
Ifyouomitthenameargument,c:scenereturnsthenameofthecurrently
selectedscene.

Examples
Obtainthenameofthecurrentlyselectedscene:
Command:(c:scene"S")
"PLAN"
Ifthereisnocurrentscene,c:scenereturnsanemptystring("").
TomakeSCENE3thecurrentscene,issuethefollowingfunctioncall:
(c:scene"S""SCENE3")

stats
Displaysstatisticsforthelastrendering(Externallydefined:renderARX
application)
(c:stats[filename|nil])
TheSTATScommandprovidesinformationaboutyourlastrendering.

Arguments
filename|nil
Astringspecifyingthenameofthefiletosavetherenderinginformationin,
orniltotellRENDERtostopsavingstatistics.Ifyouomitthefilename,
c:statsdisplaystheStatisticsdialogbox.

Examples
Thefollowingcommandwritesstatisticsfromyourlastrenderingtothe
figures.txtfile:
(c:stats"figures.txt")
Ifthefilealreadyexists,thestatisticsareappended.
Thefollowingcommandsavestheinformationassociatedwiththelastrendering
tothestats.txtfile,andalsosavestheinformationassociatedwiththe
followingrenderingstothisfile:
(c:stats"stats.txt")
ThefollowingcommandtellsRENDERtostopsavingstatistics:
(c:statsnil)

setuv
Assignsmaterialmappingcoordinatestoselectedobjects.Itsfunctionhastwo
modes,specifiedbyastringargument(Externallydefined:renderARX
application)
(c:setuvmodeoptions)
TheSETUVcommandletsyouassignmaterialmappingcoordinatestoselected
objects.

Arguments
mode
modecanbeoneofthefollowingstrings:

AAssignUVmappingtotheselectionset
DDetachUVmappingfromtheselectionset
options
Allowableoptionsdependonthemodespecified.
AAssign
The"A"(assign)modeassignsmappingcoordinates.

Arguments
Argumentsexpectedbythismodedependonwhetheryouspecifyprojectionor
solidmapping.Theassignargumentsforprojectionmappingaredescribedinthe
followingtable:
+++++++++
|SETUV"A"modeargumentsforprojectionmapping|||||
+++++++++
|Argument|Data|Description|Default|||||
||type|||||||
+++++++++
|||||ssname|PICKSET|The|None|
|||||||selection||
|||||||setthat||
|||||||contains||
|||||||the||
|||||||entities||
|||||||towhich||
|||||||youwant||
|||||||toassign||
|||||||mapping||
|||||||coordinates||
+++++++++
|mapping|STR|Typeofprojection|None|||||
|type||mapping:PplanarDcylindricalFspherical||||||
+++++++++
|pt1,pt2,|LIST|Threepointsthatdefinethemapping|None|||||
|pt3||geometry:Planarlowerleftcorner,||||||
|||lowerrightcorner,upperleftcorner||||||
|||Cylindricalcenterbottom,centertop,||||||
|||directiontowardtheseam||||||
|||Sphericalcenterofthesphere,radius||||||
|||(north),directiontowardtheseam||||||
+++++++++
|rep|INT|Tiling:0notiling(crop)|1|||||
|||1tile(repeatpattern)||||||
+++++++++
|scale|LIST|TheUandVscalefactors|(1.0|||||
||(of||1.0)|||||
||reals)|||||||
+++++++++
|offset|LIST|TheUandVoffsets|(0.0|||||
||(of||0.0)|||||
||reals)|||||||
+++++++++
Forsolidmapping,theoptionargumentsspecifyonlythemappingpoints.These
implicitlydefinethescaleintheUVWdimensions.Theassignargumentsfor
solidmappingaredescribedinthefollowingtable:
+++++++++
|SETUV"A"modeargumentsforsolid|||||
|mapping|||||
+++++++++
|Argument|Data|Description|Default|||||
||type|||||||
+++++++++
|||||ssname|PICKSET|The|None|
|||||||selection||
|||||||setthat||
|||||||contains||
|||||||the||
|||||||objectsto||
|||||||whichyou||
|||||||wantto||
|||||||assign||
|||||||mapping||
|||||||coordinates||
+++++++++
|mapping|STR|Rsolid|None|||||
|type||||||||

+++++++++
|pt1|LIST|Pointto|None|||||
|||definethe||||||
|||origin||||||
+++++++++
|pt1|LIST|Pointto|None|||||
|||definethe||||||
|||Uaxis||||||
+++++++++
|pt1|LIST|Pointto|None|||||
|||definethe||||||
|||Vaxis||||||
+++++++++
|pt1|LIST|Pointto|None|||||
|||definethe||||||
|||Waxis||||||
+++++++++

Examples

Thefollowingfunctioncallassignscylindricalmappingcoordinatestoan
objecttheuserchooses,usingtilingandthedefaultscaleandoffset:
(c:setuv"A"(ssget)"C"'(5.05.05.0)'(5.05.010.0)
'(10.00.00.0)1)
DDetach
The"D"(detach)modedetachestheUVmappingassignedtotheobjectsinthe
selectionset.Theseobjectswillnowbemappedwiththedefaultmapping
coordinatesuntilyouassignmappingcoordinatesagain.

Arguments
ssname
Theselectionsetthatcontainstheobjectsfromwhichyouwanttodetach
mappingcoordinates

Examples
Thefollowingcallpromptstheuserforentitiesthatwillbedetachedfrom
theirmappingcoordinates:
(c:setuv"D"(ssget))

saveimg
SavesarenderedimagetoafileinBMP,TGA,orTIFFformat
(Externallydefined:renderARXapplication)
(c:saveimgfilenametype[portion][xoffyoffxsizeysize][compression])
WhenAutoCADisconfiguredtorendertoaseparatedisplay,theportion
argumentshouldnotbeused.Youcanspecifyasizeandoffsetfortheimage
andforTGAandTIFFfiles,youcanspecifyacompressionscheme.

Arguments
Theargumentstosaveimgaredescribedinthefollowingtable:
+++++++++
|SAVEIMGfunctionarguments|||||
+++++++++
|Argument|Data|Description|Default|||||
||type|||||||
+++++++++
|||||filename|STR|Image|None|
|||||||file||
|||||||name||
+++++++++
|type|STR|Filetype:BMP,|None|||||
|||TGA,orTIFF||||||
+++++++++
|portion|STR|Portionofthe|"A"|||||
|||screento||||||
|||save:Aactive||||||
|||viewportDdrawing||||||
|||areaFfull||||||

|||screenNOTEThis||||||
|||argumentisnow||||||
|||ignored,butis||||||
|||providedfor||||||
|||script||||||
|||compatibility.||||||
+++++++++
|xoff|INT|Xoffsetinpixels|0|||||
+++++++++
|yoff|INT|Yoffsetinpixels|0|||||
+++++++++
|xsize|INT|Xsizeinpixels|Actual|||||
||||Xsize|||||
+++++++++
|ysize|INT|Ysizeinpixels|Actual|||||
||||Ysize|||||
+++++++++
|compression|STR|Compression|None|||||
|||scheme:NONE||||||
|||PACK(TIFFfiles||||||
|||only)||||||
|||RLE(TGAfiles||||||
|||only)||||||
+++++++++

Examples

ThefollowingexamplesavesafullscreenTIFFimagenamedtest.tif,without
compressingthefile:
(c:saveimg"TEST""TIF""NONE")

showmat
Liststhematerialtypeandattachmentmethodforaselectedobject
(Externallydefined:renderARXapplication)
(c:showmatarg1)
Thisfunctionliststhematerialtypeandattachmentmethodbasedonarg1.

Arguments
arg1
Canbeanentityname,anintegerrepresentinganACIvalue,oralayername(a
string).

rmat
Creates,edits,attaches,anddetachesrenderingmaterials(Externallydefined:
renderARXapplication)
(c:rmatmodeoptions)

Arguments
mode
Astring.Canbeoneofthefollowing:
AAttachesmaterial
CCopiesmaterial
DDetachesmaterial
LListsallmaterialsinthedrawingorreturnsadefinitionofthespecified
material
MModifiesmaterial
NCreatesnewmaterial

options
Theoptionsalloweddependonthemodespecified.
AAttachMaterial
The"A"(attach)modeletsyouattachamaterialtoselectedobjectsoranACI
(AutoCADColorIndex)value,dependingonwhetherthethirdargument
(layername)isanintegeroraselectionset.
(c:rmat"A"name[aci|selectionset|layername])

Arguments
Thefollowingtabledescribestheattacharguments.
++++
|Attacharguments|
++++
|Argument|Datatype|Description|
++++
|name|STR|Nameofthematerialtoattach|
++++
|aci|INT|ACInumberintherangeof0through255|
++++
|selectionset|INT|Selectionsetthatcontainstheentitiesto|
|||attach|
++++
|layername|STR|Nameofthelayer|
++++

Examples

AttachthematerialPURPLETIGERtotheACI1(red):
(c:rmat"A""PURPLETIGER"1)
Ifyouomitthethirdargument,the"A"modereturnsalistofthreeitems:
*Alistoflayernamesthematerialisattachedto
*AlistofACIsthematerialisattachedto
*Aselectionsetthatcontainstheobjectsthematerialisattachedto
Thefollowingexampleillustratesthevaluesreturnedwhenthethirdargument
isomitted:
Command:(c:rmat"a""twood")
Gatheringobjects...1found
LayernamesACI's
(("first""second")(135)<Selectionset12>))
Amaterialindexvalueintherange1255isanACInumberanindexgreater
than255indicatesanAutoCADRendermaterialnotassignedbyACI.
CCopyMaterial
Createsanewmaterialbycopyingonealreadypresentinthedrawing.
(c:rmat"C"cur_namenew_name)

Arguments
cur_name
Astringthatspecifiesthenameofthematerialtocopy.
new_name
Astringthatspecifiesthenameforthenewmaterial.

Examples
Modifyamaterialtochangeitsdefinition:
(c:rmat"C""RED""RED2")
DDetachMaterial
The"D"(detach)modeletsyoudetachamaterialfromselectedobjects,anACI
(AutoCADColorIndex)value,orlayers,dependingonwhetherthesecond

argument(selectionset)isaninteger,aselectionset,orastring.
(c:rmat"D"name[aci|selectionset|layername])

Arguments
Thefollowingtabledescribesthedetacharguments.
+++++
|Detacharguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Nameofthematerialtodetach|None|
+++++
|aci|INT|ACInumberintherangeof0|None|
|||through255||
+++++
|selectionset|INT|Selectionsetthatcontainsthe|None|
|||entitiestodetach||
+++++
|layername|STR|Nameofthelayer|None|
+++++

Examples

Prompttheusertoselectobjects,andthendetacheachobjectfromits
material:
(c:rmat"D"(ssget))
LListMaterial
Listsmaterialdefinitionsinthedrawing.
(c:rmat"L"[name])

Arguments
name
Astringthatspecifiesthematerialdefinitiontolist.Ifthenameargument
isomitted,c:rmatlistsallmaterialsinthedrawing.

Examples
Listallmaterialsinthedrawing:
Command:(c:rmat"L")
GLOBAL*""BLUEGLASS""WHITEPLASTIC""TWOOD""BEIGEMATTE")
Thefirststringinthelistspecifiesthedefaultglobalmaterial,*GLOBAL*.
Youcanpassthisstringtoc:rmatjustasyoucanpassthenamesoflibraryor
userdefinedmaterials,asdemonstratedinthefollowingexample:
Command:(c:rmat"L""*GLOBAL*")
("*GLOBAL*""STANDARD"(1.01.01.0)0.7(""0.00(1.01.0)(0.0
0.0)0.000)(1.01.01.0)0.1(1.01.01.0)0.2(""0.00)
0.50.0(""0.00(1.01.0)(0.00.0)0.000)1.0(""0.00(1.0
1.0)(0.00.0)0.000))
Thelistitemsinamaterialdefinitionarethesameastheargumentstothe
ModifyorNewmodes.
MModifyMaterial
Theoptionsforthe"M"(modify)modearethesameasforthe"N"(new)mode.
Ifanargumentisnil,orisomittedfromtheendoftheargumentlist,the
propertyaffectedbytheargumentretainsitscurrentvalue.
Forexample,thefollowingcallchangesBLUEMARBLEtohaveamediumbluestone
(matrix)colorandblackveins:
(c:rmat"M""BLUEMARBLE""marble"'(0.50.51.0)'(0.00.00.0))
NNewMaterial
The"N"(new)modecreatesanewmaterial.Theargumentstothisfunction
dependnotonlyonthemode,butalsoonthetypeofmaterialyou'recreating.
Theproceduralmaterialsmarble,granite,andwoodhaveauniquesetof
arguments,eachofwhichdiffersfromthestandardmaterialarguments.

Arguments

Thefollowingtabledescribesthenewarguments:
+++++
|Newarguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Nameofthematerialtocreate|None|
+++++
|materialtype|STR|Typeofnewmaterial.Theoptions|None|
|||are:STANDARDstandardmaterial||
|||MARBLEmarblematerial||
|||GRANITEgranitematerial||
|||WOODwoodmaterial||
+++++
|description|(Varies)|Argumentsdependonthetypeof|(Varies)|
|||materialyou'recreating||
+++++
|selectionset|INT|Selectionsetthatcontainsthe|None|
|||entitiestodetach||
+++++
|layername|STR|Nameofthelayer|None|
+++++
Inaddition,theargumentsforeachkindofbitmaparespecifiedinasublist
asdescribedunderBitmapArguments.
Standard
Thematerialtypestring"STANDARD"indicatesyou'recreatinganewstandard
material.
(c:rmat"N"name"STANDARD"[color[colorweight[pattern
[ambient[ambweight[ref1[ref1weight[ref1map[roughness[transparency
[opacitymap[refraction[bumpmap]]]]]]]]]]]]])

Arguments
Thefollowingtabledescribesthestandardarguments:
+++++
|Standardarguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|color|LIST(or|MaterialcolorasanRGB|(1.01.0|
||reals)|triple(1.01.01.0)|1.0)ByACI|
|||meansderivethecolor||
|||fromanobject'sACI||
|||(diffusecolor)||
+++++
|colorweight|REAL|Weightfactor(color|0.7|
|||Value)theamountof||
|||diffusecolor||
+++++
|pattern|LIST|Pattern/texturemap|None|
|||arguments||
+++++
|ambient|LIST(or|Ambient(shadow)coloras|(1.01.0|
||reals)|anRGBtriple|1.0)ByACI|
+++++
|ambweight|REAL|Weightfactor(ambient|0.1|
|||Value)theamountof||
|||specularcolor||
+++++
|refl|LIST(or|Reflection(specular)|(1.01.0|
||reals)|colorasanRGBtriple|1.0)ByACI|
+++++
|reflweight|REAL|Weightfactor(reflection|0.2|
|||Value)theamountof||
|||specularcolor||
+++++
|reflmap|LIST|Reflection/environment|None|
|||maparguments||
+++++
|roughness|REAL|Roughnessthesizeofa|0.5|
|||specularhighlight||
+++++
|transparency|REAL|Transparencyofthe|0.0|
|||material||
+++++
|opacitymap|LIST|Opacitymaparguments|None|
+++++
|refraction|REAL|Indexofrefraction|1.0|

+++++
|bumpmap|LIST|Bumpmaparguments|None|
+++++

Examples

Thefollowingcallcreatesashinyredmaterialwithapatternmap:
(c:rmat"N""REDLACQUER""STANDARD"Nameandtype
'(1.00.00.0)(1.0)Color(red),weight,andtexturemap
'("INLAY.TGA"0.750(0.50.5)(0.30.3)0.001)
'(1.00.00.0)1.0Ambientcoloranditsweight(sameasdiffuse)
'(1.00.00.0)1.0Reflectioncolor(white)anditsweight
nilNoreflectionmap
0.2Roughness(low)
0.0Transparency(none)
nilNoopacitymap
0.0Refraction(none)
nilNobumpmap
Thenextcallcreatesamaterial,MAPS,thatusesmultiplebitmaps:
(c:rmat"N""MAPS""STANDARD"
'(1.00.00.0)(1.0)'("weave.tga"1.00)
'(1.00.00.0)1.0
'(1.00.00.0)1.0'("room.tga"0.75)
0.5
0.0
'("hole.tga")
1.0
'("ridges.tga")
Thefollowingcallcreatesamaterialwithnobitmapsanddefaultvalues,with
reflectionsthataregeneratedbyraytracingwhenrenderedwithPhotoRaytrace
orwithenvironmentmapwithPhotoReal:
(c:rmat"N""SHINE""STANDARD"nilnilnilnilnilnilnil
'(nilnil1))
Marble
Thematerialtypestring"MARBLE"indicatesthatyouarecreatinganewmarble
material.
(c:rmat"N"name"MARBLE"[stonecolor[veincolor[refl[reflweight[reflmap
[roughness[turbulence[sharpness[scale[bumpmap]]]]]]]]]])

Arguments
Thefollowingtabledescribesthemarblearguments:
+++++
|RMATMarblearguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|stonecolor|LIST(of|RGBvaluespecifyingthe|(1.01.0|
||reals)|mainmatrixcolorofthe|1.0)white|
|||marble||
+++++
|veincolor|LIST(of|RGBvaluespecifyingthe|(1.01.0|
||reals)|veincolorofthemarble|1.0)black|
+++++
|refl|LIST(of|Reflection(specular)|(1.01.0|
||reals)|colorasanRGBvalue|1.0)ByACI|
+++++
|reflwgt|REAL|Weightfactor(reflection|0.2|

|||Value)theamountof||
|||specularcolor||
+++++
|reflmap|LIST|Reflection/environment|None|
|||maparguments||
+++++
|roughness|REAL|Roughnessthesizeofa|0.5|
|||specularhighlight||
+++++
|turbulence|INT|Turbulence|3|
|||factorswirlinessofthe||
|||veins||
+++++
|sharpness|REAL|Sharpnessfactorthe|1.0|
|||amountofblur||
+++++
|scale|REAL|Overallscalefactor|0.16|
+++++
|bumpmap|LIST|Bumpmaparguments|None|
+++++

Examples

Thefollowingcallcreatesamarblewithapinkmatrixandblackveins:
(c:rmat"N""PINKMARBLE""MARBLE"'(1.00.340.79))
Granite
Thematerialtypestring"GRANITE"indicatesthatyou'recreatinganewgranite
material.
(c:rmat"N"name"GRANITE"[firstcolor[amount1[secondcolor[amount2
[thirdcolor[amount3[fourthcolor[amount4[refl[reflweight[reflmap
[roughness[sharpness[scale[bumpmap]]]]]]]]]]]]]]])

Arguments
Thefollowingtabledescribesthegranitearguments:
+++++
|RMATGranitearguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|firstcolor|LIST(of|RGBvalue|(1.01.0|
||reals)||1.0)white|
+++++
|amount1|REAL|Weightfactor(color|1.0|
|||Value)forfirstcolor||
+++++
|secondcolor|LIST(of|RGBvalue|(0.50.5|
||reals)||0.5)darkgray|
+++++
|amount2|REAL|Weightfactor(color|1.0|
|||Value)forsecondcolor||
+++++
|thirdcolor|LIST(of|RGBvalue|(0.00.0|
||reals)||0.0)black|
+++++
|amount3|REAL|Weightfactor(color|1.0|
|||Value)forthirdcolor||
+++++
|fourthcolor|LIST(of|RGBvalue|(0.70.7|
||reals)||0.7)light|
||||gray|
+++++
|amount4|REAL|Weightfactor(color|1.0|
|||Value)forfourthcolor||
+++++
|refl|LIST(of|Reflection(specular)|(1.01.0|
||reals)|colorasanRGBvalue|1.0)ByACI|
+++++
|reflweight|REAL|Weightfactor|0.2|
|||(reflectionValue)the||
|||amountofspecularcolor||
+++++
|reflmap|LIST|Reflection/environment|None|
|||maparguments||
+++++
|roughness|REAL|Roughnessthesizeofa|0.5|
|||specularhighlight||
+++++
|sharpness|REAL|Sharpnessfactorthe|1.0|
|||amountofblur||

+++++
|scale|REAL|Overallscalefactor|0.16|
+++++
|bumpmap|LIST|Bumpmaparguments|None|
+++++

Examples

Createagranitewithoutdarkgray,withmoreblack,andwithyellowinsteadof
lightgray:
(c:rmap"N""YELLOWGRANITE"
nil0.5nil0.0nil0.85'(1.01.00.0)0.6)
Wood
Thematerialtypestring"WOOD"indicatesthatyou'recreatinganewwood
material.
(c:rmat"N"name"WOOD"[lightcolor[darkcolor[refl[reflweight[reflmap
[roughness[ratio[density[width[shape[bumpmap]]]]]]]]]]])

Arguments
Thefollowingtabledescribesthewoodarguments:
+++++
|RMATWoodarguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|lightcolor|LIST(of|RGBvaluespecifyingthe|(0.60.40.3)|
||reals)|colorofthelightrings||
+++++
|darkcolor|LIST(of|RGBvaluespecifyingthe|(0.30.2|
||reals)|colorofthedarkrings|0.2)black|
+++++
|refl|LIST(of|Reflection(specular)|(1.01.0|
||reals)|colorasanRGBvalue|1.0)ByACI|
+++++
|reflweight|REAL|Weightfactor(reflection|0.2|
|||Value)theamountof||
|||specularcolor||
+++++
|reflmap|LIST|Reflection/environment|None|
|||maparguments||
+++++
|roughness|REAL|Roughnessthesizeofa|0.5|
|||specularhighlight||
+++++
|ratio|REAL|Ratiooflighttodark|0.5|
|||rings||
+++++
|density|REAL|Densityoftherings|6.0|
+++++
|width|REAL|Ringwidthvariation|0.2|
+++++
|shape|REAL|Ringshapevariation|0.2|
+++++
|scale|REAL|Overallscalefactor|0.16|
+++++
|bumpmap|LIST|Bumpmaparguments|None|
+++++

Examples

Createawoodwithanirregulargrain:
(c:rmat"N""CRYPTO""WOOD"nilnilnilnilnilnilnilnilnil0.56)
BitmapArguments
Theargumentstospecifyabitmaparepassedtoalist,whichyoucaninclude
asasublistinthec:rmatcall(thisistheformshownatthebeginningof
eachofthefollowingsections)orassigntoasymbolbeforeyoucallc:rmat.
Pattern/Texture
'(name[blend[repeat[scale[offset[reserved[mapstyle[autoaxis]]]]]]])

Arguments
Thefollowingtabledescribesthepattern/texturearguments:
+++++

|Pattern/texturearguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Nameofthebitmapfile|None|
+++++
|blend|REAL|Amountofmapcolortouse|1.0|
+++++
|repeat|INT|Whethertorepeat(tile)the|0|
|||bitmap:0notiling(crop)||
|||1tile(repeatpattern)||
+++++
|scale|LIST(of|UandVscalefactors|(1.01.0)|
||reals)|||
+++++
|offset|LIST(of|UandVoffsets|(0.00.0)|
||reals)|||
+++++
|reserved|REAL|Reservedplaceholder|None|
+++++
|mapstyle|INT|Whetherthemapstyle|0|
|||is:0fixedscale1fitto||
|||entity||
+++++
|autoaxis|INT|WhetherornotAutoAxisis|1|
|||enabled:0disabled1enabled||
+++++
Reflection/Environment
'(name[blend[raytrace]])

Arguments
Thefollowingtabledescribesthereflection/environmentarguments:
+++++
|Reflection/environmentarguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Nameofthebitmapfile|None|
+++++
|blend|REAL|Amountofmapcolorto|1.0|
|||use||
+++++
|mirror|REAL|Whethertogenerate|0|
|||mirrored||
|||reflections:0no||
|||mirror||
|||1mirrorDuring||
|||mirror,generates||
|||raytracedreflections||
|||duringscanline,uses||
|||environmentmapfor||
|||reflections||
+++++
Opacity
'(name[blend[repeat[scale[offset[reserved[mapstyle[autoaxis]]]]]]])

Arguments
Thefollowingtabledescribestheopacityarguments:
+++++
|Opacityarguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Nameofthebitmapfile|None|
+++++
|blend|REAL|Amountofmapcolortouse|1.0|
+++++
|repeat|INT|Whethertorepeat(tile)the|0|
|||bitmap:0notiling(crop)||
|||1tile(repeatpattern)||
+++++
|scale|LIST(of|UandVscalefactors|(1.01.0)|
||reals)|||
+++++
|offset|LIST(of|UandVoffsets|(0.00.0)|
||reals)|||
+++++
|reserved|REAL|Reservedplaceholder|None|

+++++
|mapstyle|INT|Whetherthemapstyle|0|
|||is:0fixedscale1fittoentity||
+++++
|autoaxis|INT|WhetherornotAutoAxisis|1|
|||enabled:0disabled1enabled||
+++++
BumpMap
'(name[amplitude[repeat[scale[offset[reserved[mapstyle
[autoaxis]]]]]]])
Thefollowingtabledescribesthebumparguments:
+++++
|Bumparguments|
+++++
|Argument|Datatype|Description|Default|
+++++
|name|STR|Nameofthebitmapfile|None|
+++++
|amplitude|REAL|Degreeofbumpiness|1.0|
+++++
|repeat|INT|Whethertorepeat(tile)the|0|
|||bitmap:0notiling(crop)||
|||1tile(repeatpattern)||
+++++
|scale|LIST(of|UandVscalefactors|(1.01.0)|
||reals)|||
+++++
|offset|LIST(of|UandVoffsets|(0.00.0)|
||reals)|||
+++++
|reserved|REAL|Reservedplaceholder|None|
+++++
|mapstyle|INT|Whetherthemapstyle|0|
|||is:0fixedscale1fittoentity||
+++++
|autoaxis|INT|WhetherornotAutoAxisis|1|
|||enabled:0disabled1enabled||
+++++

solprof
Createsprofileimagesofthreedimensionalsolids(Externallydefined:solids
ARXapplication
(c:solprofargs...)

Arguments
args
Theorder,number,andtypeofargumentsarethesameasthosespecifiedwhen
issuingSOLPROFattheCommandprompt.

Das könnte Ihnen auch gefallen