• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Selection by material: is there a plugin for this?

Scheduled Pinned Locked Moved Plugins
11 Posts 4 Posters 964 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.
  • E Offline
    Edson
    last edited by 11 Jan 2010, 18:49

    i wanted to select a number of elements by their material and then erase them but could not find a plugin for this. i ran a search here and came out empty handed. would anyone know of a plugin that does that?

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

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 11 Jan 2010, 18:57

      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
      • E Offline
        Edson
        last edited by 11 Jan 2010, 19:12

        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
        • T Offline
          TIG Moderator
          last edited by 11 Jan 2010, 19:47

          @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
          • E Offline
            Edson
            last edited by 11 Jan 2010, 21:21

            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
            • T Offline
              thomthom
              last edited by 11 Jan 2010, 21:26

              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
              • T Offline
                TIG Moderator
                last edited by 12 Jan 2010, 10:20

                @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
                • E Offline
                  Edson
                  last edited by 12 Jan 2010, 17:51

                  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
                  • D Offline
                    Didier Bur
                    last edited by 12 Jan 2010, 20:48

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

                    DB

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      Edson
                      last edited by 12 Jan 2010, 21:30

                      @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
                      • D Offline
                        Didier Bur
                        last edited by 13 Jan 2010, 17:56

                        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
                        1 / 1
                        • First post
                          8/11
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement