Associative Centerlines

Function Syntax CL / CLRemove
Current Version 1.0
Download AssociativeCenterlineV1-0.lsp
View HTML Version AssociativeCenterlineV1-0.html

Program Description

This reactor based program enables the user to create associative circle centerlines which will automatically update following modification of the associated circle.

Upon calling the program with 'CL' at the AutoCAD command-line, the user is prompted to make a selection of circles for which to create associative centerlines.

For each set of circle and centerlines, the program uses two Object Reactors to monitor modification events for both the circle object and pair of centerlines. Upon modification of the circle, the associated centerlines are moved or scaled accordingly to remain in the correct position.

The pair of centerlines are also monitored for modification using an Object Reactor, however, following modification of such lines, the callback function for the Object Reactor cannot be used to reposition the lines since this would trigger a recursive evaluation of the same callback function, and the program would take a dive into a recursive black hole, eventually resulting in a stack overflow.

To avoid the recursive call, the Object Reactor is temporarily disabled following the centerline modification event and a Command Reactor is created to detect the event of the command completion. When the active command is completed, the centerlines are updated, Command Reactor disabled and Object Reactor re-enabled.

The handles of the centerlines are stored in the associated circle entity XData, and similarly the handle of the circle is stored in the line entity XData of both centerlines. This enables the program to rebuild the reactors upon loading, allowing retention of the centerline associativity between drawing sessions.

The user can remove the centerline associativity at any time by typing 'CLRemove' at the AutoCAD command-line and selecting circles with associative centerlines.

Program Preview


Instructions for Running

Please refer to How to Run an AutoLISP Program.


increase · reset · decrease

Designed & Created by Lee Mac © 2010