Model.morphtranslateshapemark#

Model.morphtranslateshapemark(s_collection, n_collection, a_collection, base_node_entity, mode, tol, con)#

Translates each shape on the s_collection by a vector measured from the basenode to each node on n_collection and affect only the nodes on a_collection. The shapes may be applied to the mesh, created as new shapes, added to existing shapes, or may replace existing shapes.

Parameters:
  • s_collection (Collection) – The collection containing the shape entities to translate.

  • n_collection (Collection) – The collection containing the node entities that are to translate to final position nodes.

  • a_collection (Collection) – The collection containing the target node entities.

  • base_node_entity (Entity) – The object describing the entity.

  • mode (int) –

    0 - Apply each shape to the mesh.

    1 - Apply each shape and add the perturbations to the original shape.

    2 - Apply each shape and overwrite the original shape.

    3 - Apply each shape and create a new shape or shapes.

    4 - Create a new shape or shapes but do not apply them to the mesh.

  • tol (double) – The “envelope” or distance around the translated shape inside which nodes are affected.

  • con (int) –

    0 - Do not use constraints.

    1 - Use constraints.

Examples#

Translate a shape from one node to another and apply it to the mesh#
import hm
import hm.entities as ent

model = hm.Model()

model.morphtranslateshapemark(
    s_collection=(hm.Collection(model, ent.Shape, 1)),
    n_collection=hm.Collection(model, ent.Node, 12),
    a_collection=hm.Collection(model, ent.Node),
    base_node_entity=ent.Node(model, 11),
    mode=0,
    tol=3.0,
    con=1,
)
Translate all shapes from one node to another and create new shapes, but only on selected nodes#
import hm
import hm.entities as ent

model = hm.Model()

model.morphtranslateshapemark(
    s_collection=(hm.Collection(model, ent.Shape)),
    n_collection=hm.Collection(model, ent.Node, 12),
    a_collection=hm.Collection(
        model, ent.Node, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
    ),
    base_node_entity=ent.Node(model, 11),
    mode=4,
    tol=3.0,
    con=1,
)