A constraint collection is created with default values for its properties (such as value, orientation, etc.). Use the constraint properties edition services to set them to appropriate values after constraint creation.
- See also:
Properties
- Property BrokenConstraintsCount() As (Read Only)
-
Returns the number of broken constraints from the Constraints collection.
- Example:
- The following example retrieves in BknCstNum
the number of broken constraints from the
myListofConstraints collection of constraints:
BknCstNum = myListofConstraints.BrokenConstraintsCount
- Property UnUpdatedConstraintsCount() As (Read Only)
-
Returns the number of unupdated constraints from the Constraints
collection.
- Example:
- The following example retrieves in UnUpdCstNum
the number of unupdated constraints from the
myListofConstraints collection of constraints:
UnUpdCstNum = myListofConstraints.UnUpdatedConstraintsCount
Methods
- Func AddBiEltCst( iCstType, iFirstElem, iSecondElem) As
-
Creates a new constraint applying to two geometric elements
and adds it to the Constraints collection.
- Parameters:
-
- iCstType
- The constraint type dd>
- iFirstElem
- The first constrained geometric element
The following object is supported: . dd> - iSecondElem
- The second constrained geometric element
The following object is supported: .
- Example:
-
This example adds the NewCst tangency constraint in a sketch,
between the two circles c1 and c2
using the value 4 for catCstTypeTangency.
Set newCst = skCstList.AddBiEltCst(4, c1, c2)
- Parameters:
-
- iCstType
- The constraint type dd>
- iElem
- The constrained geometric element
The following object is supported: .
- Example:
-
This example creates the reference constraint NewCst to a part,
stating that
the P1 point should remain fixed with respect to the part's
origin elements using the value 0 for catCstTypeReference,
and adds it to the cstList collection.
Set NewCst = cstList.AddMonoEltCst(0, P1)
- Parameters:
-
- iCstType
- The constraint type dd>
- iFirstElem
- The first constrained geometric element
The following object is supported: . dd> - iSecondElem
- The second constrained geometric element
The following object is supported: . dd> - iThirdElem
- The third constrained geometric element
The following object is supported: .
- Example:
-
This example adds symCst symmetry constraint in a part,
stating that the cylinders cyl1 and cyl2 are
symmetric with respect to the plane symPlane using the
value 15 for catCstTypeSymmetry.
Set symCst = prtCstList.AddTriEltCst(15, cyl1, cyl2, symPlane)
- Parameters:
-
- iIndex
- The index or the name of the constraint to retrieve frm the collection of constraints. As a numerics, this index is the rank of the constraint in the collection. The index of the first constraint in the collection is 1, and the index of the last constraint is Count. As a string, it is the name you assigned to the constraint using the property. dd>
- Returns:
- The retrieved constraint
- Example:
-
This example retrieves in cst1 the first constraint
in the collection and in cst2 the constraint Constraint.2.
Set cst1 = cstList.Item(1) Set cst2 = cstList.Item("Constraint.2")dd>
- Parameters:
-
- iIndex
- The index or the name of the constraint to remove from the Constraints collection. As a numerics, this index is the rank of the constraint in the collection. The index of the first constraint in the collection is 1, and the index of the last constraint is Count. As a string, it is the name you assigned to the constraint using the property.
- Example:
-
This example removes the last constraint in the collection.
cstList.Remove(cstList.Count)