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!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Is it possible to reset a transformation in loop?

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 358 Views 2 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.
    • 2 Offline
      2000apacman
      last edited by

      As said in the subject, i would like to know if it's possible to reset a transformation in loop.
      example :

      
      x=0
      while x < nbit
        t = Geom;;Transformation.rotation(pivotpt, norm, 90.degrees)
        group1 = group0.copy
        group1.transform!(t)
        group0 = group0.parent.entities.add_group([group0, group1])
        pivotpt.transform!(t)
        x += 1
      end
      
      
      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        It looks like it should work... 😕
        Just try it...
        Note that instead of using a 'while' loop you could use something like:
        nbit.times{ ... }

        TIG

        1 Reply Last reply Reply Quote 0
        • 2 Offline
          2000apacman
          last edited by

          Well, i tried but it seems that doesn't work...
          And i don't understand why not.
          Here is my complete script (with nbit correction)

          lg = 1.m
          nbit = 5
          point1 = [0,0,0]
          point2 = [lg,0,0]
          point3 = [lg,lg,0]
          norm = [0,0,1]
          group0 = Sketchup.active_model.entities.add_group
          line = group0.entities.add_line point1,point2
          line = group0.entities.add_line point2,point3
          pivotpt = point3
          
          nbit.times{
            t = Geom;;Transformation.rotation(pivotpt, norm, 90.degrees)
            group1 = group0.copy
            group1.transform!(t)
            group0 = group0.parent.entities.add_group([group0, group1])
            pivotpt.transform!(t)
          }
          

          Maybe i may transform the coordinates system instead. Or do you know another trick like using an indexed variable name for t?

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

            You can of course use:
            point.transform!(t)
            And make each geometry set in turn...
            What is it you want to end up with ?
            I note that near the end of the {} you are transform-rotating 'pivotpt' anchored on itself - so it stays where it is !

            TIG

            1 Reply Last reply Reply Quote 0
            • 2 Offline
              2000apacman
              last edited by

              Oups! you're right. that's the problem!
              I am trying to make a dragon curve.

              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