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!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Command to select all on same layer?

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    4 Posts 3 Posters 1.2k Views 3 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.
    • D Offline
      danbig
      last edited by

      This works great for ungrouped lines or faces. Is there a way to do this with groups and components?

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

        Not without Ruby...
        This one-liner will work, select ONE object on the required layer and then copy/paste this code into The Ruby Console +<enter> and the selection will expand to include everything in the "current context" that's on that same layer...

        
        m=Sketchup.active_model;s=m.selection;l=s[0].layer;s.clear;m.active_entities.each{|e|s.add e if e.layer==l}
        
        

        Here's a ' def' version of it - it's probably a little clearer - you can copy this code into a file in ../Plugins/ called "selectbylayer.rb"

        def selectbylayer()
          model=Sketchup.active_model
          ss=model.selection
          layer=ss[0].layer
          ss.clear
          model.active_entities.each{|e|ss.add e if e.layer==layer}
        end#def
        

        Then to run it you can type selectbylayer into the Ruby Console.
        To add a Plugins Menu item add this extra code to the end of the new .rb file [after the end#def]

        
        if not file_loaded?(File.basename(__FILE__))
          UI.menu("Plugins").add_item(("Select by Layer"){selectbylayer()})
        end#if
        file_loaded(File.basename(__FILE__))
        
        

        To run it you pick "Select by Layer" off the Plugins Menu.
        I'll leave the toolbar up to you... πŸ˜‰

        TIG

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

          Selection Toys will let you do that:
          http://forums.sketchucation.com/viewtopic.php?f=323&t=14975

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

          1 Reply Last reply Reply Quote 0
          • D Offline
            danbig
            last edited by

            Thanks, all. Just when you think you've reviewed all the plugins out there...

            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