Go to: Synopsis. Return value. Related. Flags. MEL examples.
cpConstraint [-assigner assigner type] [-help] [-name objectName] [-type type name]
[objects ...]
cpConstraint is undoable, queryable, and editable.
This command creates a constraint on a cloth mesh. The use of this command requires multiple selection. One selection is an object which will act as the constraint. The other selection is either a group of cloth vertices to be constrained, or a curve on the cloth panel. There are currently 5 types of constraints: 1. Transform constraint, which constrains a set of cloth vertices to follow another object's transform. 2. Mesh constraint, which constrains a set of cloth vertices to follow a set of triangles of a rigid body. 3. Field constraint, which affects a set of cloth vertices by a dynamics field. 4. Cloth constraint, which constrains points on one cloth to the triangles of another cloth (or the same cloth).string Name of constraint.
In query mode, return type is based on queried flag.
| Long name (short name) | argument types | Properties | ||
|---|---|---|---|---|
-help(-h)
|
|
|
||
|
||||
-type(-t)
|
type name
|
|
||
|
||||
-assigner(-a)
|
assigner type
|
|
||
|
||||
-name(-n)
|
objectName
|
|
||
|
||||
// Select some vertices of the cloth mesh, the shift-select a transform // of an object that has some keyframes. // cpConstraint; // Create a cloth mesh. Select a curve used as a construction curve // for a cloth panel. Shift-select a mesh object that has been // converted to a cloth collision object. // polyTorus; scale 20 20 20; move 0 -20 0; select -r pTorus1; cpCreateRigidMesh; select -r curve1; select -add pTorus1; cpConstraint -type mesh; // Select nothing. Create a dynamics radial field. Select some vertices // of the cloth mesh, the shift-select the radial field. // select -cl; radial -m 5000; // High magnitude used for cloth move 0 -20 0; select -r cloth1.vtx[132:134]; select -add radialField1; cpConstraint -type field; // Query the type of assigner for the constraint. // cpConstraint -q assigner transformConstraint1; // Query the type of constraint. // cpConstraint -q type sleeveConstraint; // You cannot edit either the type or assigner flag. You must // delete the constraint and create a new type. // // cpConstraint -e -type cloth sleeveConstraint; // Error: You cannot edit the constraint type