Model.morphhandleprojectlineoffset#

Model.morphhandleprojectlineoffset(h_collection, p_collection, line_list, node_list, nproj, proj, sym, con, offset)#

Moves each of the selected handles onto a line defined by the lines and nodes on the lists along a direction defined by the projection type. Applying symmetry links, constraints, and an offset are optional. All domains influenced by the selected handles will be morphed accordingly.

If nproj is set to 2, 5, or 6, the shell elements on p_collection will be used to determine the projection direction for the handles. If no elements are on the collection, then all shell elements will be used to determine the projection directions.

If symmetry is specified, handles linked through symmetry to those selected will be moved in a way that mirrors the selected handles which may or may not move them to other lines in the model.

Constraints may move the perturbed handles off the selected line after the handles are moved to the line.

The offset can be set as an absolute amount, an amount added to half the thickness of the shells touching the handles, or an amount multiplied by half the thickness of the shells touching the handles.

Parameters:
  • h_collection (Collection) – The collection containing the handle entities to move.

  • p_collection (Collection) – The collection containing the normal element entities.

  • line_list (EntityList) – The list of the line entities.

  • node_list (EntityList) – The list of the node entities.

  • nproj (int) –

    0 - Project along vector proj

    1 - Project normal to line

    2 - Project normal to elements in p_collection (averaged)

    5 - Project normal to elements in p_collection (smoothed)

    6 - Project normal to elements in p_collection (cfd corners)

    +10 - offset along projection vector (rather than absolute distance)

    +20 - offset distance = t / 2 + offset

    +40 - offset distance = t / 2 * offset

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

  • sym (int) –

    0 - Ignore symmetry links

    1 - Apply symmetry links

  • con (int) –

    0 - Ignore constraints

    1 - Apply constraints after perturbing handles

  • offset (double) – The distance the handles will be offset from line (or added to or multiplied by half the thickness of the shells touching the handles).

Examples#

Project handles to a line along a vector#
import hm
import hm.entities as ent

model = hm.Model()

model.morphhandleprojectlineoffset(
    h_collection=hm.Collection(model, ent.Handle),
    p_collection=hm.CollectionByInteractiveSelection(model, ent.Element),
    line_list=[ent.Line(model, 1)],
    node_list=[ent.Node(model, 1)],
    nproj=0,
    proj=[1.0, 0.0, 0.0],
    sym=1,
    con=1,
    offset=0.0,
)
Project handles to a node list normal to the line#
import hm
import hm.entities as ent

model = hm.Model()

model.morphhandleprojectlineoffset(
    h_collection=hm.Collection(model, ent.Handle),
    p_collection=hm.CollectionByInteractiveSelection(model, ent.Element),
    line_list=[ent.Line(model, 1)],
    node_list=[
        ent.Node(model, 10),
        ent.Node(model, 11),
        ent.Node(model, 12),
        ent.Node(model, 15),
        ent.Node(model, 16),
        ent.Node(model, 17),
        ent.Node(model, 22),
    ],
    nproj=1,
    proj=[1.0, 0.0, 0.0],
    sym=1,
    con=1,
    offset=0.0,
)
Project handles to a line normal to the elements and offset by the 1.5x the thickness#
import hm
import hm.entities as ent

model = hm.Model()

model.morphhandleprojectlineoffset(
    h_collection=hm.Collection(model, ent.Handle),
    p_collection=hm.Collection(model, ent.Element, [1, 2, 3, 4, 5, 6]),
    line_list=[ent.Line(model, 1)],
    node_list=[
        ent.Node(model, 1),
    ],
    nproj=22,
    proj=[1.0, 0.0, 0.0],
    sym=1,
    con=1,
    offset=1.5,
)