I want to imput a part with 3 rotations
rotation to z axis by k*deg degrees
rotation to x axis by w
and rotation to y by f
My code doesn't work. The last rotation covers the other two. How can i have all the rotations together?
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
f = 30
w = 10
Call oMatrix.SetToRotation(-k * deg * 4 * Atn(1) / 180, oTG.CreateVector(0, 0, 1), oTG.CreatePoint(0, 0, 0))
Call oMatrix.SetToRotation(f * 4 * Atn(1) / 180, oTG.CreateVector(0, 1, 0), oTG.CreatePoint(0, 0, 0))
Call oMatrix.SetToRotation(w * 4 * Atn(1) / 180, oTG.CreateVector(1, 0, 0), oTG.CreatePoint(0, 0, 0))
hi,
I have got the exact same problem, does somebody knows the answer to this?
I found the answer myself, you can combine two translations or a translation and a rotation.
The code below gives you an example about how to combine a translation and a rotation.
I hope it's helpfull.
SyntaxEditor Code Snippet
Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry Dim oMatrix As Matrix oMatrix = oTG.CreateMatrix Dim oOccurrence As ComponentOccurrence 'Een tweede matrix wordt aangemaakt om ook een rotatie te kunnen geven aan de transportband. Dim oMatrix1 As Matrix oMatrix1 = oTG.CreateMatrix oMatrix.SetTranslation(oTG.CreateVector(1200, 1500, 0)) oMatrix1.SetToRotation(1.57, oTG.CreateVector(0, 0, 1), oTG.CreatePoint(0, 0, 0)) Call oMatrix1.transformby(oMatrix) oOccurrence = oAsmCompDef.Occurrences.Add(Partname, oMatrix1) oOccurrence.Grounded = True