Short description
🚀 Rename a selected AutoCAD block definition directly from a picked block reference, without needing to manually identify the original block name in the standard RENAME command.
Command:
RenameBlock
Description:
🧱 RenameBlock is a compact AutoLISP utility for renaming the block definition behind a selected block reference in the active drawing.
🔍 The user selects a block reference, and the routine reads the real block name or EffectiveName when the selected object is a dynamic block.
📝 A text editor prompt is opened with the current block name, allowing the user to type a new valid block name while avoiding duplicate block names.
🔒 Xrefs are excluded because the routine checks the block table record and does not process external references.
↩️ The operation is wrapped in an AutoCAD undo mark and temporarily suppresses command echo while running the internal RENAME command.
Helper function: (if any)
• C:RenameBlock — main user command for selecting and renaming a block reference.
• getblk — repeated selection helper that prompts until a block selection is supplied.
• *error* — restores highlighting, closes the undo mark, and reports non-cancel errors safely.
Functionalities:
• 🧱 Accepts one preselected INSERT or prompts the user to select one block reference.
• 🧹 Clears multiple preselected objects so the user can pick a single valid block.
• 🔎 Reads EffectiveName for dynamic blocks and Name for regular block references.
• 🚫 Excludes xrefs from the rename workflow.
• ✨ Highlights the selected block during the rename operation and unhighlights it afterward.
• 📝 Opens the current block name in the LISP text editor for easy editing.
• ✅ Rejects empty names, whitespace-only names, and names already used by another block definition.
• 🔁 Executes AutoCAD RENAME with the BLOCK option when the new name is different.
• ↩️ Uses vla-startundomark and vla-endundomark so the rename can be undone cleanly.
• 📣 Prints whether the block was renamed or the original name was retained.
Result:
✅ The result is a faster block-renaming workflow: pick a block reference, enter the new name, and let the command rename the underlying block definition in the drawing.
Images, animations etc.
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="RenameBlock"> <src:RibbonToolTip.ExpandedContent> <StackPanel> <TextBlock Background="AntiqueWhite" TextAlignment="Left"> <Bold>Function Syntax: RenameBlock</Bold> <LineBreak/> <Bold>Version: 1.1 Date: 20.06.2026 6:38:49PM</Bold> <LineBreak/> <Hyperlink>RenameBlock</Hyperlink> <LineBreak/> <TextBlock TextWrapping="Wrap" Foreground="Black"> <Bold>Description</Bold><LineBreak/> 🚀 Rename a selected AutoCAD block definition directly from a picked block reference, without needing to manually identify the original block name in the standard RENAME command.<LineBreak/> <Bold>Function Syntax</Bold><LineBreak/> • <Bold><Run Foreground="DarkRed">RenameBlock</Run></Bold><LineBreak/> <Bold>SEO Friendly Description</Bold><LineBreak/> 🧱 RenameBlock is a compact AutoLISP utility for renaming the block definition behind a selected block reference in the active drawing.<LineBreak/> 🔍 The user selects a block reference, and the routine reads the real block name or EffectiveName when the selected object is a dynamic block.<LineBreak/> 📝 A text editor prompt is opened with the current block name, allowing the user to type a new valid block name while avoiding duplicate block names.<LineBreak/> 🔒 Xrefs are excluded because the routine checks the block table record and does not process external references.<LineBreak/> ↩️ The operation is wrapped in an AutoCAD undo mark and temporarily suppresses command echo while running the internal RENAME command.<LineBreak/> <Bold>Functionalities</Bold><LineBreak/> • 🧱 Accepts one preselected INSERT or prompts the user to select one block reference.<LineBreak/> • 🧹 Clears multiple preselected objects so the user can pick a single valid block.<LineBreak/> • 🔎 Reads EffectiveName for dynamic blocks and Name for regular block references.<LineBreak/> • 🚫 Excludes xrefs from the rename workflow.<LineBreak/> • ✨ Highlights the selected block during the rename operation and unhighlights it afterward.<LineBreak/> • 📝 Opens the current block name in the LISP text editor for easy editing.<LineBreak/> • ✅ Rejects empty names, whitespace-only names, and names already used by another block definition.<LineBreak/> • 🔁 Executes AutoCAD RENAME with the BLOCK option when the new name is different.<LineBreak/> • ↩️ Uses vla-startundomark and vla-endundomark so the rename can be undone cleanly.<LineBreak/> • 📣 Prints whether the block was renamed or the original name was retained.<LineBreak/> <Bold>Helper Functions and Internal Logic</Bold><LineBreak/> • <Bold><Run Foreground="DarkRed">C:RenameBlock</Run></Bold> — main user command for selecting and renaming a block reference. <LineBreak/> • <Bold><Run Foreground="DarkRed">getblk</Run></Bold> — repeated selection helper that prompts until a block selection is supplied. <LineBreak/> • <Bold><Run Foreground="DarkRed">*error*</Run></Bold> — restores highlighting, closes the undo mark, and reports non-cancel errors safely. <LineBreak/> <Bold>Result</Bold><LineBreak/> <Run Foreground="DarkGreen">✅ The result is a faster block-renaming workflow: pick a block reference, enter the new name, and let the command rename the underlying block definition in the drawing.</Run><LineBreak/> <Bold>Important Notes</Bold><LineBreak/> • <Run Foreground="DarkOrange">⚠️ This command renames the block definition globally, so every reference using that definition receives the new name.</Run><LineBreak/> • <Run Foreground="DarkOrange">⚠️ It does not create an independent block copy. Use a copy/rename block utility when only one reference should be isolated.</Run><LineBreak/> • <Run Foreground="DarkOrange">⚠️ The routine is intended for INSERT block references and skips xrefs.</Run><LineBreak/> <Bold>Tags</Bold><LineBreak/> <Run Foreground="Goldenrod">🏷️ AutoCAD, 🏷️ AutoLISP, 🏷️ Civil 3D, 🏷️ Block Tools, 🏷️ Rename Block, 🏷️ Dynamic Blocks, 🏷️ Block Definition, 🏷️ CAD Cleanup, 🏷️ Drawing Management, 🏷️ AutoCAD Productivity</Run><LineBreak/> </TextBlock> </TextBlock> <!-- Use MediaElement for GIF (static first frame) and Image as fallback --> </StackPanel> </src:RibbonToolTip.ExpandedContent> </src:RibbonToolTip> </ResourceDictionary>
