Model.mechapplybodytotargetpoints#

Model.mechapplybodytotargetpoints(bodies_array, point_pairs_array)#

Moves source points on the bodies of a mechanism to target points.

The mechanism must have the enabled flag set to true for this to be possible.

Parameters:
  • bodies_array (hwStringList) – The list of strings that contains the names of the bodies to update.

  • point_pairs_array (hwDoubleList2) –

    The list that contains the source and target point pairs.

    The point pair elements are given in the following order:

    p1x p1y p1z (coordinates of source point 1 on body1)

    p2x p2y p2z (coordinates of source point 2 on body2)

    pNx pNy pNz (coordinates of source point N on body2)

    t1x t1y t1z (coordinates of target point 1 on body1)

    t2x t2y t2z (coordinates of target point 2 on body2)

    tNx tNy tNz (coordinates of target point N on body2)

Example#

Move bodies “LEFT LOWER LEG” and “RIGHT LOWER LEG” , with source - target point pairs as: LEFT LOWER LEG:(-156.84033, 47.889306, 31.0028062) to (-148.916035, 72.1107681, -10.4045246) and RIGHT LOWER LEG: (-148.979951, -66.8473281, -34.494296) to (-141.051409, -42.6880283, -75.937107)#
import hm
import hm.entities as ent

model = hm.Model()

model.mechapplybodytotargetpoints(
    bodies_array=["LEFT LOWER LEG", "RIGHT LOWER LEG"],
    point_pairs_array=[
        [-156.84033, 47.889306, 31.0028062],
        [-148.979951, -66.8473281, -34.494296],
        [-148.916035, 72.1107681, -10.4045246],
        [-141.051409, -42.6880283, -75.937107],
    ],
)