Copy Block Definition

See also Copy or Rename Block Reference & Collection Functions.

Function Syntax (LM:CopyBlockDefinition <blk> <new>)
Current Version 1.1
Download CopyBlockDefinitionV1-1.lsp
View HTML Version CopyBlockDefinitionV1-1.html
Symbol Type Description
blk String Name of block definition to be duplicated
new String Name to be used for copied block definition
Type Description
VLA-Object Copied VLA Block Definition Object, else nil if unsuccessful.

Function Description

This function allows a user to duplicate a block definition, with the copied definition assigned the new name provided.

To ensure that no duplicate keys are generated in the active block collection during the copy operation, the program utilises an ObjectDBX interface coupled with the ActiveX copyobjects deep-clone method to clone the block definition from the block collection in the active drawing to the block collection in an unnamed ObjectDBX document where the copied block definition is then renamed before being copied back to the block collection of the active drawing. The use of this method also enables the function to successfully copy dynamic block definitions.

If successful, the function will return the new duplicated block definition object; if either the source block definition doesn't exist in the block collection of the active drawing, or the supplied name for the new definition already exists in the active block collection, this function will return nil. Note that the function does not test the validity of the characters present in name supplied for the duplicated definition.

Example Function Call

(LM:CopyBlockDefinition "OldBlock" "NewBlock")

See also Copy or Rename Block Reference & Collection Functions.


increase · reset · decrease

Designed & Created by Lee Mac © 2010