I’ve written a script that puts down a progression of a component when it transitions from one transformation to another. It works fairly well, except if the axis in the component is different from the selection start axis as can be seen in this vid:
I’m thinking that my starting transformation is wrong, but I can’t for the life of me figure out how I can transform the initial transform so that it’s right. And if I have to change the initial, I will definitely need to change the final to agree with the change.
Anyone have any ideas? Here is the relivant code:
# I probably need to use this somewhere, right? t1 = @component_instance.transformation from = Geom::Transformation.new( @ps[START ][ORIGIN], @ps[START ][X_AXIS] - @ps[START ][ORIGIN], @ps[START ][Y_AXIS] - @ps[START ][ORIGIN]) to = Geom::Transformation.new( @ps[FINISH][ORIGIN], @ps[FINISH][X_AXIS] - @ps[FINISH][ORIGIN], @ps[FINISH][Y_AXIS] - @ps[FINISH][ORIGIN]) for i in (0..@@segments) # TODO: remember to change 0 back to 1 t2 = Geom::Transformation.interpolate(from, to, i.to_f/@@segments) instance = entities.add_instance(component_def, t2) end
In case it’s not clear,
@ps[START] is an array of the 1st three points picked, and
@ps[FINISH] are the last.
I’m thinking that I need to do something like transform the
t1 and have
to go through an intermediate transform, but I’m still not exactly sure.