Calling an ActiveX Method with vlax-invoke-method

AutoCAD AutoLISP & Visual LISP

 
Calling an ActiveX Method with vlax-invoke-method
 
 
 

The vlax-invoke-method function calls an ActiveX method directly. The function requires the following arguments:

  • The VLA-object the method is to work on
  • A symbol or string naming the method to be called
  • One or more arguments to be passed to the method

The return value from vlax-invoke-method depends on the method being invoked.

For example, the following invokes the AddCircle method to draw a circle in the model space (represented by the mspace variable) of the current AutoCAD drawing:

_$ (setq mycircle 
           (vlax-invoke-method
mspace 'AddCircle circCenter 3.0))
    
#<VLA-OBJECT IAcadCircle 00bfd6e4>

In this example, circCenter is a variant (containing a three-element array of doubles) identifying the center of the circle, and 3.0 is the radius of the circle. The method returns a VLA-object, the circle drawn.