We start our expression with a definition of the number of teeth for each sprocket. In our example, we have four sprockets turning, two of which sharing the same axis.
Number_of_teeth_of_sprocket_1 = 23;
Number_of_teeth_of_sprocket_2 = 18;
Number_of_teeth_of_sprocket_3 = 22;
Number_of_teeth_of_sprocket_4 = 180;
Then you can simply multiplicate the rotation of the axis with the result of the devision of the number of teeth of the connected sprockets. Note that we invert the rotation of the driver sprocket with a minus to get a reversed rotation for the driven sprocket:
Axis_2.Roll_Z = -Axis_1.Roll_Z * ( Number_of_teeth_of_sprocket_1 / Number_of_teeth_of_sprocket_2 );
Axis_3.Roll_Z = -Axis_2.Roll_Z * ( Number_of_teeth_of_sprocket_3 / Number_of_teeth_of_sprocket_4 );
Alternate approaches:
You can also use shorter names for the variables (don't use numbers - always use letters) e.g.:
a = 23;
b = 18;
c = 22;
d = 180;
The resulting expression will be much shorter e.g.:
Axis_2.Roll_Z = -Axis_1.Roll_Z * ( a / b );
Axis_3.Roll_Z = -Axis_2.Roll_Z * ( c / d );
Or you write the number of teeth for each sprocket directly into the expression e.g.:
Axis_2.Roll_Z = -Axis_1.Roll_Z * ( 23 / 18 );
Axis_3.Roll_Z = -Axis_2.Roll_Z * ( 22 / 180 );
All setups will have the same effect. You can setup the script with an optimum of readability and transparency
for your working needs.
|