Storing Data with a Reactor

AutoCAD Visual LISP

 
Storing Data with a Reactor
 
 
 

You can solve the problem of saving the original configuration by taking advantage of another feature of VLISP reactors—the ability to store data within a reactor. When the user first draws a path boundary, you attach a reactor to the boundary, along with the data you need to save. This entails modifying your main program function, C:GPath, as follows:

Defun C:GPath
   Do everything that is already done in the garden path
   (and don't break anything)
   Attach an object reactor to the polyline using these parameters:
      A pointer to the polyline just drawn,
      A list of data that you want the reactor to record,
      A list of the specific polyline object events to be tracked,
      along with the LISP callback functions to be invoked
   End of the object reactor setup
   Attach editor reactor to the drawing editor using the
   following parameters:
      Any data you want attached to the reactor (in this case, none)
      A list of the specific editor reactor events to be tracked,
      along with the LISP callback functions to be invoked
   End of the editor reactor setup
End function