Layer Director

Function Syntax LDON / LDOFF
Current Version 2.1
Download LayerDirectorV2-1.lsp
View HTML Version LayerDirectorV2-1.html
Donate

Program Description

This program uses a Visual LISP Command Reactor to automatically set the current layer when a command is called, proceeding to reset to the previous current layer when the command is completed. The target layer will also be created if it doesn't already exist in the drawing.

The data controlling the layer to be set when certain commands are called is tabulated at the top of the code - this may be altered and expanded to suit the user's requirements.

The first item of each list in the table is the name of a standard AutoCAD command or custom AutoLISP command to trigger a layer change. This command name should be the full command name, not a command alias. The command is not case-sensitive and may use wildcards.

To give a few examples, "[DM]TEXT,TEXT" will cue a layer change for the Text, DText and MText commands; "*LEADER" will cue a layer change for the Leader, QLeader and MLeader commands.

The second item is the name of the layer to be set to current when the command is called. This layer will be created if not present in the active drawing. The remaining items are basic layer properties to be applied to layers that are created by the program - the required format for these properties is described in more detail in the program source code.

A 'Force Layer Properties' parameter set in the code determines whether the program will automatically modify the properties of existing layers in the drawing. If enabled, the properties of existing layers will be modified to match those found in the Layer Data described above.

The program also offers an xref-dependent layer assignment option, which will automatically insert external references on a layer matching the xref name, with an optional prefix & suffix, and predefined layer properties which may be configured from the program source code.

Finally, the program also enables the user to automatically configure any number of system variables when a command is invoked, with the system variables reset to their original values upon completing or cancelling the active command.

The program will automatically enable the Command Reactor when loaded on drawing startup, and the current layer will be automatically changed when any of the listed commands are called. The reactor may be subsequently disabled or enabled manually using the commands ldoff & ldon respectively.

Example of Usage

Layer Director.gif

Instructions for Running

This program will run automatically when loaded on drawing startup and may be subsequently switched on & off using the commands ldon and ldoff respectively. Refer to How to Run an AutoLISP Program for instructions on how to load this program.

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010