CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.
Please abide by the
rules of this forum.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
Author |
Topic Search Topic Options
|
callvey
Newbie
Joined: 04.Apr.2013
Location: United Kingdom
Using: AutoCAD Architecture 2012
Status: Offline
Points: 6
|
Topic: Select list of blocks from specific layers Posted: 04.Apr.2013 at 21:10 |
Hi
I have been trying to achieve this all day using filters and a vba macro I found online but its turning out to be a lot harder than I first thought.
I am trying to select a list of blocks (89 in total) that sit on 4 different layers in a drawing and put them on a new layer that I have already created.
Is this something that can be done through a macro or shall I just bite the bullet and get stuck in manually??
Any guidance please?
Thanks
Tom
|
|
CarlB
Senior Member
Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
|
Posted: 04.Apr.2013 at 22:57 |
Did you try the "SSX" command (Express Tools)? Should work ok, if you don't have a long list of block names.
|
|
heinsite
Senior Member
Joined: 05.Feb.2009
Location: United States
Using: AutoCAD 2014
Status: Offline
Points: 640
|
Posted: 05.Apr.2013 at 09:23 |
Experiment with SELECTSIMILAR. You can tweak the settings to include pretty much the specificity you need.
Dave.
|
Dave Hein, P.E. Hawaii District Engineer Kona International Airport AutoCAD Certified Professional Autodesk Expert Elite
|
|
callvey
Newbie
Joined: 04.Apr.2013
Location: United Kingdom
Using: AutoCAD Architecture 2012
Status: Offline
Points: 6
|
Posted: 05.Apr.2013 at 10:34 |
Thanks for your replies.
Unfortunately both methods ssx and select similar do not work as there are more objects on the 4 layers other than the blocks I want to select.
I think my only option would be to use a macro to do this.
Many thanks
Tom
|
|
John Connor
Senior Member
Joined: 01.Feb.2011
Location: United States
Using: AutoCAD 2018
Status: Offline
Points: 7175
|
Posted: 05.Apr.2013 at 11:40 |
It sounds more like you need a custom lisp routine not a macro.
|
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."
<<AutoCAD 2015>>
|
|
callvey
Newbie
Joined: 04.Apr.2013
Location: United Kingdom
Using: AutoCAD Architecture 2012
Status: Offline
Points: 6
|
Posted: 05.Apr.2013 at 11:44 |
Do you know of an example script that i can analyse please.
Thanks
|
|
heinsite
Senior Member
Joined: 05.Feb.2009
Location: United States
Using: AutoCAD 2014
Status: Offline
Points: 640
|
Posted: 05.Apr.2013 at 12:23 |
And QSELECT didn't work for you either?
Dave.
|
Dave Hein, P.E. Hawaii District Engineer Kona International Airport AutoCAD Certified Professional Autodesk Expert Elite
|
|
CarlB
Senior Member
Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
|
Posted: 05.Apr.2013 at 17:28 |
I believe SSX doesn't work because it allows only a single block name & a single layer for a selection filter. A lisp routine may be not difficult, how many different blocks are you selecting, and would you want to enter name or select them?
|
|
Kent Cooper
Senior Member
Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 627
|
Posted: 05.Apr.2013 at 20:20 |
There may be a limit on string length that would prevent listing all 89 Block names in one run, in which case you might need to break it down, but you can find multiple Blocks on multiple Layers in one (ssget) function, with comma-delimited lists:
(ssget "_X" '((2 . "Block1,Block2,Block3") (8 . "Layer1,Layer2,Layer3")))
Depending on how the Block names vary, you could possibly shorten it with wildcards the same as can be used in (wcmatch).
|
|
callvey
Newbie
Joined: 04.Apr.2013
Location: United Kingdom
Using: AutoCAD Architecture 2012
Status: Offline
Points: 6
|
Posted: 09.Apr.2013 at 17:16 |
That works Kent thanks!
How do I use this in a lisp I have this but it doesn't work?
(defun BS1 () (ssget "x" '((8 . "fxpm,fxw,fxdt,ardt")(2 . "4plug,CP-CAB-TRANSACTION,04-INKCORRAL-CHECKOUT-2-L,04-INKCORRAL-CHECKOUT-2-R,04-INKCORRAL-CHECKOUT-L,04-INKCORRAL-CHECKOUT-R,2PLUG,3PLUG,6plug,AMAZON-LOCKER-08,AMAZON-LOCKER-10,CP-CAB-LIVEBAR,AMAZON-LOCKER-11,AMAZON-LOCKER-13,AMAZON-LOCKER-14,BALER-1800HD,BALER-360,BC-COUNTER-CONSULT-96,BC-COUNTER-CONSULT-96-L,BC-COUNTER-CONSULT-96-R,BC-COUNTER-POS-L-108,BC-COUNTER-POS-R-108,BC-COUNTER-SHIP-L-76,BC-COUNTER-SHIP-R-76,BR17-NPC,BT-ANSWER-BAR-3,BT-CAB-ANSWER-BAR,BT-CAB-ANSWER-BAR-2,BT-CAB-CELLBAR,BT-CORE-GRAPHICS-22,BT-COUNTER-CONSULT-96,BT-COUNTER-POS-L-108,BT-COUNTER-POS-R-108,BT-EREADERS-TABLETS,CC-AM-48,CC-CAT105,CC-CS10-SSC-CABINET,CC-HPZ2100-24,CC-HPZ2100-44,CC-HSB,CC-HSC,CC-KM4850,CC-LFB,CC-LFC,CC-MEDIA-360")))
|
|