sketchucation logo sketchucation
    • Login
    1. Home
    2. 2000apacman
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    2
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 5
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Is it possible to reset a transformation in loop?

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

      posted in Developers' Forum
      2
      2000apacman
    • RE: Is it possible to reset a transformation in loop?

      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?

      posted in Developers' Forum
      2
      2000apacman
    • Is it possible to reset a transformation in loop?

      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
      
      
      posted in Developers' Forum
      2
      2000apacman
    • RE: Rotation unexepected result

      I found the correction myself.
      And I use:

      group1.transform!(t0)

      instead of:

      group1.transformation = t0

      But if someone can explain to me why this works with transform! but not with .transformation
      i would be thankful.

      posted in Developers' Forum
      2
      2000apacman
    • Rotation unexepected result

      Hello, i would like to script a dragon curve so i first wrote this :

      ` mod = Sketchup.active_model # Open model
      ent = mod.entities # All entities in model
      sel = mod.selection # Current selection
      point1 = [0,0,0]
      point2 = [1,0,0]
      point3 = [1,1,0]
      group0 = Sketchup.active_model.entities.add_group
      line = group0.entities.add_line point1,point2
      line = group0.entities.add_line point2,point3

      t0 = Geom::Transformation.rotation( [1, 1, 0], [0,0,1], 90.degrees)
      group1 = group0.copy
      group1.transformation = t0

      group2=group0.parent.entities.add_group([group0, group1])

      t1 = Geom::Transformation.rotation( [2, 0, 0], [0,0,1], 90.degrees)
      group3 = group2.copy
      group3.transformation = t1

      group4=group2.parent.entities.add_group([group2, group3])

      t2 = Geom::Transformation.rotation( [2,-2,0], [0,0,1], 90.degrees)
      group5 = group4.copy
      group5.transformation = t2`

      But the thrird rotation gave me unexepected result. It seems to be a rotation and a translation.
      Why?

      posted in Developers' Forum
      2
      2000apacman
    • 1 / 1