Model.morphalterdistancevec#

Model.morphalterdistancevec(h1collection, h2collection, n1, n2, hold, dist, sym, con, vec)#

Alter the distance between two nodes using morphing and measuring along a vector.

Parameters:
  • h1collection (Collection) – The collection containing the hnadle entities - end a.

  • h2collection (Collection) – The collection containing the handle entities - end b.

  • n1 (Entity) – The object defining the node entity - end a

  • n2 (Entity) – The object defining the node entity - end b

  • hold (int) –

    Specify which part of the 2-node system to anchor:

    0 - Hold end a

    1 - Hold end b

    2 - Hold middle

  • dist (double) – New distance between n1 and n2

  • sym (int) –

    Flag for use of symmetry:

    0 - Do not use symmetry

    1 - Use symmetry

  • con (int) –

    Flag for use of constraints:

    0 - Do not use constraints

    1 - Use constraints

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

Example#

The handles on the collections selected interactively will be moved based on hold to create the new distance dist between n1 and n2 as measured along vector vec. If symmetry is used, all handles linked to marked handles by symmetry will also be perturbed. If constraints are used, they will be applied to the perturbations.#
import hm
import hm.entities as ent

model = hm.Model()

model.morphalterdistancevec(
    h1collection=hm.Collection(model, ent.Handle, populate=False),
    h2collection=hm.CollectionByInteractiveSelection(model, ent.Handle),
    n1=ent.Node(model, 132),
    n2=ent.Node(model, 783),
    hold=0,
    dist=100.0,
    sym=1,
    con=1,
    vec=[1.0, 0.0, 0.0],
)