Search in sources :

Example 1 with SlottedRevoluteJoint

use of artisynth.core.mechmodels.SlottedRevoluteJoint in project artisynth_core by artisynth.

the class JointedFemBeams method build.

public void build(String[] args) {
    MechModel mech = new MechModel("mechMod");
    addModel(mech);
    double stiffness = 5000;
    // create first fem beam and fix the leftmost nodes
    FemModel3d fem1 = addFem(mech, 2.4, 0.6, 0.4, stiffness);
    for (FemNode3d n : fem1.getNodes()) {
        if (n.getPosition().x <= -1.2) {
            n.setDynamic(false);
        }
    }
    // create the second fem beam and shift it 1.5 to the right
    FemModel3d fem2 = addFem(mech, 2.4, 0.4, 0.4, 0.1 * stiffness);
    fem2.transformGeometry(new RigidTransform3d(1.5, 0, 0));
    // create a slotted revolute joint that connects the two fem beams
    RigidTransform3d TDW = new RigidTransform3d(0.5, 0, 0, 0, 0, Math.PI / 2);
    SlottedRevoluteJoint joint = new SlottedRevoluteJoint(fem2, fem1, TDW);
    mech.addBodyConnector(joint);
    // set ranges and rendering properties for the joint
    joint.setAxisLength(0.8);
    joint.setMinX(-0.5);
    joint.setMaxX(0.5);
    joint.setSlotWidth(0.61);
    RenderProps.setLineColor(joint, myJointColor);
    RenderProps.setLineWidth(joint, 3);
    RenderProps.setLineRadius(joint, 0.04);
}
Also used : MechModel(artisynth.core.mechmodels.MechModel) RigidTransform3d(maspack.matrix.RigidTransform3d) FemModel3d(artisynth.core.femmodels.FemModel3d) SlottedRevoluteJoint(artisynth.core.mechmodels.SlottedRevoluteJoint) FemNode3d(artisynth.core.femmodels.FemNode3d)

Aggregations

FemModel3d (artisynth.core.femmodels.FemModel3d)1 FemNode3d (artisynth.core.femmodels.FemNode3d)1 MechModel (artisynth.core.mechmodels.MechModel)1 SlottedRevoluteJoint (artisynth.core.mechmodels.SlottedRevoluteJoint)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1