Model.morphconstraintcreatesmooth#

Model.morphconstraintcreatesmooth(nlist, type, closed, name, color)#

Creates a smooth type morphconstraint for the selected nodes. During morphing, the perturbations of the nodes or dependent handles will be modified using a spline based approximation so that edge domains running along the selected entities will have smooth contours.

Parameters:
  • nlist (EntityList) – The list containing the node entities.

  • type (int) –

    0 - Apply to nodes. All handles on the node list serve as anchors for the spline curve and nodes are adjusted to the curve based on influences

    1 - Apply to dependent handles. Only the independent handles on the node list serve as anchors and the dependent handles are adjusted to the curve based on influences

  • closed (int) –

    0 - Open ended

    1 - Loop. The first node on the list will be added to the end to form a loop.

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

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

Example#

Create a smooth morphconstraint for nodes with IDs 1 - 5 with a closed loop#
import hm
import hm.entities as ent

model = hm.Model()

model.morphconstraintcreatesmooth(
    nlist=[
        ent.Node(model, 1),
        ent.Node(model, 2),
        ent.Node(model, 3),
        ent.Node(model, 4),
        ent.Node(model, 5),
    ],
    type=0,
    closed=1,
    name="smooth",
    color=32,
)