Model Building Simplification

You can tailor the API to suit your modeling style and convenience. Here is an example.

Assume that you want to create a revolute joint simply by specifying the following:
  • The two bodies it connects.
  • The location of the connection point.
  • The joint axis orientation in global space.

You do not want to explicitly create Markers.

You could write a "convenience" function and use it. The process for doing so is illustrated below.
# Create a convenience function first
def RevoluteJoint (ibody, jbody, jname, location=[0,0,0], axis=[0,0,1]):
 zpoint = location + axis
 im     = Marker (body=ibody, label=jname + "_IM", qp=location, zp=zpoint)
 jm     = Marker (body=jbody, label=jname + "_JM", qp=location, zp=zpoint)
 joint  = Joint (type="REVOLUTE", label=jname, i=im, j=jm)
return joint
# Now create a joint
myJoint = RevoluteJoint (Part1, Part2, "myJoint", location=[23,34,45],
                        axis=[0. 0.5773503, 0.5773502, 0.5773503]
# Create a second joint
yourJoint = RevoluteJoint (Part3, Part4, "yourJoint", location=[23,-34,45],
                           axis=[0. 0.5773503, -0.5773502, 0.5773503]

In a similar manner, you can introduce an entire library of convenience functions and use these to simplify your modeling.