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

    Selection by material: is there a plugin for this?

    Scheduled Pinned Locked Moved Plugins
    11 Posts 4 Posters 1.1k Views 4 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      You can use the built-in context-menu to select active geometry - Select a face with desired material, 'Select with same Material'
      It doesn't do Groups/Instances.
      This will do it...

      model=Sketchup.active_model
      ss=model.selection
      material=ss[0].material ### of 1st thing already selected
      ss.clear
      model.active_entities.each{|e|ss.add(e) if e.material==material}
      

      TIG

      1 Reply Last reply Reply Quote 0
      • EdsonE Offline
        Edson
        last edited by

        thanks, tig. you are always fast and tremendously helpful.

        should i place that code in the ruby console and run it or what?

        edson mahfuz, architect| porto alegre β€’ brasil
        http://www.mahfuz.arq.br

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          @edson said:

          thanks, tig. you are always fast and tremendously helpful.

          should i place that code in the ruby console and run it or what?

          Make a plain text file called selectbysamematerial.rb in ../Plugins/
          [I know you are a Mackie so find where that is 🀣 ]
          then paste this code into it [I've added some extra bits to make it a easier to use]

          require 'sketchup.rb'
          def selectbysamematerial()
            model=Sketchup.active_model
            ss=model.selection
            material=ss[0].material ### of 1st thing already selected
            ss.clear
            model.active_entities.each{|e|ss.add(e) if e.material==material}
          end#def
          
          

          to use or test type/paste into the Ruby Console selectbysamematerial
          To add a menu item paste this at the end of the file

          
          if not file_loaded?(File.basename(__FILE__))
            UI.menu("Plugins").add_item("Select by Same Material"){selectbysamematerial()}
          end
          file_loaded(File.basename(__FILE__))
          
          

          You can change the menu item text to "Selecione pelo Mesmo Material" if you like... πŸ˜„

          TIG

          1 Reply Last reply Reply Quote 0
          • EdsonE Offline
            Edson
            last edited by

            hi tig,

            thanks so much again. i followed your instructions but got the message below. i probably botched it somehow, ignoramus in ruby matters that i am. please find the script attached.


            selectbysame.png


            selectbysamematerial.rb

            edson mahfuz, architect| porto alegre β€’ brasil
            http://www.mahfuz.arq.br

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              I added such a feature for the next iterations of Selection Toys a couple of days ago - though it's not released yet.

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                @edson said:

                hi tig,
                thanks so much again. i followed your instructions but got the message below. i probably botched it somehow, ignoramus in ruby matters that i am. please find the script attached.

                Here it is corrected - you somehow had go '? ' at the start of every line of code rather than ' ' ??? ❗ ❓ πŸ˜• πŸ˜’selectbysamematerial.rb

                TIG

                1 Reply Last reply Reply Quote 0
                • EdsonE Offline
                  Edson
                  last edited by

                  tig,

                  it works like a charm. thanks again.

                  edson mahfuz, architect| porto alegre β€’ brasil
                  http://www.mahfuz.arq.br

                  1 Reply Last reply Reply Quote 0
                  • Didier BurD Offline
                    Didier Bur
                    last edited by

                    My "quick selection tool" does this also, and more πŸ˜‰

                    DB

                    1 Reply Last reply Reply Quote 0
                    • EdsonE Offline
                      Edson
                      last edited by

                      @didier bur said:

                      My "quick selection tool" does this also, and more πŸ˜‰

                      didier,
                      to tell you the truth, my first try was with your quick selection tool – it used to be a very handy tool for me in the past – but it did not work. it never worked perfectly on my mac but after the release of 7.1 it became almost useless: the only thing i manage to select with it are components. at least for me, it will not select any materials.

                      edson mahfuz, architect| porto alegre β€’ brasil
                      http://www.mahfuz.arq.br

                      1 Reply Last reply Reply Quote 0
                      • Didier BurD Offline
                        Didier Bur
                        last edited by

                        It seems that I have more and more updates to do, and not enough time for it now πŸŽ‰

                        DB

                        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