CopyRenameBlockChangeLayer

Short description

🚀 Copy, rename, and relayer a selected AutoCAD block reference by creating a new independent block definition, preserving dynamic block behavior, and optionally updating all entities inside the copied block to ByLayer display properties.

Command:

CopyBlockChangeLayer | RB

Description:

🧩 CopyRenameBlockChangeLayer is an AutoCAD AutoLISP block utility based on the copy and rename block-reference workflow, extended with a DCL dialog for selecting a new block name and target layer.
🔄 The command can create a renamed copy of a selected block reference or rename the selected reference to a duplicated block definition, avoiding a global rename of every original block reference.
🧠 ObjectDBX cloning is used to duplicate the block definition safely, rename it, then copy it back into the active drawing under the new block name.
📌 Dynamic block properties are preserved by reading the dynamic property values before the rename and restoring them after the new block definition is assigned.
🎨 After the new block is created, the selected/new block reference can be placed on the chosen layer and the internal block entities can be forced to the same layer with color, linetype, and lineweight set to ByLayer.

Helper function: (if any)​

• LM:RenameBlockReference — main copy/rename engine for the selected INSERT entity.
• LM:GetNewBlockNameAndLayer — writes and opens the temporary DCL dialog used to capture the new block name and layer choice.
• update-layer-list — filters the layer popup list using wildcard matching while the user types.
• FixBlockEntitiesLayer_Internal — updates block-definition entities to the chosen layer and normalizes Color, Linetype, and Lineweight to ByLayer.

Functionalities:

• 🧱 Selects one AutoCAD block reference and validates that the picked object is an INSERT.
• 🔒 Rejects blocks located on locked layers to prevent unsafe modifications.
• 📝 Suggests a unique default block name using the original effective block name plus an incremental suffix.
• 📋 Opens a DCL dialog with New Block Name, Filter Layers, and Choose Layer controls.
• 🔍 Filters available non-xref layers with wildcard logic while the user types.
• 📦 Duplicates the original block definition through ObjectDBX before assigning the new name.
• 🧬 Supports dynamic blocks by preserving dynamic property values during the block-reference rename.
• 🧭 Handles anonymous block names and xref-reload behavior where applicable.
• 🎯 Selects the copied reference after the operation when copy mode is active.
• 🎨 Applies the target layer to the block reference and internal block entities.
• 🟨 Sets internal entity color to ByLayer, linetype to ByLayer, and lineweight to ByLayer for clean layer-driven display.

Result:

✅ The result is an independent renamed block copy or renamed block reference with controlled layer assignment, cleaner ByLayer graphics, and preserved dynamic-block behavior.

Images, animations etc.

Pixel

XAML code:

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows">
    
<src:RibbonToolTip x:Key="Test">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: Command</Bold>
<LineBreak/>
<Bold>Version: 1.0 Date: </Bold>
<LineBreak/>
<LineBreak/>
<Hyperlink>N/A</Hyperlink>
<LineBreak/>



<TextBlock TextWrapping="Wrap" Foreground="Black">
<Bold>Description</Bold><LineBreak/>
🚀 Copy, rename, and relayer a selected AutoCAD block reference by creating a new independent block definition, preserving dynamic block behavior, and optionally updating all entities inside the copied block to ByLayer display properties.<LineBreak/>
<LineBreak/>
<Bold>Function Syntax</Bold><LineBreak/>
• <Bold><Run Foreground="DarkRed">CopyBlockChangeLayer</Run></Bold><LineBreak/>
• <Bold><Run Foreground="DarkRed">RB</Run></Bold><LineBreak/>
<LineBreak/>
<Bold>SEO Friendly Description</Bold><LineBreak/>
🧩 CopyRenameBlockChangeLayer is an AutoCAD AutoLISP block utility based on the copy and rename block-reference workflow, extended with a DCL dialog for selecting a new block name and target layer.<LineBreak/>
🔄 The command can create a renamed copy of a selected block reference or rename the selected reference to a duplicated block definition, avoiding a global rename of every original block reference.<LineBreak/>
🧠 ObjectDBX cloning is used to duplicate the block definition safely, rename it, then copy it back into the active drawing under the new block name.<LineBreak/>
📌 Dynamic block properties are preserved by reading the dynamic property values before the rename and restoring them after the new block definition is assigned.<LineBreak/>
🎨 After the new block is created, the selected/new block reference can be placed on the chosen layer and the internal block entities can be forced to the same layer with color, linetype, and lineweight set to ByLayer.<LineBreak/>
<LineBreak/>
<Bold>Functionalities</Bold><LineBreak/>
• 🧱 Selects one AutoCAD block reference and validates that the picked object is an INSERT.<LineBreak/>
• 🔒 Rejects blocks located on locked layers to prevent unsafe modifications.<LineBreak/>
• 📝 Suggests a unique default block name using the original effective block name plus an incremental suffix.<LineBreak/>
• 📋 Opens a DCL dialog with New Block Name, Filter Layers, and Choose Layer controls.<LineBreak/>
• 🔍 Filters available non-xref layers with wildcard logic while the user types.<LineBreak/>
• 📦 Duplicates the original block definition through ObjectDBX before assigning the new name.<LineBreak/>
• 🧬 Supports dynamic blocks by preserving dynamic property values during the block-reference rename.<LineBreak/>
• 🧭 Handles anonymous block names and xref-reload behavior where applicable.<LineBreak/>
• 🎯 Selects the copied reference after the operation when copy mode is active.<LineBreak/>
• 🎨 Applies the target layer to the block reference and internal block entities.<LineBreak/>
• 🟨 Sets internal entity color to ByLayer, linetype to ByLayer, and lineweight to ByLayer for clean layer-driven display.<LineBreak/>
<LineBreak/>
<Bold>Helper Functions and Internal Logic</Bold><LineBreak/>
• <Bold><Run Foreground="DarkRed">LM:RenameBlockReference</Run></Bold>
 — main copy/rename engine for the selected INSERT entity.
<LineBreak/>
• <Bold><Run Foreground="DarkRed">LM:GetNewBlockNameAndLayer</Run></Bold>
 — writes and opens the temporary DCL dialog used to capture the new block name and layer choice.
<LineBreak/>
• <Bold><Run Foreground="DarkRed">update-layer-list</Run></Bold>
 — filters the layer popup list using wildcard matching while the user types.
<LineBreak/>
• <Bold><Run Foreground="DarkRed">FixBlockEntitiesLayer_Internal</Run></Bold>
 — updates block-definition entities to the chosen layer and normalizes Color, Linetype, and Lineweight to ByLayer.
<LineBreak/>
<LineBreak/>
<Bold>Result</Bold><LineBreak/>
<Run Foreground="DarkGreen">✅ The result is an independent renamed block copy or renamed block reference with controlled layer assignment, cleaner ByLayer graphics, and preserved dynamic-block behavior.</Run><LineBreak/>
<LineBreak/>
<Bold>Important Notes</Bold><LineBreak/>
• <Run Foreground="DarkOrange">⚠️ This tool modifies or creates block definitions in the active drawing. Use a saved drawing or backup when editing production block libraries.</Run><LineBreak/>
• <Run Foreground="DarkOrange">⚠️ The CopyBlockChangeLayer command uses copy mode, while RB uses rename mode without creating an extra copied reference.</Run><LineBreak/>
• <Run Foreground="DarkOrange">⚠️ The uploaded code header mentions historical CB/RB command names, but the implemented copy command in this file is CopyBlockChangeLayer.</Run><LineBreak/>
<LineBreak/>
<Bold>Tags</Bold><LineBreak/>
<Run Foreground="Goldenrod">🏷️ AutoCAD, 🏷️ AutoLISP, 🏷️ Civil 3D, 🏷️ Block Tools, 🏷️ Block Rename, 🏷️ Copy Block, 🏷️ Dynamic Blocks, 🏷️ ObjectDBX, 🏷️ DCL Dialog, 🏷️ Layer Management, 🏷️ ByLayer, 🏷️ CAD Productivity</Run><LineBreak/>
</TextBlock>



</TextBlock>
            
<Grid>
<Image Source="PNG" Stretch="Uniform"/>
</Grid>

<Grid>
<MediaElement
 Source="GIF"
 Stretch="Uniform"
 Visibility="Visible"/>
 </Grid>

</StackPanel>
</src:RibbonToolTip.ExpandedContent>
</src:RibbonToolTip>
</ResourceDictionary>



Additional info:

Share this page:

Page Tag: 🏷️ Civil 3D

  • CopyRenameBlockChangeLayer

    Short description🚀 Copy, rename, and relayer a selected AutoCAD block reference by creating a new independent block definition, preserving dynamic block behavior, and optionally updating all entities inside the copied block to ByLayer display properties. Command:CopyBlockChangeLayer | RB Description:🧩 CopyRenameBlockChangeLayer is an AutoCAD AutoLISP block utility based on the copy and rename block-reference workflow, extended…

  • LayerLeaderPlugin

    Short description🏷️ LayerLeaderPlugin is an AutoCAD and Civil 3D .NET WinForms plugin for placing DB-standard MLeader labels from layer names, dynamic block visibility states, and managed JSON label databases. Command:🧰 Main commands: LLP, SHOWPANEL, PLACELEADER, ADDLAYER, REMOVELAYER, LISTLAYERS, ADDBLOCK, REMOVEBLOCK, LISTBLOCKS, LLUPDATEFIELDS, SETUPDIMSTYLES, LOADSETUPDIMSTYLES. Run NETLOAD, load LayerLeaderPlugin.dll, then use LLP or SHOWPANEL to open…

  • NavvCubeDisplayOffOn

    Short description🧭 NavvCubeDisplayOffOn is a compact AutoCAD AutoLISP utility for resetting the Navigation Cube display state with one command. 🔄 It runs the AutoCAD NAVVCUBEDISPLAY command sequence automatically, helping CAD users restore the ViewCube or NavVCube display without searching through interface settings. Command:🚀 Main command: NavvCubeDisplayOffOn 🧰 AutoCAD system command used internally: NAVVCUBEDISPLAY 🔄 Internal…

  • Export_Import_MS_UCS

    Short description🧭 Export_Import_MS_UCS is an AutoCAD AutoLISP utility for exporting and importing named UCS definitions through portable .ucs files. 📤 It helps CAD users transfer model-space UCS setups between drawings, preserve project coordinate systems, and reuse named UCS standards in AutoCAD and Civil 3D production workflows. Command:🚀 Main export dialog command: EXPUCS_DIALOG 🚀 Main import…

  • ExpImpUCS

    Short description🧭 ExpImpUCS is an AutoCAD and Civil 3D AutoLISP utility for exporting and importing named UCS definitions through a practical DCL dialog. 📤 It helps CAD users save UCS setups to portable .ucs files, restore coordinate systems in another drawing, and reuse project-specific UCS_Lageplan folders with fewer manual steps. Command:🚀 Main command: ExpImpUCS 📤…

  • SetPlotDeviceNames

    Short description🖨️ SetPlotDeviceNames is an AutoCAD/Civil 3D AutoLISP DCL manager for batch editing layout plot devices, page setups, paper sizes, viewport locks, annotation visibility, and zoom settings. 📐 It provides filtered layout selection, synchronized columns, per-column horizontal scrolling, and apply tools for production plotting workflows. Command:🚀 Main command: SetPlotDeviceNames 🔍 Layout filter: supports * and…

  • DuplicateLayouts

    Short description📄 DuplicateLayouts is an AutoCAD and Civil 3D AutoLISP utility for duplicating layout tabs from a dialog-driven workflow. 🔁 It lets CAD users select one or more existing paper-space layouts, assign copy counts, create unique layout names automatically, and manage layout duplication without manually repeating the AutoCAD LAYOUT Copy command. Command:🚀 Main command: DuplicateLayouts…

  • LayoutTools

    LayoutTools

    Short description🧰 LayoutTools is an AutoCAD and Civil 3D AutoLISP layout management dialog for zooming layouts, locking and unlocking viewports, and toggling ANNOALLVISIBLE. 📑 It supports filtered layout selection, selected or all-displayed scope, viewport lock status, annotation visibility status, zoom status tracking, clipboard copy, and batch paper-space operations. Command:🚀 Main command: LayoutTools 🔁 Alias command:…

  • LayerCreation

    Short description🧱 LayerCreation is an AutoCAD and Civil 3D AutoLISP tool for creating or updating layers with color, linetype, lineweight, transparency, and default object settings. 🎨 It supports ACI colors, RGB true color, color books, a DCL dialog, and a reliable command-line fallback. Command:🚀 Main command: LayerCreation ⌨️ Command-line fallback: NEWLAYERCLI 🎨 Layer fields: Name,…

  • 3DPolyVertex2Table

    Short description🧩 3DPolyVertex2Table creates an AutoCAD table containing the X Y and Z coordinates of every vertex from a selected 3DPolyline. 🔢 The selected polyline vertices are marked in the drawing with matching numeric labels and small red circles. 📋 After the coordinate table is generated the user places it at the required drawing location.…