About Calling an ActiveX Method (AutoLISP/ActiveX)


Once you identify the ActiveX method you need, you must determine how to make the call with AutoLISP. You need to know the arguments to specify and the data type of those arguments.

NoteActiveX support in AutoLISP is limited to Windows only.

The ActiveX and VBA Reference contains the information required for using ActiveX methods.

For example, the AddCircle method reference page shows the definition for this method.

AddCircle Method Signature

RetVal = object.AddCircle(Center, Radius)

Circle object; return value

The newly created Circle object.


Block, ModelSpace Collection, PaperSpace Collection

The objects this method applies to.


Variant (three-element array of doubles); input-only

The 3D WCS coordinates specifying the circle's center.


Double; input-only

The radius of the circle. Must be a positive number.

The syntax definitions in the reference were designed for VBA programmers, so they may take some getting used to.

For AddCircle, the syntax is defined as follows:

RetVal = object.AddCircle(Center, Radius)

The AutoLISP syntax required for the same operation is:

(setq RetVal (vla-AddCircle object center radius))

The return value (RetVal, in VBA) is straightforward. The ActiveX and VBA Reference defines this as a Circle object. In Visual LISP, whenever an AutoCAD object is returned by an ActiveX function, it is returned as a VLA-object data type.

The object referred to before the method name (object.AddCircle) is always the first argument in a vla function call. This is the AutoCAD object you are querying or modifying. For example, add a circle to the drawing model space with the following:

(vla-addCircle mSpace ...)

In this example, mspace refers to the ModelSpace object. The ModelSpace object provides access to the model space of the current drawing.

The Center and Radius arguments refer to data types that may be unfamiliar to AutoLISP programmers. Center must be expressed as an array, which is similar to a three element list in AutoLISP. Radius is double data type, which is a real number in AutoLISP.