The most common way used to control the position of parts in ETO is the use of constraints. In some cases however it can be more advantageous to use frame based positioning to control the position. When using frame based positioning the trickiest thing is controlling the rotation. This example can be used to help you understand how to get the rotation you need.
The design below creates three parts:
Design Assembly1_1 : ETO_WB_TestingRoot _
IvAssemblyDocument
'Used to set the angle for myPart1_test
' and myPart1_test2
Parameter Rule angleToRotate = 0
'Create a vector that is the X axis
' Rotated around Z Axis by the angle
' set in angleToRotate
Rule myRotatedVecX_z As Vector = _
RotateVector(UnitX, _
angleToRotate, _
UnitZ)
'Use the cross product to get a
' a vector for the Y direction
Rule myRotatedVecY_z As Vector = _
UnitZ * MyRotatedVecX_z
' Create the part that will rotate
'around the Z Axis
Child myPart1_test As :Part1_Test
xDirection = myRotatedVecX_z
yDirection = myRotatedVecY_z
ignorePosition? = False
End Child
'Create a vector that is the X axis
' Rotated around Y Axis by the angle
' set in angleToRotate
Rule myRotatedVecX_y As Vector = _
RotateVector(UnitX, _
angleToRotate, _
UnitY)
'Use the cross product to get a
' a vector for the Y direction
Rule myRotatedVecY_y As Vector = _
UnitY * MyRotatedVecX_y
' Create the part that will rotate
'around the Y Axis
Child myPart1_test2 As :Part1_Test
xDirection = myRotatedVecX_y
yDirection = myRotatedVecY_y
origin=Point(4,0,0)
ignorePosition? = False
End Child
‘Parameters to control the rotation of the third part using frames
Parameter Rule primaryRotationAngle = 0
Parameter Rule secondaryRotationAngle = 0
' This Frame is the world frame rotated
' by the parameter primaryRotationAngle
' around the Z Axis
' localFrame is the frame that was used
' to position the parent. In this simple
' example, worldframe = localFrame
Rule myFrame_1 As Frame = RotateFrame _
(localFrame, _
primaryRotationAngle, _
Origin, _
UnitZ)
'This Frame is myFrame_1 rotated around
' the X axis in myFrame_1
' “vector_” creates a vector relative to
' a given Frame
Rule myFrame_2 As Frame = RotateFrame _
(myFrame_1, _
secondaryRotationAngle, _
Origin, _
vector_(1, 0, 0, myFrame_1))
'Create a part that will rotate around
' two axes by using the Frame created by
' using RotateFrame
Child myPart1_test3 As :Part1_Test
ReferenceFrame = myFrame_2
ignorePosition? = False
origin = Point(0,4,0)
End Child
End Design
Here is the Edit Parameters dialog and the parts in the Inventor Model. Here all of the parameters are zero.
After changing the angleToRotate to 90 notice the change in rotation for the parts in the lower area. The part on the left rotates around the Z axis. The part on the right rotates around the Y axis. The part on the top is not effected by a change to angleToRotate.
The top part is changed by the parameters primaryRotationAngle and secondaryRotationAngle. Notice that the Z rotation is similar to the part below it, but the secondaryRotationAngle has rotated the part in in the Y direction as well. (Y direction in the part)
Using a design like this you can experiment with different values in the parameters and see the results the rotation angle has on the parts.
-Wayne





Leave a Reply