Functions that update properties are prefixed with vla-put and use the following syntax:
(vla-put-propertyobjectnew-value)
vla-put-center changes the center point of a circle.
For example,To change the X axis of a circle
_$ (setq myCenter (vla-get-center myCircle))
#<variant 8197
The center point is returned in a variant of type safearray. The safearray contains three doubles (X, Y, and Z coordinates).
$ (setq centerpt (vlax-safearray->list
(vlax-variant-value myCenter)))
(17.8685 5.02781 0.0)
Converting the center point from a variant safearray to a list makes it easier to modify the coordinates.
_$ (setq newXaxis (- (car centerpt) 1))
16.8685
newXaxis.
The result is saved in variable_$ (setq newcenter (list newXaxis (cadr centerpt)
(caddr centerpt)))
(16.8685 4.52594 0.0)
newcenter.
The constructed list is saved in variable_$ (vla-put-center myCircle (vlax-3d-point newcenter))
nil
vlax-3d-point to convert the new center point list into the data type required by vla-put-center.
Note that this command usesThe AutoCAD drawing window shows the result:
vla-update function:
Note that changing an object's property may not immediately affect the display of the object in the AutoCAD drawing. AutoCAD delays property changes to allow you to change more than one property at a time. If you need to update the drawing window explicitly, issue the(vla-update object)
acRed instead of specifying a numeric index value:
Sometimes you can use pre-defined constants to update an object's property. For example, to set the fill color of a circle to red, you can use the constant(vla-put-color myCircle acRed)
The ActiveX and VBA Reference lists any predefined constants under the entry describing the property. You can use these constants in VLISP ActiveX function calls.