Selection by material: is there a plugin for this?
-
i wanted to select a number of elements by their material and then erase them but could not find a plugin for this. i ran a search here and came out empty handed. would anyone know of a plugin that does that?
-
You can use the built-in context-menu to select active geometry - Select a face with desired material, 'Select with same Material'
It doesn't do Groups/Instances.
This will do it...model=Sketchup.active_model ss=model.selection material=ss[0].material ### of 1st thing already selected ss.clear model.active_entities.each{|e|ss.add(e) if e.material==material}
-
thanks, tig. you are always fast and tremendously helpful.
should i place that code in the ruby console and run it or what?
-
@edson said:
thanks, tig. you are always fast and tremendously helpful.
should i place that code in the ruby console and run it or what?
Make a plain text file called
selectbysamematerial.rb
in../Plugins/
[I know you are a Mackie so find where that is ]
then paste this code into it [I've added some extra bits to make it a easier to use]require 'sketchup.rb' def selectbysamematerial() model=Sketchup.active_model ss=model.selection material=ss[0].material ### of 1st thing already selected ss.clear model.active_entities.each{|e|ss.add(e) if e.material==material} end#def
to use or test type/paste into the Ruby Console
selectbysamematerial
To add a menu item paste this at the end of the fileif not file_loaded?(File.basename(__FILE__)) UI.menu("Plugins").add_item("Select by Same Material"){selectbysamematerial()} end file_loaded(File.basename(__FILE__))
You can change the menu item text to "Selecione pelo Mesmo Material" if you like...
-
hi tig,
thanks so much again. i followed your instructions but got the message below. i probably botched it somehow, ignoramus in ruby matters that i am. please find the script attached.
-
I added such a feature for the next iterations of Selection Toys a couple of days ago - though it's not released yet.
-
@edson said:
hi tig,
thanks so much again. i followed your instructions but got the message below. i probably botched it somehow, ignoramus in ruby matters that i am. please find the script attached.Here it is corrected - you somehow had go '? ' at the start of every line of code rather than ' ' ??? selectbysamematerial.rb
-
tig,
it works like a charm. thanks again.
-
My "quick selection tool" does this also, and more
-
@didier bur said:
My "quick selection tool" does this also, and more
didier,
to tell you the truth, my first try was with your quick selection tool β it used to be a very handy tool for me in the past β but it did not work. it never worked perfectly on my mac but after the release of 7.1 it became almost useless: the only thing i manage to select with it are components. at least for me, it will not select any materials. -
It seems that I have more and more updates to do, and not enough time for it now
Advertisement