Selection Toys for Definition name?
-
Hello!
I have tried a few searches on this forum...but I still can't find...what I'm lookin' for. Hopefully you all can point me in the right direction.
So, another model has been constructed and exported as a 3DS file and then imported into SketchUp. The import is fairley clean, but I would like to have a quick way to select objects in the new SketchUp model for putting them on my standard layers.
Is there a plugin like Selection Toys that allows you to select entities with a certain definition name? i.e. - I have many object called "Wall01, Wall02, Wall03..." is there a way of quickly selecting all of the items just called "Wall" to change to a particular layer?
Thanks for any and all help.
Cheers!
-
Do you normally use Outliner for this?
-
You can use some simple 'one-liners' in the Ruby Console...
I'll explain the parts, then assemble them into a single line you can copy/paste into the Ruby Console, editing the component name 'cn'...
You need to manually make the layer and assign the selected component instances to it...
That process could also be included if you like...cn="^Wall"
the component-definition's name pattern.
note that "Wall" selects just wall, "^Wall" selects all starting with Wall, "^[Ww]all" includes those starting with upper and lower-case W, "^Wall[0-9]" limits it to those named Wall + a number 0 to 9 [and anything following]. To end a pattern use a final $ - so "^Wall[0-9]$" would NOT then match "Wall01" !
Edit this string to suit your needs...
m=Sketchup.active_model
ss=m.selection
ss.clear
as=m.active_entities
cs=as.grep(Sketchup::ComponentInstance).find_all{|e|e.definition.name=~/#{cn}/}
ss.add(cs)
And in just one line:
cn="^Wall";m=Sketchup.active_model;ss=m.selection;ss.clear;as=m.active_entities;cs=as.grep(Sketchup;;ComponentInstance).find_all{|e|e.definition.name=~/#{cn}/};ss.add(cs)
-
juju: Nope. I usually only use Groups, Components that track to Layers. Outliner is still pretty unused in my workflow (for now).
TIG: Thanks so much, man! I will try to get around to doing what you are suggesting a little later today and report back. I really appreciate the guidance!
-
Got it to work. Thanks, TIG!
@tig said:
You can use some simple 'one-liners' in the Ruby Console...
I'll explain the parts, then assemble them into a single line you can copy/paste into the Ruby Console, editing the component name 'cn'...
You need to manually make the layer and assign the selected component instances to it...
That process could also be included if you like...cn="^Wall"
the component-definition's name pattern.
note that "Wall" selects just wall, "^Wall" selects all starting with Wall, "^[Ww]all" includes those starting with upper and lower-case W, "^Wall[0-9]" limits it to those named Wall + a number 0 to 9 [and anything following]. To end a pattern use a final $ - so "^Wall[0-9]$" would NOT then match "Wall01" !
Edit this string to suit your needs...
m=Sketchup.active_model
ss=m.selection
ss.clear
as=m.active_entities
cs=as.grep(Sketchup::ComponentInstance).find_all{|e|e.definition.name=~/#{cn}/}
ss.add(cs)
And in just one line:
cn="^Wall";m=Sketchup.active_model;ss=m.selection;ss.clear;as=m.active_entities;cs=as.grep(Sketchup;;ComponentInstance).find_all{|e|e.definition.name=~/#{cn}/};ss.add(cs)
Advertisement