Cleaning Up After Your Reactors

AutoCAD Visual LISP

 
Cleaning Up After Your Reactors
 
 
 

Reactors are indeed very active. When you design an application that relies on them, you could very well spend a great deal of time crashing your program and possibly crashing AutoCAD as well. It helps to have a tool available to remove all the reactors you have added, if necessary.

The gpreact.lsp file includes a function gp:clean-all-reactors that doesn't do much on its own. Instead, it makes a call to the CleanReactors function. Add this function to your utils.lsp file by copying the following code to the end of the file:

;;;--------------------------------------------------------------;
;;;     Function: CleanReactors                                  ;
;;;--------------------------------------------------------------;
;;;  Description: General utility function used for cleaning up  ;
;;;               reactors. It can be used during debugging, as  ;
;;;               well as cleaning up any open reactors before   ;
;;;               a drawing is closed.                           ;
;;;--------------------------------------------------------------;
(defun CleanReactors ()
  (mapcar 'vlr-remove-all
         '(:VLR-AcDb-reactor
           :VLR-Editor-reactor
           :VLR-Linker-reactor
           :VLR-Object-reactor
          )
  )
)