Previous section-----Next section

2.1.2 SetBodies

The Mech SetBodies function is used to apply the data contained in body objects to the current kinematic model.

The body object processing function.

All properties specified in a call to SetBodies overwrite properties that are currently defined unless the property specification is the default, Automatic, in which case the property is left unchanged.
If SetBodies is passed a body object with an InitialGuess specification other than Automatic, the current initial guesses of each body are reset to the values of the permanent initial guesses.
There is a subtle issue regarding the use of the PointList specification with SetBodies. When SetBodies is run with a new InitialGuess specification, the changed guess is immediately reflected in Mech's internal database. The same holds true for changing inertia properties with SetBodies; the mass matrix is immediately updated.
However, changing the coordinates of a point with PointList must reflect a change throughout the constraint equations defined with SetConstraints. This cannot be done without rebuilding the constraint equations. Therefore, if the constraint equations have already been built with SetConstraints when SetBodies is passed a PointList specification other than Automatic, the constraint equations will all be automatically rebuilt by SetConstraints the next time that a solution is sought, which may cause a noticeable delay in the operation of SolveMech.
The following command incorporates the three body objects that were defined in Section 2.1.1 into the current model.

This starts a model with the three body objects.

SetBodies returns Null. All of the mechanism points and properties passed to SetBodies are stored in Mech's internal database.
Now that local point definitions have been added to the current model, they can be referenced by their local point numbers in any Mech function. Instead of using the local coordinates of a point, simply use the integer point number. For example, the Translate2 constraint in the crankshaft-piston model would use four local point numbers instead of the four explicit 2D coordinates in the Line objects.

Here is a constraint with, and without, local point numbers.

Updating Properties

SetBodies only sets the values of the properties that are not specified with the default, Automatic. Thus, SetBodies can be used to update the value of individual body properties without affecting properties already defined.

This updates only the crankshaft's initial guess.

PointList

Note that PointList, like many Mech options, can also be used as a function.

Another usage of PointList.

Here are the local coordinates of point 2 on the piston.