sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Globally select all groups in model?

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    37 Posts 4 Posters 908 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.
    • 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
                      • thomthomT Offline
                        thomthom
                        last edited by

                        Try this quick mashup.


                        tt_g2c.rbz

                        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

                          @fullyfledgeded said:

                          Oh & its kinda imperative that the code can globally locate them all too, so i don't have to do that manually.

                          "Globally locate"?

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

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

                            TT posted his ahead of me, perhaps it is better...

                            So to put this another way...
                            You want to find all groups in the active_entities collection that are duplicate copies.
                            Then to make the first one into a component-instance, and then to replace all of the other copies with instances of that new component...
                            Try this one-liner in the Ruby Console...

                            m=Sketchup.active_model;m.start_operation('g2c');m.active_entities.grep(Sketchup;;Group).each{|g|next unless g.valid?;s=g.entities.parent.instances; next unless s[1]; n=s[0].name;d=s[0].to_component.definition;d.name=n if n!='';s[1..-1].each{|e|i=e.to_component;b=i.definition;i.definition=d;b.entities.clear!;};};m.commit_operation;
                            

                            It's one step undoable.
                            It processes duplicated groups in the active_entities.
                            It names the new component after the group, but if that's '', then it is called 'Group#123' etc...

                            TIG

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

                              TIG, your code works perfectly, provided groups that are duplicate copies to be found, are in the active selection set. I have attachedTIG code test.skp in case this doesn't make sense.

                              In the outliner, Please select the contents of "test 1: in active selection set" & run your code. Then repeat for "test 2: not in active selection set".

                              I need the script to find them all for me, as there are hundreds nested deep within the outliner, which i hope explains why I said "globally locate".

                              thomthom's code achieves this, but makes each duplicate group copy a unique component , so a synergy of your 2 codes would be perfect, but this is probably asking a lot.

                              thomthom, i installed your mashup with your quick install plugin, but i cant find it? I've searched "g2c" in the launchup plugin too.

                              Cheers

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

                                Under the Plugins menu. "Convert 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

                                  cheers thomthom, i confused it with http://sketchucation.com/forums/viewtopic.php?t=29462

                                  worked perfectly, my only concern is that I undid it, to check the stats via model info & it bugsplatted. So I have saved a new copy to be safe.

                                  I put enough in your cookie jar for two beers in the uk, so you can atleast afford one in Norway.. damm expensive

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

                                    BugSplat? o_O Can you reproduce it? Got a test model?

                                    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

                                      http://sketchucation.com/forums/download/file.php?id=106847

                                      run your sript > edit - undo = splat

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

                                        Huh! I see the crash too. This is not good. 😞

                                        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

                                          any thing to worry about with regards to how it will affect my model?

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

                                            Any crash is potential for data loss if you haven't saved...

                                            hm... when I use Selection Toys' Group Copies to Component on a single set it can be undone with no bugsplat. I wonder why this is different...

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

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

                                            Advertisement