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

    Globally select all groups in model?

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    37 Posts 4 Posters 895 Views 4 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.
    • F Offline
      fullyfledgeded
      last edited by

      I am currently trying to tidy up a SU model from 5 years ago (when i didn't use components πŸ˜• ), to make it workable for rendering.

      Is there anyway to select all groups, including nested ones at once, throughout the whole model? Then I can use TT's plugin to convert them to components? Or some code i can paste into the ruby console?

      I can select group copies one by one, but there are 1840 groups!

      Thanks

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

        Untested, I'm on my way out, but try this in the Ruby Console: (Save your model first, just in case)

        model=Sketchup.active_model;model.start_operation('G2C');model.definitions.each{|d|next unless d.group?;d.instances.each{|i|i.to_component}};model.commit_operation

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

        1 Reply Last reply Reply Quote 0
        • F Offline
          fullyfledgeded
          last edited by

          Hi thomthom, it worked thanks. However unfortunately it did not assign the individual group copies with the same component definition, but instead gave each copy it's own unique definition.

          multiple copies of one definition, is what i really need in order to make the model workable. Is there any way of tweaking it?

          After I ran your "[Plugin] Component Comparison (0.2.0a) β€” 15 August 2010" which achieved my aim on nested components too, but on a smaller file as the large file is struggling with both scripts

          cheers

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

            If his script selects all the groups you can right click a component in the component browser and replace selected. Oppps sorry, doesn't work that way with groups.

            1 Reply Last reply Reply Quote 0
            • F Offline
              fullyfledgeded
              last edited by

              Box, any idea how to tweak that code to achieve aim?

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

                I know less about coding than I do about pleasing women.

                But if you just want to replace a whole bunch of groups with the same component. It seems to me you can use outliner to select the groups, or if TT has given you something that selects the groups, then you can use convert groups to component and then swap them for the one you want, or Drop Components, another of Thomthoms.

                If it's more complex than that I can't help.

                But I'm sure he'll pop back here with just the thing after he has had his saturday lunchtime beer.

                1 Reply Last reply Reply Quote 0
                • F Offline
                  fullyfledgeded
                  last edited by

                  haha, yeah thanks Box. Unfortunately I have about 1500 groups, so going through the outliner or using the comp dropper would take till Christmas! TT's script converts all my groups to comps, but makes each group copy unique component definitions, thus increasing file size. which is the opposite of what i'm trying to achieve. Still progress though πŸ˜„

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

                    Ok, but once they are components, if they stay selected it's one click to replace all of them with one.

                    1 Reply Last reply Reply Quote 0
                    • F Offline
                      fullyfledgeded
                      last edited by

                      yeah, they don't stay selected & what one click would it be? make component. That wouldn't decrease the file size

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

                        You can replace selected, therefore you would be changing all the components to instances of one. so file size would be drastically reduced from multiple groups.

                        Try on another file, select various different components, then in the component browser right click on a component and select Replace component.

                        1 Reply Last reply Reply Quote 0
                        • F Offline
                          fullyfledgeded
                          last edited by

                          Sorry, maybe i didn't make myself clear. I have 1500 groups, comprised of many different group copies(different objects). E.g there are multiple copies of doors, windows, ceilings etc & replacing these with one component definition, would replace the multitude of different objects with one.

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

                            That's what I thought and why I said above, if it's more complex than that.........

                            and I was explaining my one click comment.

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

                              @fullyfledgeded said:

                              Sorry, maybe i didn't make myself clear. I have 1500 groups, comprised of many different group copies(different objects). E.g there are multiple copies of doors, windows, ceilings etc & replacing these with one component definition, would replace the multitude of different objects with one.

                              Ah, you had group copies of many different types of doors and windows etc - and wanted to convert geometrically identical groups into components? That is a very difficult task! I made an attempt a few years ago: http://sketchucation.com/forums/viewtopic.php?t=30143
                              Partially worked, but doesn't work with nested groups/components. Need to do some major rewrite to make that work - and I've simply not had time. 😞

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

                              1 Reply Last reply Reply Quote 0
                              • F Offline
                                fullyfledgeded
                                last edited by

                                Yes thomthom, that's right. I have had some success with http://sketchucation.com/forums/viewtopic.php?t=30143 even on nested comps'!!!:

                                but it doesn't work as well on the subject of this post, partly because loads of the comps' are grouped.

                                Is there any way of selecting every set of group copies globally,nested or not? It takes ages manually, using the outliner & anyway, context clicking them > group copies > covert to components, only seems to do one set at a time? Plus, the selection, can only be in one nested group/comp' at a time.

                                I would even pay good money for a script that does this, as if i can't find an alternative, i will have start the slow process one by one.

                                cheers

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

                                  Didn't my snippet I posted earlier convert all groups to components?

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

                                  1 Reply Last reply Reply Quote 0
                                  • F Offline
                                    fullyfledgeded
                                    last edited by

                                    It does, but it gives each group, it's own unique component definition name regardless of whether or not it is a group or group copy. I need the group copies to inherit the same component definition. Can the code be tweaked?

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

                                      So - are all groups supposed to be the same component? the geometry is identical between all of them?

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

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

                                        Ah - so the identical doors and windows etc are actually copes of each other? Entity info will say that there are copies of that group?
                                        In which case it should be possible to tweak the script.

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

                                        1 Reply Last reply Reply Quote 0
                                        • F Offline
                                          fullyfledgeded
                                          last edited by

                                          There are multiple geometrically identical:

                                          1. doors
                                          2. windows,
                                          3. walls

                                          etc, going up to about 200 different architectural objects.

                                          Way too many to convert manually with selection toys, as follows:

                                          context click > group copies > covert to components

                                          As it only seems to convert one at a time.

                                          1 Reply Last reply Reply Quote 0
                                          • F Offline
                                            fullyfledgeded
                                            last edited by

                                            yes, the identical doors and windows etc are actually copies of each other. Entity info does saythat there are copies of that group.

                                            Your selection toys, allows the doors and windows etc to be converted to comps' one by one, but not globally all at the same time(what i need) πŸ˜„. Oh & its kinda imperative that the code can globally locate them all too, so i don't have to do that manually.

                                            cheers

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement