vlr-object-reactor function, which creates object reactors, requires the following arguments:
Unlike other AutoCAD reactors, object reactors are attached to specific AutoCAD entities (objects). When you define an object reactor, you must identify the entity to which the reactor is to be attached. ThemyCircle), then attaches the string “Circle Reactor†to the reactor and tells AutoCAD to invoke the print-radius function when a user modifies myCircle:
For example, the following statement defines an object reactor with a single owner (the object identified by(setq circleReactor (vlr-object-reactor (list myCircle)
"Circle Reactor" '((:vlr-modified . print-radius))))
circleReactor; you can refer to the reactor using this variable, as described in Querying, Modifying, and Removing Reactors.
The Reactor object is stored in variableWhen defining a list of owners, you must specify VLA-objects only; Ename objects are not allowed. VLA-objects are required because callback functions can only use ActiveX methods to modify AutoCAD objects, and ActiveX methods require a VLA-object to work on.
entlast and entget with callback reactors, you can convert these Ename objects into VLA-objects using the vlax-ename->vla-object function. See the AutoLISP Reference for more information on vlax-ename->vla-object.
Note that, although you cannot use objects obtained through functions such asTo see how an object reactor works
(setq myCircle
; Prompt for the center point and radius:
(progn (setq ctrPt
(getpoint "\nCircle center point: ")
radius (distance ctrPt
(getpoint ctrpt "\nRadius: ")
)
)
; Add a circle to the drawing model space. Nest the function
; calls to obtain the path to the current drawing's model
; space: AcadObject > ActiveDocument > ModelSpace
(vla-addCircle
(vla-get-ModelSpace
(vla-get-ActiveDocument (vlax-get-acad-object))
)
(vlax-3d-point ctrPt)
radius
)
)
)
vla-addCircle to draw a circle, assigning the return value to variable myCircle. The return value is a VLA-object, which contains a pointer to the Circle object drawn.
This code uses(setq circleReactor (vlr-object-reactor (list myCircle)
"Circle Reactor" '((:vlr-modified . print-radius))))
Specify stretch point or [Base point/Copy/Undo/eXit]: The radius is 3.75803