Model.morphconstraintcreatematch#

Model.morphconstraintcreatematch(a_collection, b_collection, type, name, vec, dist, node_basea, node_xa, node_xya, node_baseb, node_xb, node_xyb, color)#

Creates a match type morphconstraint between two marks of elements such that they maintain a similar shape if the elements of either one collection or both collections are morphed. The two meshes do not have to be identical but the more similar they are the better the constraint will work.

This type of constraint can be used multiple times on the same set of elements in order to make three or more meshes match each other. Note that only shell elements can be matched using this constraint.

Parameters:
  • a_collection (Collection) – The collection containing the element entities of the first nodes.

  • b_collection (Collection) – The collection containing the element entities of the second nodes.

  • type (int) –

    0 - Allow to slide normal to the mesh

    1 - Allow sliding normal to the specified vector vec

    2 - Match the shape between the two meshes

    +4 - Stretch mesh around the constrained elements

  • name (hwString) – The name of the morphconstraint.

  • vec (hwTriple) – The hwTriple object defining the vector. User can also supply a Python list of three doubles. Only used for type 1 and 5.

  • dist (double) – The distance to be maintained between the meshes. Not used for type 2 and 6.

  • node_basea (Entity) – The node entity defining the base of a local system oriented to the mesh specified by a_collection. Only used for type 2 and 6.

  • node_xa (Entity) – The node entity lying in the x direction of a local system oriented to the mesh specified by a_collection. Only used for type 2 and 6.

  • node_xya (Entity) – The node entity lying in the xy-plane of a local system oriented to the mesh specified by b_collection. Only used for type 2 and 6.

  • node_baseb (Entity) – The node entity defining the base of a local system oriented to the mesh specified by b_collection. Only used for type 2 and 6.

  • node_xb (Entity) – The node entity lying in the x direction of a local system oriented to the mesh specified by b_collection. Only used for type 2 and 6.

  • node_xyb (Entity) – The node entity lying in the xy-plane of a local system oriented to the mesh specified by a_collection. Only used for type 2 and 6.

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

Example#

Create a match constraint which matches the shape between two meshes (type=2 ) and uses mesh stretching (type +4 for a total of 6 )#
import hm
import hm.entities as ent

model = hm.Model()

model.morphconstraintcreatematch(
    a_collection=hm.Collection(
            model,
            ent.Element,
            [83, 84, 86, 87, 88, 89, 90, 93, 95, 96, 98, 99, 100, 101, 102, 105, 107],
    ),
    b_collection=hm.Collection(
            model,
            ent.Element,
            [50, 51, 52, 53, 54, 57, 62, 63, 64, 65, 66, 69, 74, 75, 76, 77, 78, 81],
    ),
    type=6,
    name="mcon",
    vec=[1.0, 0.0, 0.0],
    dist=0.0,
    node_basea=ent.Node(model, 133),
    node_xa=ent.Node(model, 135),
    node_xya=ent.Node(model, 110),
    node_baseb=ent.Node(model, 60),
    node_xb=ent.Node(model, 62),
    node_xyb=ent.Node(model, 86),
    color=38,
)