• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Select faces by material?

Scheduled Pinned Locked Moved Newbie Forum
sketchup
3 Posts 2 Posters 193 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    JESTERRRRRR
    last edited by 3 Jun 2014, 04:13

    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

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 3 Jun 2014, 09:05

      ...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...

      TIG

      1 Reply Last reply Reply Quote 0
      • J Offline
        JESTERRRRRR
        last edited by 3 Jun 2014, 14:12

        Thanks TIG! I will put in a good word for you if I die first.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          3/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement