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

    Selecting only Lock Groups

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 3 Posters 540 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.
    • kenK Offline
      ken
      last edited by

      Is it possible to select only locked groups, so I could separate the locked from the unlocked?

      Ken, thanks in advance

      Fight like your the third monkey on Noah's Ark gangway.

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by

        Sure. Just query the component.locked? or group.locked? methods.

        FYI - there is a current bug that allows a locked group or comp to be moved by Ruby (unless it's been fixed by a recent maintenance release that I've chosen to ignore).

        1 Reply Last reply Reply Quote 0
        • kenK Offline
          ken
          last edited by

          Thanks Todd for your response. Guess I put my question in the wrong group. I was wondering if there was a Ruby Script to just select locked groups or components.

          Guess there isn't as of now.

          Again thanks.

          Ken

          Fight like your the third monkey on Noah's Ark gangway.

          1 Reply Last reply Reply Quote 0
          • A Offline
            a4chitect
            last edited by

            Sketchup.active_model.active_entities.each{|ent|
            if(ent.typename=="Group" && ent.locked?)
            Sketchup.active_model.selection.add ent
            end
            }
            

            paste the above into a ruby console (I suggest using Jim's Webconsole) and Execute

            Link Preview Image
            Plugin: WebConsole

            2010-05-22 * Eliminated the Results textarea in favor of SketchUp's Ruby Console. * Automatic resize of the code textarea. * Changed ...

            favicon

            (sketchuptips.blogspot.com)

            warning: no testing for errors or bugs, use at your own risk

            1 Reply Last reply Reply Quote 0
            • T Offline
              todd burch
              last edited by

              I can code that in one statement.... πŸ‘Š

              
              Sketchup.active_model.selection.add((Sketchup.active_model.entities.collect {|ent| ent if ent.locked?}).to_a.compact)
              
              

              πŸ€“

              Todd

              1 Reply Last reply Reply Quote 0
              • A Offline
                a4chitect
                last edited by

                all right, respect. there you go webconsole πŸ˜‰

                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