Types of Object Reactors

There are two types of reactors, transient reactors and persistent reactors. If you want your program to receive event notification, you usually use transient reactors, which monitor events that happen to database objects. They can also monitor database events, user interactions, and other system events while an application is running.

Another kind of reactor, called a persistent reactor, uses a database object (an instance of AcDbObject or a derived class) as a reactor. Database objects can receive as well as send notification. Persistent reactor dependencies within the database are part of the database, so they are preserved in DWG and DXF files and are reestablished when a drawing is loaded.

To use an AcDbObject as a reactor

  1. Derive a new AcDbObject class and implement the notification functions for the events your object will respond to.
  2. Instantiate the object reactor.
  3. Add the object reactor to the database and give it an owner, preferably a container object, so that it is filed out correctly.
  4. Add the object reactor to the notifier's reactor list using the addPersistentReactor() function. This function requires that you pass in the object ID of the object reactor you created in step 2.

AutoCAD deletes the object reactor, because it is a database object.

Note: When you copy an object, any persistent reactors attached to the object are copied as well. Transient reactor attachments are not copied when an object is copied.