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

    [REQ] Open and close all nested groups in selection

    Scheduled Pinned Locked Moved Plugins
    19 Posts 7 Posters 1.1k Views 7 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.
    • tt_suT Offline
      tt_su
      last edited by

      From what I can gather this action is done in order to make groups unique - for that there is group.make_unique. That appears to be a more correct way to address it - you are after all looking for unique instances.

      Not saying that being able to open an instance wouldn't be useful. (There is a way to close instances already, having a way to open would be a nice symmetry.)

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

        That would also be handy for Revit DWG import, as it seems in this post here:

        http://sketchucation.com/forums/viewtopic.php?f=11%26amp;t=61846

        User and me were misguided by the fact that groups even call themselves components in that situation. I hadn't noticed that before and even if I was aware of groups behaving like components, I would never get so far as thinking the bastards would use their name too...

        Another thing that is related to this, is that if you want to edit the name of a copy of an unedited group. Because of some conflict with existing component you always get a popup message saying you can't do that for components though right after that message you can after all. Very annoying and time consuming. (Now that I think of it I haven't seen that message that much lately... something fixed?)

        www.casca.pt
        Visit us on facebook!

        1 Reply Last reply Reply Quote 0
        • PixeroP Offline
          Pixero
          last edited by

          Would this work?

          
          selection=Sketchup.active_model.selection 
          selection.grep(Sketchup;;Group) {|group| group.make_unique }
          
          
          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            After the selection grep you need a .each ...
            Sketchup.active_model.selection.grep(Sketchup::Group)**.each**{|g| g.make_unique }
            or to do it to ALL groups do this ...
            Sketchup.active_model.definitions.select{|d| d.group? }.each{|g| g.make_unique }

            TIG

            1 Reply Last reply Reply Quote 0
            • PixeroP Offline
              Pixero
              last edited by

              Thanks.

              1 Reply Last reply Reply Quote 0
              • KrisidiousK Offline
                Krisidious
                last edited by

                I use the backout plugin to exit nested groups...

                By: Kristoff Rand
                Home DesignerUnique House Plans

                1 Reply Last reply Reply Quote 0
                • PixeroP Offline
                  Pixero
                  last edited by

                  Hmm...I tried it exactly as you wrote but it didn't work. πŸ˜•

                  But, if I manually double click to open the groups and then close them and run the hide intersecting edges script it works.

                  Any ideas what could be missing?
                  I don't get any error messages in the console.

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

                    If you use this line in the Ruby Console what is listed ?
                    gps = Sketchup.active_model.selection.grep(Sketchup::Group)
                    If it's a list of selected groups, then what happens with this ?
                    gps.each{|g| g.make_unique if g.entities.parent.instances[1] }
                    There's no need to use 'make_unique' unless there are multiple copies ??

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • PixeroP Offline
                      Pixero
                      last edited by

                      That seem to work.
                      Again, thanks!

                      1 Reply Last reply Reply Quote 0
                      • PixeroP Offline
                        Pixero
                        last edited by

                        I spoke to soon. It doesn't work if there are nested groups.

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

                          I knew I had seen a similar discussion some where. This might be what you are looking for.

                          http://sketchucation.com/forums/viewtopic.php?p=346107#p346107

                          I think there is a newer version in the plugin store.

                          Never mind, as written, the plugin fails with nested groups.

                          I think it would be an easy fix.

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

                          http://sdmitch.blogspot.com/

                          1 Reply Last reply Reply Quote 0
                          • tt_suT Offline
                            tt_su
                            last edited by

                            @tig said:

                            After the selection grep you need a .each ...

                            .grep takes a block which it will invoke on all matched elements. On large sets it's somewhat faster.

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              CAUL
                              last edited by

                              @pixero said:

                              As a way of automating the process from here:
                              http://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=61842#p565790
                              Can someone make a script that open and close all nested groups in a selection?

                              The code below makes a recursive traversal through nested groups. I will add an UI to the hide overlapping extension where make_unique is an option.

                                
                                def self.makeUnique(ents)
                                  ents.grep(Sketchup;;Group).each { |g|
                                    g.make_unique
                                    makeUnique(g.entities)
                                  }
                                end
                              
                                makeUnique(Sketchup.active_model.selection)
                              
                              1 Reply Last reply Reply Quote 0
                              • PixeroP Offline
                                Pixero
                                last edited by

                                I tried your code but it didn't work with nested groups either. 😞

                                nested_groups_error.jpg

                                1 Reply Last reply Reply Quote 0
                                • C Offline
                                  CAUL
                                  last edited by

                                  @pixero said:

                                  I tried your code but it didn't work with nested groups either. 😞

                                  I think there are two issues here.

                                  1. HideOverlappingGeometry does not compare groups within a common top group. So in your example, the 4 boxes within a group will not be compared with each other, they will however be compared to the 4 boxes in the other group. That's just a choice I made in the extension that reflects the way I use the script. If you want to hide the seams between the groups within a group you have to enter the group and select all groups within and then run the script. I think I will add an option to the extension so that is also compares stuff within the same nesting.

                                  2. I don't quite see why the provided code doesn't work in your example. I tried with a similar example and the groups all became unique. Do you have a sample model?

                                  1 Reply Last reply Reply Quote 0
                                  • PixeroP Offline
                                    Pixero
                                    last edited by

                                    Here is a simple example file.
                                    A real life model would probably have more nested levels.

                                    NestedGroups.skp

                                    1 Reply Last reply Reply Quote 0
                                    • C Offline
                                      CAUL
                                      last edited by

                                      @pixero said:

                                      Here is a simple example file.
                                      A real life model would probably have more nested levels.

                                      I get the result below (and the nested groups also becomes unique):


                                      Before


                                      After

                                      1 Reply Last reply Reply Quote 0
                                      • PixeroP Offline
                                        Pixero
                                        last edited by

                                        Ok, so then it's a matter of you implementing the compare overlapping edges in nested groups?

                                        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