Copy or Rename Block Reference

Function Syntax CB (Copy) / RB (Rename)
Current Version 1.5
Download CopyRenameBlockV1-5.lsp
View HTML Version CopyRenameBlockV1-5.html
Donate

Program Description

This program allows a user to copy and/or rename a single block reference in the working drawing.

Many existing programs enable the user to rename the block definition for a given block reference, with the new name subsequently reflected across all references of the block definition in the drawing. However, this program will allow a single selected block reference to be renamed (or for the user to create a renamed copy of the selected block reference), by generating a duplicate renamed block definition for the selected block.

The program may be called from the command-line using either CB to create a renamed copy of a selected block reference, or RB to simply rename the selected block reference.

Following selection of a block reference, the user is prompted to specify a name for the selected/copied block reference; a default block name composed of the original block name concatenated with both an underscore and the minimum integer required for uniqueness within the block collection of the active drawing is offered.

The program will then proceed to duplicate the block definition using the new block name. To accomplish this without resulting in a duplicate key in the block collection of the active drawing, the program utilises an ObjectDBX interface to which the block definition of the selected block reference is deep-cloned, renamed, then deep-cloned back to the active drawing. This method also enables Dynamic Block definitions to be successfully copied & renamed.

This program will furthermore perform successfully in all UCS/Views and is also compatible with Anonymous Blocks, Dynamic Blocks & XRefs.

Demonstration

Copy Block.gif

Instructions for Running

Please refer to How to Run an AutoLISP Program.

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010