Skip to content

AxisPlacement3D

Canonical path: NemAll_Python_Geometry.AxisPlacement3D

Representation class for orthogonal axis placement in 3D space

Placement is given by Origin and 2 direction vectors - local x-axis and local z-axis. y-axis is computed on demand

Origin property writable

Origin: Point3D

Get origin

XDirection property writable

XDirection: Vector3D

Get x-direction

ZDirection property writable

ZDirection: Vector3D

Get z-direction

CalcGlobalPoint

CalcGlobalPoint(point: Point3D) -> Point3D

Calculate the point in global coordinates based on the point in local coordinates of the axis placement

Parameters:

  • point (Point3D) –

    Point in local coordinates of the axis placement

Returns:

  • Point3D

    Point in global coordinates

Examples:

For an axis_placement having its origin in (1, 2, 3) and rotated around the Z-axis by 45 degrees:

>>> axis_placement_3d
AxisPlacement3D(
   Origin(1, 2, 3)
   X Direction(0.707..., 0.707..., 0)
   Z Direction(0, 0, 1))

The global coordinates of the point (1, 1, 1) in local coordinates are calculated like:

>>> axis_placement_3d.CalcGlobalPoint(Point3D(1, 1, 1))
Point3D(1, 3.414..., 4)

CalcLocalPoint

CalcLocalPoint(point: Point3D) -> Point3D

Calculate the point in local coordinates of the axis placement based on the point in global coordinates

Parameters:

  • point (Point3D) –

    Point in global coordinates

Returns:

  • Point3D

    Point in local coordinates of the axis placement

Examples:

For an axis_placement having its origin in (1, 2, 3) and rotated around the Z-axis by 45 degrees:

>>> axis_placement_3d
AxisPlacement3D(
   Origin(1, 2, 3)
   X Direction(0.707..., 0.707..., 0)
   Z Direction(0, 0, 1))

The local coordinates of the point (1, 3.4142135624, 4) in global coordinates are calculated like:

>>> axis_placement_3d.CalcLocalPoint(Point3D(1, 3.4142135624, 4))
Point3D(1, 1, 1)

GetOrigin

GetOrigin() -> Point3D

Get origin

Returns:

Examples:

>>> axis_placement_3d.GetOrigin()
Point3D(1, 2, 3)

GetRotationMatrix

GetRotationMatrix() -> Matrix3D

Similar to GetTransformationMatrix(), but the resulting matrix does not have translation components

Returns:

  • Matrix3D

    Transformation matrix from local to global, but without translation

Examples:

For an axis_placement having its origin in (1, 2, 3) and rotated around the Z-axis by 45 degrees:

>>> axis_placement_3d
AxisPlacement3D(
   Origin(1, 2, 3)
   X Direction(0.707..., 0.707..., 0)
   Z Direction(0, 0, 1))

The rotation matrix (only rotation components) is calculated like:

>>> axis_placement_3d.GetRotationMatrix()
Matrix3D(
   0.707... 0.707... 0 0
   -0.707... 0.707... 0 0
   0 0 1 0
   0 0 0 1)

Applying the matrix to a point rotates it around the Z-axis by 45 degrees, but does not translate it:

>>> Point3D(1, 1, 1) * axis_placement_3d.GetRotationMatrix()
Point3D(-0, 1.414..., 1)

GetTransformationMatrix

GetTransformationMatrix() -> Matrix3D

Get the transformation matrix of the axis placement.

The transformation matrix is a 4x4 matrix that can be used to transform geometry objects from local coordinates of the placement to global coordinates.

Returns:

  • Matrix3D

    Transformation matrix from local to global

Examples:

For an axis_placement having its origin in (1, 2, 3) and rotated around the Z-axis by 45 degrees:

>>> axis_placement_3d
AxisPlacement3D(
   Origin(1, 2, 3)
   X Direction(0.707..., 0.707..., 0)
   Z Direction(0, 0, 1))

The transformation matrix is calculated like:

>>> axis_placement_3d.GetTransformationMatrix()
Matrix3D(
   0.707... 0.707... 0 0
   -0.707... 0.707... 0 0
   0 0 1 0
   1 2 3 1)

Applying the matrix to a point has the same effect as CalcGlobalPoint():

>>> Point3D(1, 1, 1) * axis_placement_3d.GetTransformationMatrix()
Point3D(1, 3.414..., 4)

GetXDirection

GetXDirection() -> Vector3D

Get x-direction

Returns:

  • Vector3D

    X direction of the axis placement

Examples:

>>> axis_placement_3d.GetXDirection()
Vector3D(0.707..., 0.707..., 0)

GetYDirection

GetYDirection() -> Vector3D

Get direction of local y-axis

Returns:

  • Vector3D

    Y direction of the axis placement

Examples:

>>> axis_placement_3d.GetYDirection()
Vector3D(-0.707..., 0.707..., 0)

GetZDirection

GetZDirection() -> Vector3D

Get z-direction

Returns:

IsValid

IsValid() -> bool

Check if the placement is valid

Returns:

  • bool

    True if it is a valid placement

Examples:

>>> axis_placement_3d.IsValid()
True

A placement, in which the X and Z directions are not perpendicular:

>>> AxisPlacement3D(Point3D(), Vector3D(1, 0, 0), Vector3D(1, 0, 1)).IsValid()
False

RotateAroundLocalZAxis

RotateAroundLocalZAxis(angle: Angle)

Rotate the placement around it's Z-axis

Parameters:

  • angle (Angle) –

    rotation angle

Examples:

>>> axis_placement_3d.RotateAroundLocalZAxis(Angle(-pi/2))
>>> axis_placement_3d
AxisPlacement3D(
   Origin(1, 2, 3)
   X Direction(0.707..., -0.707..., 0)
   Z Direction(0, 0, 1))

Set

Set(origin: Point3D, xDir: Vector3D, zDir: Vector3D)

Set the placement

Parameters:

SetOrigin

SetOrigin(origin: Point3D)

Set origin

Parameters:

SetXDirection

SetXDirection(dir: Vector3D)

Set x-direction

Parameters:

  • dir (Vector3D) –

    Vector3D const reference

SetZDirection

SetZDirection(dir: Vector3D)

Set z-direction

Parameters:

  • dir (Vector3D) –

    Vector3D const reference

__eq__

__eq__(axis_placement: AxisPlacement3D) -> bool

Comparison of axis placements.

Be careful, this method work without tolerance!

Parameters:

Returns:

  • bool

    True when axis placements are equal, otherwise false.

__init__ overloaded

__init__()

Initialize

__init__(placement: AxisPlacement3D)

Copy constructor.

Parameters:

__init__(refPoint: Point3D)

Constructor with only reference point

Parameters:

  • refPoint (Point3D) –

    reference point

__init__(refPoint: Point3D, xvector: Vector3D, zvector: Vector3D)

Constructor which fully constructs the element.

Parameters:

  • refPoint (Point3D) –

    reference point

  • xvector (Vector3D) –

    direction vector X

  • zvector (Vector3D) –

    direction vector Z

__init__(rotationAxis: Axis3D, rotationStart: Point3D)

Constructor from rotation axis and start point of rotation.

Parameters:

  • rotationAxis (Axis3D) –

    rotation axis

  • rotationStart (Point3D) –

    starting point of rotation, have not to be on axis

__init__(matrix: Matrix3D)

Constructor from Matrix3D

Parameters:

__repr__

__repr__() -> str

Convert to string

Placeholder