sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Select faces by material?

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    3 Posts 2 Posters 229 Views 2 Watching
    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

      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
      • TIGT Offline
        TIG Moderator
        last edited by

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

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

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

          Advertisement