Modifying Reactors

AutoCAD AutoLISP & Visual LISP

 
Modifying Reactors
 
 
 

VLISP provides functions to modify reactor definitions:

  • vlr-reaction-set changes the callback function link for the specified reactor event. The function syntax is:

    (vlr-reaction-set reactor callback-condition 'callback-function)

    For example, the following command changes the circleReactor reactor to call the print-area function when an object is modified:

    $ (vlr-reaction-set circleReactor :vlr-modified 'print-area)

    PRINT-AREA

  • vlr-data-set changes the application-specific data associated with the reactor. For example, the following call replaces the text string used to identify the circleReactor reactor:

    $ (vlr-data-set circleReactor "Circle Area Reactor")

    "Circle Area Reactor"

    You can verify that the reactor has changed by using the VLISP Inspect feature. If the Inspect window shown in Inspecting Reactors is still displayed in your VLISP session, right-click in the window's object line and choose Update. If you've modified the circleReactor reactor as shown in this section, the updated Inspect window will look like the following:

  • vlr-owner-add adds a database object to the list of owners of the specified reactor. In the following example, an ARC object named archie is added to the owner list of reactor circleReactor:

    $ (vlr-owner-add circleReactor archie)

    #<VLA-OBJECT IAcadArc 03ad0bcc>

    Now, if a user modifies the archie object, the callback function defined for reactor circleReactor is invoked. You can verify this by inspecting the reactor. Update the Inspect window for the circleReactor reactor, then right-click on the list item that begins with {Owners} and choose Inspect:

    Both the Arc and Circle objects are listed in the Inspect window.

  • vlr-owner-remove removes an Owner object from the list of reactor owners. For example, the following command removes archie from the circleReactor owner list:

    $ (vlr-owner-remove circleReactor archie)

    #<VLA-OBJECT IAcadArc 03ad0bcc>