Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can i have multiple rotations in an assembly (Inventor VBA) 3d

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
457 Views, 2 Replies

How can i have multiple rotations in an assembly (Inventor VBA) 3d

 

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))

 

Tags (1)
2 REPLIES 2
Message 2 of 3
koen.clemens
in reply to: Anonymous

hi,

 

I have got the exact same problem, does somebody knows the answer to this?

Message 3 of 3
koen.clemens
in reply to: koen.clemens

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report