Is there a way to select all with Default material?
-
It's easy enough to select a material and pick "Select all with same material" but, of course, for whatever reason, this function doesn't work with SU's Default material. Is there a plugin that's rectified this?
-Brodie
-
Brodie,
Remember faces have a front and a back. One can have material applied and the other not. So open the Ruby Console and paste this into the input box
Sketchup.active_model.entities.each{|e| Sketchup.active_model.selection.add e if e.is_a?(Sketchup;;Face) && e.material==nil && e.back_material==nil}
This will select all faces that have default material on front and back.
-
When i do that nothing happens and it replies with this in the ruby console
Error: #<NameError: undefined local variable or method `ent' for main:Object>
(eval):2537Am I doing something wrong?
-Brodie
-
Here's a slightly modified version
m=Sketchup.active_model;(s=m.selection).clear;m.active_entities.each{|e|s.add(e)if e.is_a?(Sketchup;;Face)&&!e.material&&!e.back_material}
Copy the whole of the code into the Ruby Console and press <enter>.
-
That's the ticket. Can you give me a quick rundown on how I'd give that a shortcut key? I'm guessing it needs to be turned into a .rb but I'll bet there's a bit more code that needs to go into it than just that bit. Any tips?
-Brodie
-
Selection Toys let you do that.
-
@unknownuser said:
That's the ticket. Can you give me a quick rundown on how I'd give that a shortcut key? I'm guessing it needs to be turned into a .rb but I'll bet there's a bit more code that needs to go into it than just that bit. Any tips?
-Brodie
Copy/paste this code into a file called 'TIG-selectByDefaultMaterial.rb
' in the ../Plugins/ foldermodule TIG def self.selectByDefaultMaterial() m=Sketchup.active_model (s=m.selection).clear m.active_entities.each{|e|s.add(e)if e.is_a?(Sketchup;;Face)&&!e.material&&!e.back_material} end UI.menu("Plugins").add_item("Select By Default Material"){self.selectByDefaultMaterial()}unless file_loaded?(File.basename(__FILE__)) file_loaded(File.basename(__FILE__)) end
Then the 'Select By Default Material' item in the Plugins menu can be assigned a shortcut after a restart...
-
Thanks, that did the trick
-Brodie
-
@tig said:
@unknownuser said:
That's the ticket. Can you give me a quick rundown on how I'd give that a shortcut key? I'm guessing it needs to be turned into a .rb but I'll bet there's a bit more code that needs to go into it than just that bit. Any tips?
-Brodie
Copy/paste this code into a file called 'TIG-selectByDefaultMaterial.rb
' in the ../Plugins/ foldermodule TIG > def self.selectByDefaultMaterial() > m=Sketchup.active_model > (s=m.selection).clear > m.active_entities.each{|e|s.add(e)if e.is_a?(Sketchup;;Face)&&!e.material&&!e.back_material} > end > UI.menu("Plugins").add_item("Select By Default Material"){self.selectByDefaultMaterial()}unless file_loaded?(File.basename(__FILE__)) > file_loaded(File.basename(__FILE__)) > end >
Then the 'Select By Default Material' item in the Plugins menu can be assigned a shortcut after a restart...
TIG is in Hollyday could an other developer tell me, why i can´t seen this in the plugin menue?
thank you
-
I followed the instructions and it works for me.
-
Advertisement