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,point3t0 = Geom::Transformation.rotation( [1, 1, 0], [0,0,1], 90.degrees)
group1 = group0.copy
group1.transformation = t0group2=group0.parent.entities.add_group([group0, group1])
t1 = Geom::Transformation.rotation( [2, 0, 0], [0,0,1], 90.degrees)
group3 = group2.copy
group3.transformation = t1group4=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? -
I found the correction myself.
And I use:group1.transform!(t0)instead of:
group1.transformation = t0But if someone can explain to me why this works with transform! but not with .transformation
i would be thankful. -
Transform! executes/calls the method wheras transformation = is assigning it.
tested your code and
transformation = , did give me a same result as transform!The principle still is call method with object.method.
Oh, and to answer the question. In this case were dealing with Geom::Transformation object. So were not calling a method directly(I think..).So its more like
Group.Geom::Transformation = myspecial.Geom::Transformation
I hope I explained it correctly..
If you test t0.class you will see it's a Geom::Transformation.object
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement