Share
 
 

About Defining Object Reactor Callback Functions (AutoLISP/ActiveX)

Unlike other reactors, object reactors are attached to specific AutoCAD entities (objects).

Note: ActiveX support in AutoLISP is limited to Windows only.

When you define an object reactor, you must identify the entity the reactor is to be attached to. So callback functions for object reactors must be defined to accept three arguments:

  • The first argument identifies the object that fired the notification.
  • The second argument identifies the Reactor object that called the function.
  • The third argument is a list of parameters specific to the callback condition.

For example, the following code defines a callback function named print-radius. This function can be used to print the radius of a circle:

(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))
    )
  )
)

The code uses the vlax-property-available-p function to verify that the drawing object that notified this function contains a Radius property

Was this information helpful?