Previous section-----Next section


SetConstraints[constraints] builds the mathematical mechanism model represented by constraints. The constraints must be a list or sequence of SysCon data objects that are returned by any of the standard Mech constraint functions.

SetConstraints goes through the following steps in testing the constraints for validity:
1. Check that all of the extra variables in special constraints (cam constraints, 3D gear constraints, and the user-defined Constraint) are unique.
2. Check that each constraint has a unique constraint number, cnum.
3. Check that the number of degrees of freedom constrained is equal to the number of dependent variables.
4. Check that all of the local points that are specified by point number have been defined, unless BuildMech->None is specified.
5. Check that all of the symbols that are to be used as dependent variables are not protected and have no definition or attributes.
• The following options can be given:

• The following Modeler3D option can be given:

• With BuildMech->Location, SetConstraints does not immediately build the equations necessary for the velocity and acceleration solutions, or the generalized force solution; these equations are built automatically when SolveMech is called with nondefault settings for the Solution option.
BuildMech->Dynamic should be used to immediately build all possible equations.
BuildMech->None can be used to prevent any equation building. If constraints are given that contain local point numbers of points that are not yet defined, BuildMech is automatically set to None with a warning.
Compiled->True can decrease run time by more than a factor of two for large systems.
• Some types of expressions cannot be compiled. If the evaluation of the compiled constraints fails, incorrect results will be returned by SolveMech because Mech does not store the symbolic form of the constraints along with the compiled form.
• See also: CheckSystem, SetBodies, SetLoads.

Further Examples

Load the Modeler2D package and define a simple model.

The help model was defined with OriginLock1 and RotationLock1 constraints for the crank body, which resulted in the following constraint expressions.

Exactly the same state can be achieved by defining the constraint expressions explicitly.

Because the constraint was defined so that body bdcrank would be added to the model, it is possible to use functions like Location or MassMatrix that require a body number.

However, if the constraint was defined without adding a body to the model, instead treating X2, Y2, and CapitalTheta2 as completely independent variables, then all of the features and functions associated with having a body are not available.

See HelpModel2D.