Constraint (hwx.inspire)#
- class Constraint(features, position=None, isRemote=False, **kwds)#
Bases:
BoundaryCondition
A constraint is used to hold a part so it doesn’t displace when loads are applied to it.
You can apply a constraint to a single point on the model, to an edge or a face, or at the center of a hole.
# Name
Type
property
property
property
icon
str
property
property
property
# Name
Description
applyToCylindricalHoleCenter
(self)Sets support to act in a single direction across a cylindrical hole center.
applyToFace
(self)Sets support to act in a single direction across the extent of a face.
applyToPoint
(self)Sets support to act in a single direction at a point
setDefaultDOFs
(self)Sets supports DOFS to default.
updatePosition
(self, m44)Update the position by multiplying input M44 matrix.
Example
from hwx import inspire def createBlockWithHole(radius=0.3, location=(0, 0, 0)): model = inspire.getModel() box = model.createSolidBlock() cyl = model.createSolidCylinder(radius=radius) part = box.booleanSubtract(cyl) part.location = location return part model = inspire.newModel() box = createBlockWithHole() inspire.fitView() cyl = box.getFeatures(inspire.FeatureCylindrical)[0] support = inspire.Constraint(cyl, loadCase='current') # apply to the model model.loads.extend([support]) name = support.name # modify some DOFs support.dofs = "tz" print("Unconstrained DOFs of " + name + ": " + str(support.dofs)) support.hinge = True print("Unconstrained DOFs of " + name + " after setting hinge to True: " + str(support.dofs)) support.fixed = True print("Unconstrained DOFs of " + name + " after setting fixed to True: " + str(support.dofs)) support.sliding = True print("Unconstrained DOFs of " + name + " after setting sliding to True: " + str(support.dofs))
- property direction#
Returns direction vector of the entity.
- property inahole#
Determines if the constraint is applied on a hole or not.
- property detached#
Determines if the constraint is defined on a detached location in space.
- property dofs#
Returns or sets a list with the unconstrained degrees of freedom.
To set it you can pass a list e.g [“rx”, “ry”, “rz”], a space seperated string “rx ry rz” or one of the following choices “fixed”, “sliding”, “hinged”.
- applyToPoint()#
Sets support to act in a single direction at a point
- applyToFace()#
Sets support to act in a single direction across the extent of a face.
- applyToCylindricalHoleCenter()#
Sets support to act in a single direction across a cylindrical hole center.
- setDefaultDOFs()#
Sets supports DOFS to default.
Default for supports in a hole or two dimensional parts are all constrained, while for the rest it’s rotational DOFs constrained.
- property fixed#
Returns True if support is fixed, applies to holes or surfaces.
When the property is set to False then the support dofs get set to default.
For surface supports it means that all translational DOFs are constrained. For supports in holes it means that all DOFs are constrained.
- property sliding#
Returns True if support is sliding, applies to holes or surfaces.
When the property is set to False then the support dofs get set to default.
A sliding support enforces zero displacement in directions normal to the surface direction. Displacements tangent to the surface are unconstrained.
- property hinge#
Returns True if support is hinge, applies to holes only.
When the property is set to False then the support dofs get set to default.
Hinge supports allow a part to freely rotate about the center-line of a cylindrical face but constrains movement in both the radial and axial directions. Hinge supports can only be applied to full or partial cylindrical faces.
- property position#
Returns and sets the position of the constraint as a M44 matrix.
- updatePosition(m44)#
Update the position by multiplying input M44 matrix.