Model.morphcreatemodelshape#

Model.morphcreatemodelshape(type, mode, e_collection, node_list, plane_normal, plane_base, did, lid)#

Creates a shape which, when applied, will change the value specified in type (length along nodes, angle measured by three nodes, the radius or arc angle of an edge domain, or the area, volume, or mass of selected elements) for the mesh.

This function is intended to be used as a precursor to the creation of a “model constraint” where some feature of a mesh is constrained and one or more assigned shapes are used to adjust the mesh to meet the constraint. This function is best used to generate an arbitrary shape which can then be selected when creating the model constraint.

Each shape type has different required values. Length (type=0) requires two or more nodes in the node_list. Angle (type=1) requires three nodes in the node_list node list. Radius and arc angle (type 2 and 3) require an edge domain ID for did and for mode=1 a plane is required for plane, for mode=2 a line ID is required for lid, and for mode=3 a node is required for nodes. Area, volume, and mass (type 4, 5, and 6) require elements in e_collection.

Parameters:
  • type (int) –

    0 - Length

    1 - Angle

    2 - Radius

    3 - Arc angle

    4 - Area

    5 - Volume

    6 - Mass

  • mode (int) –

    Calculation mode for a radius or arc angle:

    0 - By domain

    1 - By axis

    2 - By line

    3 - By node

  • e_collection (Collection) – The collection containing the element entities for type 4, 5 and 6.

  • node_list (EntityList) –

    The node list ID.

    For type=0, this is a list of nodes which measures the length.

    For type=1, this is three nodes which measure the angle.

    For type 2 and 3, this is the node for measuring the radius or arc angle (mode=3).

  • plane_normal (hwTriple) – The hwTriple object defining the plane normal components of the plne used to measure the radius or arc angle. User can also supply a Python list of three doubles.

  • plane_base (hwTriple) – The hwTriple object defining the base point components of the plane used to measure the radius or arc angle. User can also supply a Python list of three doubles.

  • did (unsigned int) – ID of domain for measuring radius and arc angle (type 2 and 3)

  • lid (unsigned int) – ID of line for measuring the radius and arc angle (type 2 and 3, mode=2)

Examples#

Create a shape for a model constraint for a length measured from nodes with IDs 11 to 12 to 13#
import hm
import hm.entities as ent

model = hm.Model()

model.morphcreatemodelshape(
    type=0,
    mode=0,
    e_collection=hm.CollectionByInteractiveSelection(model, ent.Element),
    node_list=[ent.Node(model, 11), ent.Node(model, 12), ent.Node(model, 13)],
    plane_normal=[1.0, 0.0, 0.0],
    plane_normal_base=[0.0, 0.0, 0.0],
    did=0,
    lid=0,
)
Create a shape for a model constraint for a radius measured about an axis#
import hm
import hm.entities as ent

model = hm.Model()

node_collection = hm.CollectionByInteractiveSelection(model, ent.Node)
nodes_list = []

for node in node_collection:
    nodes_list.append(node)

model.morphcreatemodelshape(
    type=2,
    mode=1,
    e_collection=hm.CollectionByInteractiveSelection(model, ent.Element),
    node_list=nodes_list,
    plane_normal=[1.0, 0.0, 0.0],
    plane_normal_base=[1.0, 0.0, 0.0],
    did=33,
    lid=0,
)