Obtaining an ActiveX Property with vlax-get-property

AutoCAD AutoLISP & Visual LISP

 
Obtaining an ActiveX Property with vlax-get-property
 
 
 

The vlax-get-property function returns the property of an object. The function requires the following arguments:

  • A VLA-object identifying the object whose property you are interested in
  • A symbol or string naming the property to be retrieved

For example, there is no wrapper function available to obtain the CommandBars property of an Microsoft Word application object, but the following command achieves this:

_$ (setq ComBars (vlax-get-property
msw 'CommandBars))
#<VLA-OBJECT CommandBars 0016763c>

You can use vlax-get-property (and vlax-invoke-method and vlax-put-property) even if a wrapper function is available for the task. For example, the following returns the AutoCAD's ActiveDocument property:

_$ (vlax-get-property
acadObject 'ActiveDocument)
#<VLA-OBJECT IAcadDocument 00302a18>

In this instance, you could have instead used vla-get-ActiveDocument to obtain the ActiveDocument property.