Model.morphconstraintcreatedof#

Model.morphconstraintcreatedof(collection, dof1, dof2, dof3, system_entity, options, name, color)#

Creates a constraint which fixes one or more translational degrees of freedom for the selected nodes relative to either the global coordinate system or a specified local coordinate system.

A degree of freedom for a coordinate system is one of the three translational directions. For a rectangular coordinate system the three degrees of freedom are along each axis: the x-axis, the y-axis, and the z-axis. For a cylindrical coordinate system the three degrees of freedom are in the radial direction, the theta direction, and the z direction. For example, for a rectangular coordinate system, if the y-axis degree of freedom is fixed for a node, it will be allowed to move only in the x and z directions, remaining in a plane perpendicular to the y axis. Similarly, for a cylindrical coordinate system, if the theta degree of freedom is fixed for a node, it can move only in the radial and z directions.

Note that fixing the radial and z degrees of freedom for a cylindrical coordinate system will force a node to move in a circle about the axis of that system.

Parameters:
  • collection (Collection) – The collection containing the node entities to be constrained.

  • dof1 (int) –

    0 - Allow the nodes to move in the x (or radial) direction

    1 - Constrain the nodes from moving in the x (or radial) direction

  • dof2 (int) –

    0 - Allow the nodes to move in the y (or theta) direction

    1 - Constrain the nodes from moving in the y (or theta) direction

  • dof3 (int) –

    0 - Allow the nodes to move in the z direction

    1 - Constrain the nodes from moving in the z direction

  • system_entity (Entity) – The object describing the system entity of the local mcoordinate system. system_entity=None for the global coordinate system.

  • options (int) –

    0 - Does not affect nodes near constrained nodes

    1 - Enable mesh stretching around constrained nodes

  • name (hwString) – The name of morph constraint.

  • color (int) – The color of the constraint. Valid values are 1-64.

Example#

Create a DOF constraint named “ mconsystem5 “ for nodes with IDs 1 - 100 in the radial direction of a local coordinate system with ID 5 , and mesh stretching enabled#
import hm
import hm.entities as ent

model = hm.Model()

# Creating the filter for the collection of the constrained nodes with IDs 1-100
node_filter = hm.FilterByEnumeration(ent.Node, list(range(1, 101)))

model.morphconstraintcreatedof(
    collection=hm.Collection(model, node_filter),
    dof1=1,
    dof2=0,
    dof3=0,
    system_entity=ent.System(model, 5),
    options=1,
    name="mconsystem5",
    color=22,
)