[Search tip detail and code files using keywords, tip number, author name, etc ]
 
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Rename a Pasted Block
Tip# 3751 By Kent Cooper On 17-Oct-2011
3
Rated By 2 users Downloaded : 1647
Categories : Object Properties, Edit Blocks
Software type : AutoCAD 2012
Rename File To : RenameBlock.lsp
With this routine, you don't need to know the block's current name in order to rename it.

Editor's Note: This tip was updated in May 2013 with a revised LISP file, which contains various minor enhancements and corrections.

Editor's Note:
This tip was updated in April 2012 with a revised LISP file. The only change is that the revised RenameBlock.lsp now reports the current name of the selected Block when asking for a new one.

Frequent tipster Kent Cooper's latest contribution allows you to rename a block in AutoCAD without knowing the original name of the block. Why would you want to do that? Well, if you have ever pasted in geometry from another drawing as a block, AutoCAD assigns it a block name, but it is always something hard to remember, like A$CFG5D32S. If you have a few of these in your drawing, they become difficult to manage. Sure, you can rename them using the traditional method, but you have to know the current name before invoking the Rename command. To use this routine, load the LISP file, then type in the command RB. Now you can pick a block insertion on the screen and give it a new name without having to list its current name first.

 

Average Rating:
3


User comments
Comment by Anderson,Jim
Posted on 2012-02-23 15:50:16
Fantastic idea! I wish AutoCAD would provide this as standard in the Properties pallete. Thanks for sharing.
Comment by Toth,Zoltan
Posted on 2012-08-10 09:14:36
Simple yet very useful. Thanks for sharing.
Comment by Cooper,Kent
Posted on 2013-10-08 12:09:15
I would also point out that this can be used to Rename not just pasted Blocks with weird names [that's where it is of most benefit in simplifying the process], but ANY Block at all.
Comment by Baer,Tom
Posted on 2014-07-21 10:53:00
If this post is not appropriate I apologize. Any information on where I would need to post if this is true would be greatly appreciated. I am looking for a way, if possible, to use a rename function like this, but automate the selection. That is, instead of using the nselect feature, would I be able to make autolisp select a block automatically? By that I mean specifically, could I tell autolisp to select the block at 0,0 (title block) instead of having to be prompted to click on it. I am trying to eliminate the need for a user to select manually. Thanks.
Comment by Cooper,Kent
Posted on 2014-07-26 08:02:48
If there will always be one there, and nothing else there, and it has some drawn element AT 0,0,0, you can change the line that says (setq bent (car (entsel " Select Block to Rename: "))) to (setq bent (ssname (ssget '(0 0 0)) 0)). If it doesn't have any drawn element there, but its insertion point is there, try (setq bent (ssname (ssget "_X" '(10 0.0 0.0 0.0)) 0)). [That requires it to be really precisely at 0,0,0, without any component really being, say, 0.00000001.] You could also use (ssget) and filter for Block Name if that's always the same: (setq bent (ssname (ssget "_X" '(2 . "YourOldBlockName")) 0)).