Understanding the ActiveX Code in gp:drawOutline
 
 
 

The gp:drawOutline function issues ActiveX calls to display the path's polyline border in AutoCAD. The following code fragment uses ActiveX to draw the border:

;; Add polyline to the model space using ActiveX automation.
(setq pline   (vla-addLightweightPolyline
*ModelSpace*  ; Global Definition for Model Space
VLADataPts	 ; vertices of path boundary
) ;_ end of vla-addLightweightPolyline
  ) ;_ end of setq
(vla-put-closed pline T)

How do you make sense of this code? An essential resource is the ActiveX and VBA Reference, which describes the methods and properties accessible to ActiveX clients such as this garden path application. The “Working with ActiveX” section of the AutoLISP Developer's Guide explains how to translate the VBA™ syntax in the ActiveX and VBA Reference into ActiveX calls in AutoLISP syntax.

For the moment, though, you can gain a rudimentary understanding by scrutinizing the pattern of the two vla- calls in the preceding example. The names of all AutoLISP ActiveX functions that work on AutoCAD objects are prefixed with vla-. For example, addLightweightPolyline is the name of an ActiveX method, and vla-addLightweightPolyline is the AutoLISP function that invokes this method. The vla-put-closed call updates the closed property of the pline object, the polyline drawn by vla-addLightweightPolyline.

The Automation objects that factor into AutoLISP ActiveX calls abide by a few standard rules: