Wednesday, September 12, 2012

Visual LISP and ActiveX/VBA Comparison

The following table compares AutoLISP/Visual LISP functions in AutoCAD with the similar ActiveX, VBA, and Visual Basic 6 functions and operators. The ActiveX Automation equivalents are indicated by “AutoCAD.Application.” and the Visual Basic 6 equivalents are listed as a function or operator. This chart can be useful when you jump between working in different languages as well as if you know one of them and want to learn the other.

AutoLISP function ActiveX, VBA, or Visual Basic 6 equivalent
+ (addition) + (addition operator)
- (subtraction) - (subtraction operator)
* (multiplication) * (multiplication operator)
/ (division) / (division operator)
= (equal to) = (equal to comparison operator)
/= (not equal to) <> (not equal to comparison operator)
< (less than) < (less than comparison operator)
<= (less than or equal to) <= (less than or equal to comparison operator)
> (greater than) > (greater than comparison operator)
>= (greater than or equal to) >= (greater than or equal to comparison operator)
~ (bitwise not) Not operator
1+ (increment) Use + (addition operator)
1- (decrement) Use - (subtraction operator)
abs Abs function
acad_colordlg Not provided
acad_helpdlg Search for HELP in the online Help index
acad_strlsort Search for SORT in the online Help index
action_tile Use the Dialog Editor
add_list Use the Dialog Editor
ads AutoCAD.Application.ListADS method
alert MsgBox function
and And operator
angle AutoCAD.Application.ActiveDocument.Utility.
AngleFromXAxis method
angtof AutoCAD.Application.ActiveDocument.Utility.
AngleToReal method
angtos AutoCAD.Application.ActiveDocument.Utility.
AngleToString method
append Use array manipulation functions
apply Not provided
arx AutoCAD.Application.ListARX method
arxload AutoCAD.Application.LoadARX method
arxunload AutoCAD.Application.UnloadARX method
ascii Asc function
assoc Not provided
atan Atn function
atof CDbl Function
atoi CInt Function
atom Search for IS in the online Help index
atoms-family Not provided
autoarxload Not provided
autoload Not provided
Boole Use logical operators
boundp Search for IS in the online Help index
car/cdr Use array manipulation functions
chr Chr function
client_data_tile Use the Dialog Editor
close AutoCAD.Application.Documents.Close method
command AutoCAD.ActiveDocument.SendCommand method
cond Select Case statement
cons Use array manipulation functions or AutoCAD.Application.collection.Add<entityname> method
cos Cos function
cvunit Use the conversion functions
defun The keywords Function and End Function
dictadd AutoCAD.Application.ActiveDocument.Dictionaries.
Add method
dictnext AutoCAD.Application.ActiveDocument.Dictionaries.
Item method
dictremove AutoCAD.Application.ActiveDocument.Dictionaries.
Dictionary.Delete method
dictrename AutoCAD.Application.ActiveDocument.Dictionaries.
Dictionary.Rename method
dictsearch AutoCAD.Application.ActiveDocument.Dictionaries.
Dictionary.GetName and GetObject methods
dimx_tile and dimy_tile Use the Dialog Editor
distance AutoCAD.Application.Utility.
GetDistance for interactive method.
distof Not provided
done_dialog Use the Dialog Editor
end_image Use the Dialog Editor
end_list Use the Dialog Editor
entdel AutoCAD.Application.ActiveDocument.
collection_object.Delete method
entget AutoCAD.Application.ActiveDocument.
collection_object.property properties
entlast AutoCAD.Application.ActiveDocument.Modelspace.
Item(count-1)
entmake AutoCAD.Application.ActiveDocument.Modelspace.
Add<entityname> method
entmakex AutoCAD.Application.ActiveDocument.Modelspace.
Add<entityname> method
entmod Use any of the read-write properties for the object
entnext AutoCAD.Application.ActiveDocument.collection.
Item method
entsel AutoCAD.Application.ActiveDocument.SelectionSets object/methods/properties
entupd AutoCAD.Application.ActiveDocument.Modelspace.
object.Update method
eq Not provided
equal Eqv operator
*error* Error object/method/properties
eval Not provided
exit AutoCAD.Application.Quit method
exp Exp function
expand Not provided
expt ^ (exponentiation operator)
fill_image Use the Dialog Editor
findfile Dir function
fix Fix, Int, Cint functions
float CDbl Function
foreach For Each...Next statement
gc AutoCAD.Application.ActiveDocument.PurgeAll
gcd Not provided
get_attr Use the Dialog Editor
get_tile Use the Dialog Editor
getangle AutoCAD.Application.ActiveDocument.Utility.
GetAngle method
getcfg AutoCAD.Application.Preferences.property property
getcname Not provided
getcorner AutoCAD.Application.ActiveDocument.Utility.
GetCorner method
getdist AutoCAD.Application.ActiveDocument.Utility.
GetDistance method
getenv AutoCAD.Application.Preferences.property property
getfiled Use the file dialog
getint AutoCAD.Application.ActiveDocument.Utility.
GetInteger method
getkword AutoCAD.Application.ActiveDocument.Utility.
GetKeyword method
getorient AutoCAD.Application.ActiveDocument.Utility.
GetOrientation method
getpoint AutoCAD.Application.ActiveDocument.Utility.
GetPoint method
getreal AutoCAD.Application.ActiveDocument.Utility.
GetReal method
getstring AutoCAD.Application.ActiveDocument.Utility.
GetString method
getvar AutoCAD.Application.GetVariable method
graphscr AppActivate AutoCAD.Application.Caption
grclear Obsolete function
grdraw Not provided
grread Not provided
grtext AutoCAD.Application.ActiveDocument.Utility.Prompt
grvecs Not provided
handent AutoCAD.Application.ActiveDocument.ModelSpace.
object.Handle property
help Search for HELP in the online Help index
if If… Then… Else statement
initget AutoCAD.Application.ActiveDocument.Utility.
InitializeUserInput
inters AutoCAD.Application.ActiveDocument.Modelspace.
object.IntersectWith
itoa Str function
lambda Not provided
last arrayname(UBound(arrayname))
length UBound function
list ReDim statement
listp IsArray function
load_dialog Use the Dialog Editor
load AutoLISP is not supported through Automation
log Log function
logand And function
logior Or function
lsh Imp function
mapcar Not provided
max Max function
mem Not provided
member Use collection
menucmd AutoCAD.Application.MenuBar object
menugroup AutoCAD.Application.MenuGroup object
min Min function
minusp Use < 0 syntax
mode_tile Use the Dialog Editor
namedobjdict AutoCAD.Application.ActiveDocument.Dictionaries collection
nentsel AutoCAD.Application.ActiveDocument.SelectionSets.
SelectionSet.SelectAtPoint method
nentselp AutoCAD.Application.ActiveDocument.SelectionSets.
SelectionSet.SelectAtPoint method
new_dialog Use the Dialog Editor
not Use the logical operators
nth Use object(n) syntax
null IsNull function
numberp TypeName function
open Open function
or Use the logical operators
osnap Not provided (You can use the SetVariable method to control the OSMODE system variable.)
polar AutoCAD.Application.ActiveDocument.Utility.
PolarPoint method
prin1 AutoCAD.Application.ActiveDocument.Utility.Prompt
princ AutoCAD.Application.ActiveDocument.Utility.Prompt
print AutoCAD.Application.ActiveDocument.Utility.Prompt
progn Not provided
prompt AutoCAD.Application.ActiveDocument.Utility.Prompt
quit AutoCAD.Application.Quit method
quote Not provided
read Not provided
read-char Input function
read-line Line Input function
redraw AutoCAD.Application.ActiveDocument.Modelspace.
object.Update method
regapp AutoCAD.Application.ActiveDocument.
RegisteredApplications.Add method
rem Mod function
repeat For… Each, While,
reverse Not provided
rtos AutoCAD.Application.ActiveDocument.Utility.
RealToString method
set Set function
set_tile Use the Dialog Editor
setcfg AutoCAD.Application.Preferences.property property
setfunhelp Not provided
setq Set function
setvar AutoCAD.Application.SetVariable method
sin Sin function
setview AutoCAD.Application.ActiveDocument.Viewports.
Viewport.SetView method
slide_image Use the Dialog Editor
snvalid Not provided
sqrt Sqr function
ssadd AutoCAD.Application.ActiveDocument.SelectionSets.
Add method
ssdel AutoCAD.Application.ActiveDocument.SelectionSets.
SelectionSet.Delete method
ssget AutoCAD.Application.ActiveDocument.SelectionSets.
SelectionSet.SelectOnScreen method
ssgetfirst Not provided
sslength AutoCAD.Application.ActiveDocument.SelectionSets.
SelectionSet.Count method
ssmemb Compare ID of object with the SelectionSet members
ssname AutoCAD.Application.ActiveDocument.SelectionSets.
SelectionSet.Name property
ssnamex Not provided
sssetfirst AutoCAD.Application.ActiveDocument.
PickfirstSelectionSet
startapp Shell function
start_dialog Use the Dialog Editor
start_image Use the Dialog Editor
start_list Use the Dialog Editor
strcase StrConv function
strcat & operator
strlen Len function
subst Not provided
substr Mid function
tablet Not provided
tblnext AutoCAD.Application.ActiveDocument.
collection_object.Item method
tblobjname AutoCAD.Application.ActiveDocument.
collection_object.Name method
tblsearch AutoCAD.Application.ActiveDocument.
collection_object.Name method
term_dialog Use the Dialog Editor
terpri Not provided
textbox AutoCAD.Application.ActiveDocument.space.object.
GetBoundingBox method
textpage Not provided
textscr Not provided
trace Not provided
trans AutoCAD.Application.ActiveDocument.Utility.
TranslateCoordinates method
type TypeName function
unload_dialog Use the Dialog Editor
untrace Not provided
vector_image Use the Dialog Editor
ver AutoCAD.Application.Version property
vports AutoCAD.Application.ActiveDocument.
Viewports collection
wcmatch Like operator
while While… Wend
write-char Print function
write-line Print function
xdroom Not provided
xdsize Not provided
zerop Use = 0 syntax

Source: AutoCAD 2013 Active X Developer’s Guide on AutoCAD Developer Center. To utilize the documentation with the VBA IDE or Visual LISP IDE, download and extract the contents of the ZIP file to the following location: C:\Program Files\Common Files\Autodesk Shared


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner