In this example, a flow-driven angular motion is created and assigned. A torsion spring is also defined:
m = new Motion("Flow-Driven Angular");
m.setAxisOfRotation(0, 1, 0);
m.setCenterOfRotation(3, 0, 0);
m.initialPosition = 0;
m.minimum = 0;
m.maximum = 90;
p = m.property("Resistive Torque");
v = p.variation("Torsion Spring");
v.setValue("Engagement Angle", 0, "deg");
v.setValue("Compression Angle", 90, "deg");
v.setValue("Engagement Torque", 0.5, "lbf-in");
v.setValue("Compression Torque", 10, "lbf-in");
p.apply(v);
a.select("VALVE-DOOR");
a.applyMotion(m);
A line-by-line description follows:
A motion object called “m” is created, and is set to type Flow-Driven Angular. The axis of rotation and the center of rotation are set, as are the initial position, and bounds of motion:
m = new Motion("Flow-Driven Angular");
m.setAxisOfRotation(0, 1, 0);
m.setCenterOfRotation(3, 0, 0);
m.initialPosition = 0;
m.minimum = 0;
m.maximum = 90;
A property object, “p”, is created, and set to type Resistive Torque. A variation object, “v”, is created and set to type Torsion Spring. The parameters of the spring are defined and then applied back to the property:
p = m.property("Resistive Torque");
v = p.variation("Torsion Spring");
v.setValue("Engagement Angle", 0, "deg");
v.setValue("Compression Angle", 90, "deg");
v.setValue("Engagement Torque", 0.5, "lbf-in");
v.setValue("Compression Torque", 10, "lbf-in");
p.apply(v);
The part called “VALVE-DOOR” is selected, and the motion is applied to it.
a.select("VALVE-DOOR");
a.applyMotion(m);