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

    Select ALL component instances to memory buffer.

    Scheduled Pinned Locked Moved Plugins
    15 Posts 5 Posters 1.2k Views 5 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

      @rv1974 said:

      The stuff does not enter the memory buffer! (though it indeed get selected).

      Wait, it it gets selected, but that is not what you mean by "memory buffer"?

      1 Reply Last reply Reply Quote 0
      • R Offline
        rv1974
        last edited by

        OK.. you select them (at this stage everything is OK, all instances are highlighted); now do Cntl+C and then paste 'em say in a new file.. Nada!
        Only a small portion get pasted- not the whole number of instances.

        1 Reply Last reply Reply Quote 0
        • G Offline
          glro
          last edited by

          @rv1974 said:

          OK.. you select them (at this stage everything is OK, all instances are highlighted); now do Cntl+C and then paste 'em say in a new file.. Nada!
          Only a small portion get pasted- not the whole number of instances.

          2 components
          2 instances A1 et A2 of the same component
          1 instance B of another component

          A1 and B form a group

          i clic on A2, "select all instances"

          A1 and A2 are selected

          control+C

          new file

          copy in place

          i do get the 2 instances A1 and A2, but they are not in the same place they were in the previous file

          son even if i get all the instances, there is a bug, yes

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

            You can't simply Edit>Copy then Edit>Paste Selected objects leaving them within multiple contexts.
            Doing it manually you can only ever Select objects in the same active_entities context.
            So after you Copy you will always Paste those into the current context [active_entities]...

            Selecting all instances in code, when some are nested in other contexts, still allows you to do this Copy and then Paste, BUT ALL of the new instances will be put into the active_context, ignoring their original context[s]... just like when you do it manually within one context at a time.
            Also the transformations of the individual instance's containers is ignored in the replication...

            BUT it would be possible to mimic a copy+paste leaving all copies in the same contexts as their originals... by duplicating all instances in their own container's entities - but using Ctrl+C will never work across contexts...
            It would be complicated to do as each instance and each container can have its own transformation, and the instances layers, materials etc... etc...

            But it's not impossible...

            May I ask WHY you need to do this ?

            TIG

            1 Reply Last reply Reply Quote 0
            • R Offline
              rv1974
              last edited by

              @tig said:

              But it's not impossible...

              May I ask WHY you need to do this ?

              It's crucial in my workflow. I typically need to swap SU components (tons of precisely placed entourage) with Max's vray proxies. In simplifiedexample attached above, I needed to swap SU spotlights with Max lights. Now (when there's still no solution for effortless grabbing I have to do lots of manual (which tends to be erroneous) exploding and messing with temporal files.

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

                If you simply want to 'swap' components leaving them where they are, then you don't need to 'select' them at all...

                Let's say you have definition 'A' with several instances spread across different contexts.
                Let's say you want them all to become instances of definition 'B'.
                This one liner should achieve that:

                d=Sketchup.active_model.definitions;d['A'].instances.each{|i|i.definition=d['B']}
                

                Make two different looking components 'A' and 'B' and place several instances of each in various contexts... Use the Ruby Console and Copy+Paste+<enter> the code above... ALL instances of 'A' should become 'B' - even ones NOT in the active_entities current context 😄

                TIG

                1 Reply Last reply Reply Quote 0
                • R Offline
                  rv1974
                  last edited by

                  this is what I constantly do (if I understood correctly your suggestion) via Fredo's ghost components.
                  But yhe ultimative task is to gigg all the desired instances out of their contexts and put them above.

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

                    So if I understand you correctly now...
                    You now want to 'move' [or perhaps copy?] all of a definition's instances from whatever context they are in into the current context [active_entities] ??
                    AND I must suppose maintain there relative transformations ?
                    Otherwise it could be done already - but with insertion-points messed up !

                    This is not a trivial task.
                    As you realize doing it manually Edit>Copy [OR Cut] when a selection spans several contexts gives odd results when Pasted - if the containers have been transformed in any way - the Pasted instances are located relative to the origin of their container, which is then combined into the current context using its origin which might not be the same !

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      ericschimel
                      last edited by

                      So I just came across this thread looking for a similar solution...

                      I have a bunch of components that are spread throughout my model. The components are at different levels of the model. I can use TT's "Select all instances" select them all, no matter how deep they are buried in other components.

                      What I'd like to do is to be a be able to "copy" (ctrl C) the components and then paste (ctrl V) ALL of the components somewhere else (like in the context of another component)

                      Is this possible with a plugin or some snippet of code? It seems very similar to this request, the only real difference is that I'm trying to copy these components into whatever instance I want, I just want to retain their location...

                      -Eric
                      http://plugin.sketchthis.net
                      Sketchup Kitchen Design Plugin
                      Custom Models

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        rv1974
                        last edited by

                        Jim brilliantly* solved this already.
                        Very valuable, but the author didn't bother to put it in the Store (as well as 'save as previos version')
                        https://sketchucation.com/forums/viewtopic.php?f=323%26amp;t=33441%26amp;start=30
                        jf_save_instances.rb
                        9th post from the bottom.
                        *Currently it's 2-step procedure. I wish someday it will be one-click solution.

                        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