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
-
It looks like it should work...
Just try it...
Note that instead of using a 'while' loop you could use something like:
nbit.times{ ... }
-
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?
-
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 ! -
Oups! you're right. that's the problem!
I am trying to make a dragon curve.
Advertisement