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

Group by Layer

Scheduled Pinned Locked Moved Extensions & Applications Discussions
extensions
20 Posts 3 Posters 3.3k 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.
  • J Offline
    JQL
    last edited by 11 Aug 2022, 14:37

    You're too cool! Thanks!

    www.casca.pt
    Visit us on facebook!

    1 Reply Last reply Reply Quote 0
    • R Offline
      Rich O Brien Moderator
      last edited by 11 Aug 2022, 14:43

      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
      • R Offline
        Rich O Brien Moderator
        last edited by 11 Aug 2022, 14:48

        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
        • J Offline
          JQL
          last edited by 11 Aug 2022, 14:50

          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
          • J Offline
            JQL
            last edited by 11 Aug 2022, 14:59

            @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
            • R Offline
              Rich O Brien Moderator
              last edited by 11 Aug 2022, 15:57

              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
              • J Offline
                JQL
                last edited by 11 Aug 2022, 16:06

                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
                • R Offline
                  Rich O Brien Moderator
                  last edited by 11 Aug 2022, 16:20

                  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
                  • J Offline
                    JQL
                    last edited by 11 Aug 2022, 16:59

                    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
                    • J Offline
                      JQL
                      last edited by 11 Aug 2022, 21:47

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

                      Advertisement