Attaching Reactors to AutoCAD Drawings
 
 
 

A reactor is an object you attach to AutoCAD drawing objects to have AutoCAD notify your application when events you are interested in occur. For example, if a user moves an entity that your application has attached a reactor to, your application will receive notification that the entity has moved. If you design it to do so, your application can react to this notification with appropriate actions, such as moving other entities associated with the one moved, or perhaps updating a text tag that records revision information on the altered drawing feature.

A reactor communicates with your application by calling a function you have associated with the reactor. Such a function is referred to as a callback function. There isn't anything particularly unusual about reactor callback functions—they are like other functions you write with VLISP. They become callback functions when you attach them to reactor events.

Before you can use reactor functions with AutoLISP, you must load the supporting code that enables these functions. Issue the following function call to load reactor support:

vl-load-com

This function first checks whether reactor support is already loaded; if reactor support is loaded, the function does nothing, otherwise, it loads reactor support and other AutoLISP extended functions.

NoteAll applications that use reactors—including all callback functions—should begin by calling vl-load-com.