When working with complex drawings in AutoCAD, renaming block definitions with the native RENAME command can be a tedious chore. Opening the native dialog box forces you to scroll through a long, alphabetical list of drawing blocks just to find the right definition. If you don't remember the exact name of the block on your screen, you have to cancel out, inspect the block properties, reopen the dialog box, and search all over again.
The BRE.lsp (Block Rename) utility replaces that clunky dialog workflow with direct on-screen selection. Simply click the block in your workspace, type the new name in the command prompt, and the script updates the block definition drawing-wide in seconds.
Key Advantages of BRE.lsp
Direct Screen Selection: Pick the target block symbol right on your drawing canvas without searching through long alphabetical lists.
Bypass Clunky Menus: Skip opening heavy modal dialog windows and keep your drafting momentum flowing uninterrupted.
Drawing-Wide Update: Automatically renames the block definition across every placed instance in your drawing file simultaneously.
Step-by-Step Instructions
Load
BRE.lspinto your AutoCAD session using theAPPLOADcommand.Type
BREin the command prompt and hit Enter.Click directly on the block you want to rename on your screen.
Check the current block name displayed in the command prompt, type your new block name, and press Enter.
The script renames the block definition instantly across your entire drawing.
AutoLISP Code (BRE.lsp)
Copy the code below and save it as BRE.lsp inside your AutoCAD support folder:
(vl-load-com)
(defun c:BRE ( / acadObj activeDoc oldCmdecho oldOsmode ent blkData blkName newName )
(setq acadObj (vlax-get-acad-object)
activeDoc (vla-get-ActiveDocument acadObj)
oldCmdecho (getvar "cmdecho")
oldOsmode (getvar "osmode"))
(defun *error* (msg)
(vla-EndUndoMark activeDoc)
(setvar "cmdecho" oldCmdecho)
(setvar "osmode" oldOsmode)
(princ "\nCAD Lisp [www.daolpro.com]")
(princ)
)
(setvar "cmdecho" 0)
(vla-StartUndoMark activeDoc)
(if (setq ent (car (entsel "\nSelect a block to rename: ")))
(progn
(setq blkData (entget ent))
(if (= (cdr (assoc 0 blkData)) "INSERT")
(progn
(setq blkName (cdr (assoc 2 blkData)))
(setq newName (getstring t (strcat "\nCurrent block name: " blkName "\nEnter new block name: ")))
(if (and newName (/= newName ""))
(progn
(vl-cmdf "-rename" "block" blkName newName)
(princ (strcat "\nBlock successfully renamed from [" blkName "] to [" newName "]."))
)
(princ "\nInvalid block name.")
)
)
(princ "\nSelected object is not a block.")
)
)
(princ "\nNo object selected.")
)
(vla-EndUndoMark activeDoc)
(setvar "cmdecho" oldCmdecho)
(setvar "osmode" oldOsmode)
(princ "\nCAD Lisp [www.daolpro.com]")
(princ)
)
Practical Workflow Tip
When organizing messy imported drawings or vendor blocks, use BRE.lsp to establish clean, standardized naming conventions (e.g., E-LGT-01 or A-DR-900) before building your main block library.

Post a Comment