Model.morphconstraintupdatevec#

Model.morphconstraintupdatevec(ncollection, type, mcon, vec, plane_normal, plane_base, dist, color)#

Updates 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 entities.

  • 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).

  • mcon (Entity) – The morph constraint emtity to update.

  • vec (hwTriple) – The hwTriple object defining the vector components. 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#

Update a morphconstraint for nodes to move along a vector and projected normally to the surface#
import hm
import hm.entities as ent

model = hm.Model()

model.morphconstraintupdatevec(
    ncollection=hm.Collection(model, ent.Node, [1, 2, 3, 4, 5]),
    type=0,
    mcon=ent.Morphconstraint(model, 12),
    vec=[1.0, 0.0, 0.0],
    plane_normal=[1.0, 0.0, 0.0],
    plane_normal_base=[0.0, 0.0, 0.0],
    dist=0.0,
    color=32,
)