Model.morphconstraintcreatevec#

Model.morphconstraintcreatevec(ncollection, type, name, vec, plane_normal, plane_base, dist, color)#

Creates a vector type morphconstraint for the selected nodes with the option of having those nodes bounded to move no closer than a given distance from the specified plane.

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

  • type (int) –

    0 - Moves along the vector

    1 - Moves along the vector and is bounded by the plane

    3 - Moves along the vector, at a set distance from the plane

    5 - Moves along the vector and remains its original distance from the plane

    +32 - Enable mesh stretching around constrained nodes. Add this value to the type (thus 1, 3, and 5 become 33, 35, and 37).

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

  • vec (hwTriple) – The hwTriple object defining the vector. User can also supply a Python list of three doubles.

  • plane_normal (hwTriple) – The hwTriple object defining the plane normal components. User can also supply a Python list of three doubles.

  • plane_base (hwTriple) – The hwTriple object defining the base point components of the plane. User can also supply a Python list of three doubles.

  • dist (double) – The minimum distance from the bounding plane.

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

Example#

Create a morphconstraint for nodes with ID 1 , 2 , 3 , 4 , 5 to move along a vector and projected normally to the surface#
import hm
import hm.entities as ent

model = hm.Model()

# Create collection of nodes 1, 2, 3, 4, and 5
hm.Collection(model, ent.Node, [1, 2, 3, 4, 5])

model.morphconstraintcreatevec(
    ncollection=nodes,
    type=0,
    name="vec",
    vec=[1.0, 0.0, 0.0],
    plane_normal=[1.0, 0.0, 0.0],
    plane_base=[0.0, 0.0, 0.0],
    dist=0.0,
    color=32,
)