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

    Copy array (again)

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 146 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.
    • jolranJ Offline
      jolran
      last edited by

      Hi!

      I have had this subject mentioned before and some similar topic have recently been brought up.
      http://forums.sketchucation.com/viewtopic.php?f=180&t=38413&p=339504&hilit=copy+groups#p339504

      However having some problems with above method and erasing groups, after they have served their purpose.

      Using this code seams safer, but translation is off. It translates the whole new group 1ve. Instead it should translate each subgroup 1ve What am I doing wrong? πŸ˜•

      My guess is that the instance is "inserted" each time at gp1tran and moved with ve from there each time, but how do I transfer the insertion to the next spot each insertion?

      This resulting group of groups(gp2) should be copied and translated again, and I get splats erasing gp2 afterwards using standard group.copy methods..

       #gp1=group1     gp2=group2  cop_times=number of copies  rents =group2.entities
      
      	   
      	   gp1ents=gp1.parent.entities; gp1defn=gp1.entities.parent; gp1tran=gp1.transformation
              #  
      	    cop_times.to_i.times{|i|                 
                 tgp=rents.add_instance(gp1defn, gp1tran) #using ve for transformation=no good
      
                 tgp.transform!(Geom;;Transformation.translation(ve))
      			   
      			} 
      			
      
      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        You need to increment the transformation vector too ?... and remake the translation each time you place an instance...

        TIG

        1 Reply Last reply Reply Quote 0
        • jolranJ Offline
          jolran
          last edited by

          Aha. That sounds pretty obvious when you say it.

          See if I got it right...

          Let say the vector originaly has a length of 10. Then for each copy the vector.length increases with +10?
          Ok. then I will have to reset the vector to 10 before doing the second group, unless using a vector.clone.

          Thanks TIG.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @jolran said:

            Thanks TIG.

            Hey look! It's a bird... no, it's a plane? .. no wait.. It's SketchupMan !!!!!!
            πŸ˜†

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • jolranJ Offline
              jolran
              last edited by

              Ok.................. πŸ˜•

              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