Extract Nested Block

(Convert Nested Block to Primary Block)

Function Syntax ENB
Current Version 1.1
Download ExtractNestedBlockV1-1.lsp
View HTML Version ExtractNestedBlockV1-1.html
Donate
This program is also available at the Autodesk Exchange App Store

Program Description

This program allows the user to convert a nested block into a primary block inserted at the same position for each reference of the nested block, retaining the same scale, rotation, orientation and all other properties possessed by the original nested block.

Following selection of a nested block, the program will convert all references of the nested block and then proceed to remove the nested block from the primary block definition in which it resides.

The program is compatible with uniformly-scaled nested standard blocks, nested dynamic blocks & nested xrefs, nested to any depth, and will process all references of the nested block, even those for which the parent block is also nested within another reference, as the various examples below demonstrate.

The program is unfortunately incompatible with blocks nested within dynamic blocks or xrefs, and the program will ignore non-uniformly-scaled block references.

Examples

Example 1

In the following demonstration, Block1 (green) is nested within Block2 (yellow), which is nested within Block3 (red). To make things a little more complex, at each level of the nesting, the references have been scaled and rotated.

ExtractNestedBlock.gif

Example 2

In this second example, Block1 (green) is nested within Block2 (yellow), which is nested within Block3 (red) and also nested within Block3-1 (cyan). A reference of Block3 (red) is also nested within Block4 (grey). Again, at each level of the nesting, the references have been scaled and rotated.

ExtractNestedBlock2.gif

Instructions for Running

Please refer to How to Run an AutoLISP Program.

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010