How to use Matrix3D.setToRotationTo? I get an 'attribute error'

How to use Matrix3D.setToRotationTo? I get an 'attribute error'

Anonymous
Not applicable
708 Views
2 Replies
Message 1 of 3

How to use Matrix3D.setToRotationTo? I get an 'attribute error'

Anonymous
Not applicable

Hello,

I want to create a body on the XY plane and then transform it to final position.

For the rotation I tried to use Matrix3D.setToRotationTo(from, to) method. But I get 'Attribute Error'. Why?

How to use this method?  

I guess it creates a transformation matrix from these two vectors. How is the rotation point defined.

I also tried to use  Matrix3D.setToAlignCoordinateSystem. But it also raises an error.

Thanks 

xapo

Code snippet from my test program.  Running code is in attached zip file.

        transform = adsk.core.Matrix3D.create()
        from_vector = adsk.core.Vector3D.create(0, 0, 1)
        to_vector = adsk.core.Vector3D.create(1, 1, 1)
        transform.setToRotationTo(from_vector, to_vector)                

moveFeats = rootComp.features.moveFeatures moveFeatureInput = moveFeats.createInput(bodies, transform) moveFeats.add(moveFeatureInput)

 

 

0 Likes
Accepted solutions (1)
709 Views
2 Replies
Replies (2)
Message 2 of 3

JesusFreke
Advocate
Advocate
Accepted solution

You want "setToRotateTo", not "setToRotationTo" 🙂

0 Likes
Message 3 of 3

Anonymous
Not applicable

OMG, you are right, what a stupid mistake!

thank you!

 

and I learned also that:

'to' vector must be a unit vector otherwise it scales the object

 

 

x.

 

0 Likes