Model.mechrotatebody#

Model.mechrotatebody(name, plane_normal, plane_base, angle, method, tolerance, angle_step)#

Rotates a body of a mechanism about a normal, passing through the origin of the plane by given angle.

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

Parameters:
  • name (hwString) – The name of the body of the mechanism.

  • 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.

  • angle (double) – The angle to rotate the body about the plane.

  • method (unsigned int) –

    Method to enforce rotation:

    0 - Free rotation, bodies orientation is rotated by angle, can result in inverted rotation.

    1 - Enforce axis, bodies orientation is rotated by angle.

    2 - Enforce origin, rotation will occur about line passing through origin of plane, inverted rotation possible.

    3 - Enforce origin and axis, direction of rotation and origin both are fixed (recommended).

  • tolerance (double) – The tolerance allowed during the placement.

  • angle_step (double) – The size of the iterative steps used to solve for the rotation.

Example#

Move body “Move_Track” on the current mechanism with a tolerance of 0.001 ,about the global y-axis by 20.0 degrees, use method=3#
import hm
import hm.entities as ent

model = hm.Model()

model.mechrotatebody(
    name="Move_Track",
    plane_normal=[0.0, 1.0, 0.0],
    plane_normal_base=[-1660.82465, 103.84237, 418.49172],
    angle=20.0,
    method=3,
    tolerance=0.001,
    angle_step=10.0,
)