Using ActiveX Methods That Return Values in Arguments

Some ActiveX methods require that you supply them with variables into which the methods can place values. The GetBoundingBox method is an example of this type of method. Here is how it is defined in the ActiveX and VBA Reference:

Note that the MinPoint and MaxPoint parameters are described as output only. You must provide output arguments as quoted variable names. The following example shows a VLISP function call to return the minimum and maximum bounding points of a circle:

_$ (vla-getboundingbox
myCircle 'minpoint 'maxpoint)

The values output by vla-getboundingbox are stored in the minpoint and maxpoint variables as safearrays of three doubles. You can view the values using vlax-safearray->list:

_$ (vlax-safearray->list
(1.0 1.0 -1.0e-008)
_$ (vlax-safearray->list
(5.0 5.0 1.0e-008)

Note that the quoted symbol parameters you pass to the function become AutoLISP variables just like the ones created through setq. Because of this, you should include them as local variables in your function definition so they do not become global variables by default.