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
Methods:
-
CalcGlobalPoint–Calculate the point in global coordinates based on the point in local coordinates of the axis placement
-
CalcLocalPoint–Calculate the point in local coordinates of the axis placement based on the point in global coordinates
-
GetOrigin–Get origin
-
GetRotationMatrix–Similar to
GetTransformationMatrix(), but the resulting matrix does not have translation components -
GetTransformationMatrix–Get the transformation matrix of the axis placement.
-
GetXDirection–Get x-direction
-
GetYDirection–Get direction of local y-axis
-
GetZDirection–Get z-direction
-
IsValid–Check if the placement is valid
-
RotateAroundLocalZAxis–Rotate the placement around it's Z-axis
-
Set–Set the placement
-
SetOrigin–Set origin
-
SetXDirection–Set x-direction
-
SetZDirection–Set z-direction
-
__eq__–Comparison of axis placements.
-
__init__–Overloaded function. See individual overloads.
-
__repr__–Convert to string
Attributes:
-
Origin(Point3D) –Get origin
-
XDirection(Vector3D) –Get x-direction
-
ZDirection(Vector3D) –Get z-direction
CalcGlobalPoint
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:
CalcLocalPoint
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:
GetOrigin
GetOrigin() -> Point3D
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:
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():
GetXDirection
GetXDirection() -> Vector3D
GetYDirection
GetYDirection() -> Vector3D
GetZDirection
GetZDirection() -> Vector3D
IsValid
RotateAroundLocalZAxis
RotateAroundLocalZAxis(angle: Angle)
Set
SetXDirection
SetXDirection(dir: Vector3D)
SetZDirection
SetZDirection(dir: Vector3D)
__eq__
__eq__(axis_placement: AxisPlacement3D) -> bool
Comparison of axis placements.
Be careful, this method work without tolerance!
Parameters:
-
axis_placement(AxisPlacement3D) –axis placement to be compared.
Returns:
-
bool–True when axis placements are equal, otherwise false.
__init__
overloaded
Initialize
__init__(placement: AxisPlacement3D)
__init__(refPoint: Point3D)
__init__(matrix: Matrix3D)