About Using Object Reactors (AutoLISP/ActiveX)

Unlike other AutoCAD 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 to which the reactor is to be attached. The vlr-object-reactor function, which creates object reactors, requires the following arguments:

Caution: You cannot modify an object with the callback function if it is included in the object reactor's owner list. Attempts to do so will generate an error message and can cause AutoCAD to fail.

For example, the following statement defines an object reactor with a single owner (the object identified by myCircle), then attaches the string “Circle Reactor” to the reactor and tells AutoCAD to invoke the print-radius function when a user modifies myCircle:

(setq circleReactor (vlr-object-reactor (list myCircle)
  "Circle Reactor" '((:vlr-modified . print-radius))))

The reactor object is stored in variable circleReactor; you can refer to the reactor using this variable. When 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. You can convert these Ename objects into VLA-objects using the vlax-ename->vla-object function.

Attaching Data to Reactor Objects

Data can be attached to an object reactor when it is created with vlr-object-reactor, or you can change the data later using vlr-data-set.

You do not have to specify any data to be included with the reactor; you can specify nil instead. However, an object may have several reactors attached to it. You can include an identifying text string, or other data your application can use, to allow you to distinguish among the different reactors attached to an object.