Creates an object reactor that displays a message when the object is modified.
; Define the callback function to use for the reactor ; The following function prints a message with the circle’s radius (defun print-radius (notifier-object reactor-object parameter-list) (vl-load-com) (cond ( (vlax-property-available-p notifier-object "Radius" ) (princ "The radius is ") (princ (vla-get-radius notifier-object)) ) ) ) ; Create a variable to hold the circle object that ; will be used as the owner of the reactor (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 ) ) ) ; Create the reactor and pass it the circle object, ; application-specific data, and callback function. (if (= circleReactor nil) (setq circleReactor (vlr-object-reactor (list myCircle) "Circle Reactor" '((:vlr-modified . print-radius)))) )
You should see a message after the STRETCH option’s prompt that is similar to the following:
Specify stretch point or [Base point/Copy/Undo/eXit]: The radius is 3.75803