Ejemplo n.º 1
0
    o = objects[i]
    h = r.getHandle(o + '/handle')
    h.setMask([True, True, True, False, True, True])

    # placement constraint
    placementName = "place_sphere{0}".format(i)
    ps.createTransformationConstraint(placementName, "",
                                      "sphere{0}/root_joint".format(i),
                                      [0, 0, 0.02, 0, 0, 0, 1],
                                      [False, False, True, True, True, False])
    # placement complement constraint
    ps.createTransformationConstraint(placementName + '/complement', "",
                                      "sphere{0}/root_joint".format(i),
                                      [0, 0, 0.02, 0, 0, 0, 1],
                                      [True, True, False, False, False, True])
    ps.setConstantRightHandSide(placementName + '/complement', False)
    # combination of placement and complement
    ps.createLockedJoint(
        placementName + '/hold', "sphere{0}/root_joint".format(i),
        [0, 0, 0.02, 0, 0, 0, 1],
        [Equality, Equality, EqualToZero, EqualToZero, EqualToZero, Equality])
    ps.registerConstraints(placementName, placementName + '/complement',
                           placementName + '/hold')

    preplacementName = "preplace_sphere{0}".format(i)
    ps.createTransformationConstraint(preplacementName, "",
                                      "sphere{0}/root_joint".format(i),
                                      [0, 0, 0.1, 0, 0, 0, 1],
                                      [False, False, True, True, True, False])

    # combination of pre-placement and complement
Ejemplo n.º 2
0
## Constraints
#
for i in range(nSphere):
    # placement constraint
    constraintName = "place_sphere{0}".format(i)
    ps.createTransformationConstraint(constraintName, "",
                                      "sphere{0}/root_joint".format(i),
                                      [0, 0, 0.025, 0, 0, 0, 1],
                                      [False, False, True, True, True, False])
    # placement complement
    constraintName = "place_sphere{0}/complement".format(i)
    ps.createTransformationConstraint(constraintName, "",
                                      "sphere{0}/root_joint".format(i),
                                      [0, 0, 0.025, 0, 0, 0, 1],
                                      [True, True, False, False, False, True])
    ps.setConstantRightHandSide(constraintName, False)
    # preplacement constraint
    constraintName = "preplace_sphere{0}".format(i)
    ps.createTransformationConstraint(constraintName, "",
                                      "sphere{0}/root_joint".format(i),
                                      [0, 0, 0.075, 0, 0, 0, 1],
                                      [False, False, True, True, True, False])

for i in range(nCylinder):
    # placement constraint
    constraintName = "place_cylinder{0}".format(i)
    ps.createTransformationConstraint(constraintName, "",
                                      "cylinder{0}/root_joint".format(i),
                                      [0, 0, 0.025, 0, 0, 0, 1],
                                      [False, False, True, True, True, False])