Model.morphhandleprojectplaneoffset#

Model.morphhandleprojectplaneoffset(h_collection, p_collection, plane_normal, plane_base, nproj, proj, sym, con, offset)#

Moves each of the selected handles on to the defined plane 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 the 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 the specified plane.

Constraints may move the perturbed handles off of the specified plane after the handles are moved to the plane.

The offset can be set as an absolute amount, an amount added to half the thickness of theshells 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.

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

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

  • plane_base (hwTriple) – The hwTriple object defining the base point components of the plane. User can also supply a Python list of three doubles.

  • 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 plane#
import hm
import hm.entities as ent

model = hm.Model()

model.morphhandleprojectplaneoffset(
    h_collection=hm.Collection(model, ent.Handle),
    p_collection=hm.Collection(model, ent.Element),
    plane_normal=[1.0, 0.0, 0.0],
    plane_normal_base=[1.0, 0.0, 0.0],
    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 plane#
import hm
import hm.entities as ent

model = hm.Model()

model.morphhandleprojectplaneoffset(
    h_collection=hm.Collection(model, ent.Handle),
    p_collection=hm.CollectionByInteractiveSelection(model, ent.Element),
    plane_normal=[1.0, 0.0, 0.0],
    plane_normal_base=[1.0, 0.0, 0.0],
    nproj=1,
    proj=[1.0, 0.0, 0.0],
    sym=1,
    con=1,
    offset=0.0,
)
Project handles to a plane normal to the elements and offset by the 1.5x the thickness#
import hm
import hm.entities as ent

model = hm.Model()

model.morphhandleprojectplaneoffset(
    h_collection=hm.Collection(model, ent.Handle),
    p_collection=hm.Collection(model, ent.Element, [1, 2, 3, 4, 5, 6]),
    plane_normal=[1.0, 0.0, 0.0],
    plane_normal_base=[1.0, 0.0, 0.0],
    nproj=22,
    proj=[1.0, 0.0, 0.0],
    sym=1,
    con=1,
    offset=1.5,
)