Select faces by material?
-
Is there any way I can take a model, with a bunch of groups, and select only the faces that have a given material (with every face in the entire model regardless of group being checked)?
I have found several scripts, one in particular, "material_selection.rb" that almost do the job, except they check the material of a group, not the individual faces within the group, and add the entire group to the selection.
My model is made up of cubes, usually only 1 face on the cube has a texture, so I wanted to delete the other faces, but there are far too many to do it manually.
Any help greatly appreciated
-
...or to put your request another way...

How to delete faces [and any consequent unneeded edges] inside selected groups, IF they have no material...
This one liner does that...m=Sketchup.active_model; m.start_operation('X'); m.selection.grep(Sketchup;;Group).each{|g|g.entities.grep(Sketchup;;Face).each{|f|f.erase! unless f.material};g.entities.grep(Sketchup;;Edge).each{|e|e.erase! unless e.faces[0]} }; m.commit_operation;This code copy/pasted into the Ruby Console deletes all faces inside pre-selected groups, if they do not have a material assigned to them, it then removes any faceless edges. It is one step undo-able...
-
Thanks TIG! I will put in a good word for you if I die first.
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