Use the ForConstraint command to create a new constraint.
strCmdForConstraint = "<Constraint Name=""<Constraint Name>"" ID=""<Constraint ID>"" Type=""0"" CoordinateSystemID=""<Coordinate System ID>"" Tx=""<FIX=1/FREE=0>"" Ty=""<FIX=1/FREE=0>"" Tz=""<FIX=1/FREE=0>"" Rx=""<FIX=1/FREE=0>"" Ry=""<FIX=1/FREE=0>"" Rz=""<FIX=1/FREE=0>"" EntitiesCount=""<Entities Count>"" ArrowLength=""<Display Arrow Size>"" ArrowColor=""<Hex Color code in Decimal>"" DisplayDensity=""<Display Density>"" SubcaseCount=""<Number of Subcases>"" Subcases=""<Subcase ID>""><Entity1 GeometryType=""<Geometry Type>"" GeometryID=""<Vertex/Edge/Face/Sketch ID>"" ComponentName=""<Component Name>""/></Constraint>"
Available types include the following:
Geometry Type | Value |
Structural | 0 |
Thermal | 1 |
Response Spectrum | 2 |
Available geometry types include the following:
Geometry Type | Value |
Vertex | 0 |
Edge | 1 |
Face | 2 |
Sketch | 3 |
For example:
strCmdForConstraint = "<Constraint Name=""Constraint 1"" ID=""1"" Type=""0"" CoordinateSystemID=""0"" Tx=""1"" Ty=""1"" Tz=""1"" Rx=""1"" Ry=""1"" Rz=""1"" EntitiesCount=""1"" ArrowLength=""50"" ArrowColor=""14803200"" DisplayDensity=""4"" SubcaseCount=""1"" Subcases=""1""><Entity1 GeometryType=""2"" GeometryID=""13"" ComponentName=""Tutorial 1""/></Constraint>"
If you want to select multiple vertices, edges, faces, or sketches, you can specify the number of entities to select and add additional fields for the new geometries. For example:
strCmdForConstraint = "<Constraint Name=""Constraint 1"" ID=""1"" Type=""0"" CoordinateSystemID=""0"" Tx=""1"" Ty=""1"" Tz=""1"" Rx=""1"" Ry=""1"" Rz=""1"" EntitiesCount=""2"" ArrowLength=""50"" ArrowColor=""14803200"" DisplayDensity=""4"" SubcaseCount=""1"" Subcases=""1""><Entity2 GeometryType=""3"" GeometryID=""42"" ComponentName=""Tutorial 2""/><Entity1 GeometryType=""3"" GeometryID=""30"" ComponentName=""Tutorial 1""/></Constraint>"