Dont understand rotation
-
Hello,
i have a problem with the rotation of the entity.
I want to move the entity with the origin on the point 100,0,0 and rotated for 90 degrees.
But the results of my code is that the entity is on the position cca 43.18 ,-105.42131 ,0
What is wrong in the code?point = Geom::Point3d.new 100,0,0 vector = Geom::Vector3d.new 0,0,1 degrees = 90 angle = degrees.degrees t = Geom::Transformation.rotation point,vector,angle selected_entity.move! t
-
Just change the last line. You don't want to use the move! method, you want to apply the transformation with the transform! method. So it should look like this:
selected_entity.transform! t
See if that works,
Chris
-
hmm, I read up on the move! method. Seems that it should have been doing what you want perhaps. Are you trying to do this rotation within an animation? Or is it just a normal rotation transformation? I guess it says that the move! is good to use within an animation, but I have zero experience with animations.
Chris
-
Yes,thats it.
Thans.
Sorry for a very newby question. -
No,im not doing an animation,but only transaction.
It is strange that with move metod i have different result.
The same behaviour (not wanted)i get if i make a component in this way:point = Geom::Point3d.new 100,0,0
vector = Geom::Vector3d.new 0,0,1
degrees = 90
angle = degrees.degrees
t = Geom::Transformation.rotation point,vector,anglepath = Sketchup.find_support_file "Bed.skp",
"Components/Components Sampler/"
definitions = model.definitions
componentdefinition = definitions.load pathinstance = entities.add_instance componentdefinition, t
-
I tried some tests with your script, and I found that .transform! applies a transformation to an instance, and .move! applies a transformation to the definition.
So, if you have multiple copies, when you use move!, it will move them all to one place.
-
This might use some looking into then. The Docs say that the move! method is identical to the transform! method, just it does not get applied to the undo stack, making it nice for animations.
Seems like it should not mess around with definitions or instances differently. interesting,
Chris
-
This seems like a trig problem
.move! may require angle in degrees - DCs use degrees exclusively for all their trig work.
.transform! may require the angle in radians.
Try changing to "angle = degree" with .move! and see if that fixes it.
Mark
-
move! is mis-documented or buggy, or both. I think move! is expecting a Point3d object to move the Grouponent to, because it sure acts strange otherwise.
I posted a little more here: http://forums.sketchucation.com/viewtopic.php?f=180&t=17047&p=166900&hilit=move#p166900
-
-
I thought it was a great blend, but I can't take credit for it. I saw it in someone's source code. Fredo, I think.
-
I'm in the process of making a Bifold door ruby: with 2 options open or closed
the open door position are 60 degrees. Ruby excepts only radians!ie
pi = 3.141592653589793 # 180 degree angle = pi radians pi6 = 1.047 # 60 degree angle = pi*0.6666/2 #-----rotation is about point $pt00 and about the blue axis 60 degrees t = Geom;;Transformation.rotation($pt00,Geom;;Vector3d.new(0,0,1), -pi*0.6666/2) group.move!(t)
-
Advertisement