williamferenal Posted July 11, 2022 Posted July 11, 2022 Hi All, Apologies if this has been solved before but I have searched for hours and counting but to no success. I currently a title block in multiple cad files that needs to be renamed. This title block is exported from REVIT so it has unique names on it as shown in the attachment. There are parts of the block name that are consistent throughout the cad files so I suspect a wildcard search is needed. I just don't know how to do it. Is there any lisp that I can use to rename the title blocks using a wildcard search? I want them renamed to "TITLE BLOCK 1" Any help would be much appreciated Quote
Emmanuel Delay Posted July 11, 2022 Posted July 11, 2022 It's a title block, so I presume you want to keep the attributes data, right? Because just renaming a block without attributes; there I would just delete the block and insert a new one. Maybe it's still the simplest solution. Do all these blocks have the same attributes? Same attribute names? Quote
Steven P Posted July 11, 2022 Posted July 11, 2022 Just a quick search, this shows how to filter a selection set to a block name (if (setq ss (ssget '((0 . "INSERT") (2 . "block1,block2,block3") (410 . "Model")))) and you can change model to a layout name if needed, without checking I think you should be able to do the block name as a wildcard ( '*' ) and I think you can use this line to rename it: (command "rename" "b" OLD_NAME NEW_NAME) I don't have anything put together to do all of this, someone might, but would this be enough to get you started? Get it working on a single drawing and then depending how many drawings you have can look at a script or batch process to do lots of them all at once Quote
williamferenal Posted July 11, 2022 Author Posted July 11, 2022 Hi Emmanuel, thanks for the reply. The title block does not have any attributes to it. All the attributes, ie title of the drawing, dates, drawing numbers are on a separate Block. Yes I have thought of what you suggested but I was kinda hoping to have something automated as it will require me to open around 100 drawings per package. Quote
Dadgad Posted July 11, 2022 Posted July 11, 2022 (edited) Use LeeMacs spectacular BFIND (Batch Find) Just open one of the drawings in the folder, then set it to do the whole folder without needing to open them. It may take a minute or two, then will tell you what it did in a spreadsheet. Thanks Lee! Edited July 11, 2022 by Dadgad Quote
Steven P Posted July 11, 2022 Posted July 11, 2022 and this mighty just work - check it out and then see where you need to go from there? (defun c:renameblock ( / ss OLD_NAME NEW_NAME) (setq NEW_NAME "My New Name") (if (setq ss (ssget "X" '((0 . "INSERT") (2 . "*Name") (410 . "Layout1")))) ;;note case sensitive (PROGN (setq OLD_NAME (cdr (assoc 2 (entget (ssname ss 0))))) (command "rename" "b" OLD_NAME NEW_NAME) ) ) ) Quote
Steven P Posted July 11, 2022 Posted July 11, 2022 26 minutes ago, Dadgad said: Use LeeMacs spectacular BFIND (Batch Find) Just open one of the drawings in the folder, then set it to do the whole folder without needing to open them. It may take a minute or two, then will tell you what it did in a spreadsheet. Thanks Lee! Will that change block name, I know it will replace attributes but didn't think it did the actual block - it is a great LISP though Quote
Dadgad Posted July 11, 2022 Posted July 11, 2022 Not sure, too busy to check right now, but it might do it...and if it does you'll be a happy camper. 1 Quote
Steven P Posted July 11, 2022 Posted July 11, 2022 I can't remember it's been a few weeks since I used it last Quote
Steven P Posted July 11, 2022 Posted July 11, 2022 ahh, yes I tend to turn off the block attributes check box Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.