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__)) endThen 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.
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement