Model.morphconstraintupdatematch#

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

Updates a match type morphconstraint between two marks of elements such that they maintain a similar shape if the elements of either one mark or both marks 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 first element entities.

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

  • 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

  • morphconstraint_entity (Entity) – The object describing the morph constrained entity.

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

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

  • node_basea (Entity) – The node entity of 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 of 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 through 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.morphconstraintupdatematch(
a_collection=hm.Collection(
        model,
        ent.Node,
        [83, 84, 86, 87, 88, 89, 90, 93, 95, 96, 96, 99, 100, 101, 102, 105, 107],
),
b_collection=hm.Collection(
        model,
        ent.Node,
        [2, 51, 52, 53, 54, 57, 62, 63, 6, 4, 65, 66, 69, 74, 75, 7, 6, 77, 78, 81],
),
type=6,
morphconstraint_entity=ent.Morphconstraint(model, 1),
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,
)