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

    Group by Layer

    Scheduled Pinned Locked Moved Extensions & Applications Discussions
    extensions
    20 Posts 3 Posters 3.5k 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.
    • BoxB Online
      Box
      last edited by

      Bloody autocorrect.

      1 Reply Last reply Reply Quote 0
      • BoxB Online
        Box
        last edited by

        @rich o brien said:

        Just locking his poor spelling before he edits πŸ˜›

        You write a thousand eloquent posts, do they call you box the eloquent...
        You shag one sheep!

        1 Reply Last reply Reply Quote 0
        • Rich O BrienR Offline
          Rich O Brien Moderator
          last edited by

          @jql said:

          So Group by Tag anyone?

          What's wrong with the vanilla approach?

          @box said:

          You shag one sheep!

          They call you Kiwi

          Download the free D'oh Book for SketchUp πŸ“–

          1 Reply Last reply Reply Quote 0
          • JQLJ Offline
            JQL
            last edited by

            @rich o brien said:

            If you right click the tag/layer in tag/layer panel and choose...

            https://i.imgur.com/ns9cTf5.png

            ...then group that selection

            That's pretty cool, I was using selection toys.

            However, too many right-clicks, I think I would rather keep things unorganized.

            a bit too much right clicks, I can handle as it is.gif

            www.casca.pt
            Visit us on facebook!

            1 Reply Last reply Reply Quote 0
            • Rich O BrienR Offline
              Rich O Brien Moderator
              last edited by

              I'm pretty sure TIG wrote a snippet for this at one point. I'll try find it

              Download the free D'oh Book for SketchUp πŸ“–

              1 Reply Last reply Reply Quote 0
              • JQLJ Offline
                JQL
                last edited by

                You're too cool! Thanks!

                www.casca.pt
                Visit us on facebook!

                1 Reply Last reply Reply Quote 0
                • Rich O BrienR Offline
                  Rich O Brien Moderator
                  last edited by

                  Or set this...

                  https://i.imgur.com/TZttVCF.png

                  ...then click the chevron to expose details...

                  https://i.imgur.com/3eI8m0R.png

                  ...then install and test if TIG's description suggests it may do what you need.

                  Download the free D'oh Book for SketchUp πŸ“–

                  1 Reply Last reply Reply Quote 0
                  • Rich O BrienR Offline
                    Rich O Brien Moderator
                    last edited by

                    I knew he posted a snippet once...

                    https://sketchucation.com/forums/viewtopic.php?p=427644#p427644

                    ...fails in 2022 though. Maybe he'll see this thread and chime in.

                    Download the free D'oh Book for SketchUp πŸ“–

                    1 Reply Last reply Reply Quote 0
                    • JQLJ Offline
                      JQL
                      last edited by

                      I think the objective of that one is to have edges and faces sent to layer0. That is aimed at fixing most errors caused by having raw geometry in that layer.

                      In my case I really don't want to loose the layer of raw geometry unless it becomes grouped by layer first and the group is given that same layer.

                      So, what I want to do is exactly what you showed on your image: go through each layer, select objects and group them; if possible change the group from Layer0 into the selected layer; and then I can send all raw geometry into Layer0 as it has already been grouped and the group is in the correct layer.

                      I'm going to read better what each of those Layer plugins does.

                      @Box, just replace each of the "layer" above by "tag" and you get the point.

                      @Rich, I was replying to your previous post. I will see what you posted now.

                      www.casca.pt
                      Visit us on facebook!

                      1 Reply Last reply Reply Quote 0
                      • JQLJ Offline
                        JQL
                        last edited by

                        @rich o brien said:

                        I knew he posted a snippet once...

                        https://sketchucation.com/forums/viewtopic.php?p=427644#p427644

                        ...fails in 2022 though. Maybe he'll see this thread and chime in.

                        The description he has in the snippet post is exactly what I need.

                        Bummer!

                        It would be very cool if he would chime in indeed.

                        www.casca.pt
                        Visit us on facebook!

                        1 Reply Last reply Reply Quote 0
                        • Rich O BrienR Offline
                          Rich O Brien Moderator
                          last edited by

                          I was wrong. It does work...

                          m=Sketchup.active_model;a=m.active_entities;s=[];m.start_operation("!");a.to_a.each{|e|s<<e if e.layer==m.layers[0]};g=a.add_group(s);g.name=m.layers[0].name;g.layer=nil;(g.entities.each{|i|i.layer=nil})unless s.empty?;m.layers.to_a[1..-1].each{|l|s=[];a.to_a.each{|e|s<<e if e.layer==l};next if s.empty?;g=a.add_group(s);g.name=l.name;g.layer=l;g.entities.each{|i|i.layer=nil};};m.commit_operation;
                          
                          

                          You need to have a group selected that is on Layer0 it then iterates through the model groups things to layer

                          Download the free D'oh Book for SketchUp πŸ“–

                          1 Reply Last reply Reply Quote 0
                          • JQLJ Offline
                            JQL
                            last edited by

                            It must be a group? I will try it then. Just paste this in the console, right?

                            www.casca.pt
                            Visit us on facebook!

                            1 Reply Last reply Reply Quote 0
                            • Rich O BrienR Offline
                              Rich O Brien Moderator
                              last edited by

                              It seems so. I'm not 100% on what needs to be selected but it seems to rename the selected group and then do some magic.

                              Try on sample first

                              Download the free D'oh Book for SketchUp πŸ“–

                              1 Reply Last reply Reply Quote 0
                              • JQLJ Offline
                                JQL
                                last edited by

                                Too late, I've tried it in the model directly and it's taking a lot of time. I don't know if I should just shut it down, try it in a sample, and then leave it on the whole night. It might finish right now, or it might take a week... who knows?

                                www.casca.pt
                                Visit us on facebook!

                                1 Reply Last reply Reply Quote 0
                                • JQLJ Offline
                                  JQL
                                  last edited by

                                  So I made a simple model and tested the snippet without selecting anything. It works flawlessly.

                                  I don't think it iterates inside groups. Only tried on loose geometry, but I'm going to try That.

                                  EDIT: What it does seems to be doing is grouping all groups in the model into a new group called Layer0. It doesn't act inside those groups. This is cool and a way to control the scope.

                                  Geometry to be affected by the snippet should be in root of the model.

                                  EDIT2: Groups that are tagged already, get their objects inside grouped and stripped from tags. This happens even if they have no tags. All other groups are grouped together in a group called Layer0

                                  www.casca.pt
                                  Visit us on facebook!

                                  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