vlr-object-reactor

AutoCad AutoLISP Functions

 
vlr-object-reactor
 
 
 

Constructs a drawing object reactor object

(vlr-object-reactor owners data callbacks)

The reactor object is added to the drawing database, but does not become persistent.

Arguments

owners

An AutoLISP list of VLA-objects identifying the drawing objects to be watched.

data

Any AutoLISP data to be associated with the reactor object; otherwise nil if no data.

callbacks

A list of pairs of the following form:

(event-name . callback_function)

where event-name is one of the symbols listed in the “Object Events” table and callback_function is a symbol representing a function to be called when the event fires. Each callback function accepts three arguments:

owner The owner of the VLA-object the event applies to.

reactor_object The VLR object that called the callback function.

list A list of extra data elements associated with the particular event. The contents of this list for particular events are shown in the “Object Events Callback Data” table.

Return Values

The reactor_object argument.

Object events

Name

Event

:vlr-cancelled

The modification of the object has been canceled.

:vlr-copied

The object has been copied.

:vlr-erased

Erase-flag of the object has been set.

:vlr-unerased

Erase-flag of the object has been reset.

:vlr-goodbye

The object is about to be deleted from memory.

:vlr-openedForModify

The object is about to be modified.

:vlr-modified

The object has been modified. If the modification was canceled, also :vlr-cancelled and :vlr-modifyUndone will be fired.

:vlr-subObjModified

A sub-entity of the object has been modified. This event is triggered for modifications to vertices of polylines or meshes, and for attributes owned by blockReferences.

:vlr-modifyUndone

The object's modification was undone.

:vlr-modifiedXData

The object's extended entity data has been modified.

:vlr-unappended

The object has been detached from the drawing database.

:vlr-reappended

The object has been re-attached to the drawing database.

:vlr-objectClosed

The object's modification has been finished.

Object events callback data

Name

List length

Parameters

:vlr-cancelled

:vlr-erased,

:vlr-unerased

:vlr-goodbye

:vlr-openedForModify

:vlr-modified

:vlr-modifyUndone

:vlr-modifiedXData

:vlr-unappended

:vlr-reappended

:vlr-objectClosed

0

 

:vlr-copied

1

The object created by the copy operation (ename).

:vlr-subObjModified

1

The sub-object (ename) that has been modified

Examples

The following code attaches an object reactor to the myCircle object. It defines the reactor to respond whenever the object is modified (:vlr-modified) and to call the print-radius function in response to the modification event:

(setq circleReactor (vlr-object-reactor (list myCircle)
         "Circle Reactor" '((:vlr-modified . print-radius))))