Bobzy20 Posted November 13, 2019 Share Posted November 13, 2019 (edited) We often get drawings drawn using MicroStation and then exported to DWG and we have hundreds of blocks within the drawing that have slightly different block names, albeit they are the same block. Block Name: "Smart Solid_386" (The number on the end '386' changes). There are hundreds of these blocks within our drawings and I what a way of selecting all of them and deleting. I can’t seem to find a way of using ‘Quick Select’ to do it and not sure exactly how ‘Filter’ could be used? Probably an easy question for somebody, as I’m sure it’s come up before but I can’t seem to find the answer. Any help would be great. Bob Edited November 13, 2019 by Bobzy20 Quote Link to comment Share on other sites More sharing options...
tombu Posted November 13, 2019 Share Posted November 13, 2019 The lisp (sssetfirst nil (ssget "X" '((0 . "INSERT")(2 . "Smart Solid_*"))) should do it. The FILTER command does this nicely as well using "Block Name = Smart Solid_*" and has the advantage of being able to save as a Named Filter that can be used in other drawings as well. I used FILTER a lot when I started in r12 over a quarter century ago. Nothing I hate worse than having to clean up a drawing converted from Microstation. Good Luck! Quote Link to comment Share on other sites More sharing options...
Bobzy20 Posted November 13, 2019 Author Share Posted November 13, 2019 Thanks. I have attached a sample drawing for you try your script on and also to try the Filter option. Also if you look at the CT.jpg screenshot attached, i have selected the block i want to be removed. Its the block that sits in the middle of the main light block although i think they share a similar name! However the block i want to be removed has another block inside that with a different name, maybe we could use this block name to remove them? Sorry its confusing! CT.dwg Quote Link to comment Share on other sites More sharing options...
tombu Posted November 13, 2019 Share Posted November 13, 2019 Sorry I left off the closing parenthes is on the code above, updated it after testing it on your attached CT.dwg. I've attached a clean version with the blocks deleted, had to purge blocks twice because of the blocks referenced by the other blocks. CTclean.dwg Quote Link to comment Share on other sites More sharing options...
Bobzy20 Posted November 13, 2019 Author Share Posted November 13, 2019 Thanks, how would i run that code? What would i type after loading? Quote Link to comment Share on other sites More sharing options...
tombu Posted November 13, 2019 Share Posted November 13, 2019 9 minutes ago, Bobzy20 said: Thanks, how would i run that code? What would i type after loading? Copy and Paste the code to the command line and enter to display all those blocks selected. Using a saved filter should work as well, but the selection set will not display selected. Just start ERASE and Enter L (Last) at the "Select objects:" prompt, then Enter again. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 14, 2019 Share Posted November 14, 2019 (edited) Maybe not tested. (setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 (getstring "Type block names"))))) you can type solid_mesh*,solid-face*,solid-red* etc so multiple block names in one go type Erase !ss <enter> Edited November 14, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
SLW210 Posted November 14, 2019 Share Posted November 14, 2019 QSELECT>Block Reference>Name>*Wildcard Match>Smart Solid* 1 Quote Link to comment Share on other sites More sharing options...
tombu Posted November 14, 2019 Share Posted November 14, 2019 12 minutes ago, SLW210 said: QSELECT>Block Reference>Name>*Wildcard Match>Smart Solid* Completely forgot about the "* Wildcard Match" Operator. That would definitely be the easiest way! Quote Link to comment Share on other sites More sharing options...
hasanarzuman Posted April 11, 2022 Share Posted April 11, 2022 On 11/14/2019 at 12:55 PM, SLW210 said: QSELECT>Block Reference>Name>*Wildcard Match>Smart Solid* This is brilliant way but i can’t fill value space. And i can’t see ‘smart solid’ Quote Link to comment Share on other sites More sharing options...
SLW210 Posted April 12, 2022 Share Posted April 12, 2022 Do you have a block named "Smart Solid"? Can you post the .dwg? Quote Link to comment Share on other sites More sharing options...
hasanarzuman Posted April 15, 2022 Share Posted April 15, 2022 I have tried one more time and it works. Thank you so much. I have forgotten /*/ to write. Quote Link to comment Share on other sites More sharing options...
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.