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

    Selecting Groups by Name

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    5 Posts 2 Posters 341 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
      jamesn320
      last edited by

      Is there an easy way to select all groups that have the same name?

      I have imported a large model from Tekla, it has not created separate layers but it has grouped each assembly. One group for each column etc. I want to texture all the steel, concrete, asphalt etc differently but this would be a very time consuming processes unless I can easily select all groups with the same name. Unless there is another way?

      http://i893.photobucket.com/albums/ac133/jamesn320/Object Name_zpsqufmahbn.jpg

      Cheers,

      James

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        @jamesn320 said:

        Is there an easy way to select all groups that have the same name?

        I have imported a large model from Tekla, it has not created separate layers but it has grouped each assembly. One group for each column etc. I want to texture all the steel, concrete, asphalt etc differently but this would be a very time consuming processes unless I can easily select all groups with the same name. Unless there is another way?

        http://i893.photobucket.com/albums/ac133/jamesn320/Object Name_zpsqufmahbn.jpg

        Cheers,

        James

        Your example is a component instance so I assume that is what is to be selected rather than groups.

        The following code can be pasted into the Ruby Console and executed to select Component instances by name

        mod = Sketchup.active_model
        ent = mod.active_entities
        sel = mod.selection
        cin = ent.grep(Sketchup;;ComponentInstance).map{|ci|ci.name}.uniq.sort
        ipb = UI.inputbox(["Name to Select;"],[cin[0]],[cin.join("|")],"Select by Name")
        if ipb
          sel.clear
          ent.grep(Sketchup;;ComponentInstance).each{|ci|
            sel.add ci if ci.name==ipb[0]
          }
        end
        
        

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 Reply Last reply Reply Quote 0
        • J Offline
          jamesn320
          last edited by

          Wow! Thanks. That is exactly what I wanted. I have never used the Ruby Console before. Your code even adds the different groups names to the drop down menu.

          Thank you very much!

          James

          1 Reply Last reply Reply Quote 0
          • J Offline
            jamesn320
            last edited by

            I feel like I am about to go on a steep learning curve, is it possible to add that script into a button on the tool bar?

            Cheers,

            James

            1 Reply Last reply Reply Quote 0
            • J Offline
              jamesn320
              last edited by

              I've got it to now be on the drop down menu, Happy days. πŸ˜„

              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