Skip to content

Point3D

Canonical path: NemAll_Python_Geometry.Point3D

Representation class for 3D point

To2D property writable

To2D: Point2D

convert to 2D3

X property writable

X: float

Get the x coordinate

Y property writable

Y: float

Get the y coordinate

Z property writable

Z: float

Get the z coordinate

GetCoords

GetCoords() -> tuple[float, float, float]

Get individual point coordinates

Returns:

  • float

    X coordinate

  • float

    Y coordinate

  • float

    Z coordinate

GetDistance

GetDistance(point: Point3D) -> float

Calculate the distance between this and a given point

Parameters:

Returns:

  • float

    Distance from this point to given point

Examples:

>>> Point3D(0.0, 3.0, 0.0).GetDistance(Point3D(4.0, 0.0, 0.0))
5.0

IsZero

IsZero() -> bool

Check the coords [0.0, 0.0, 0.0]

If the coords are zero, the return value is true. If the coords aren't zero, the return value is false.

Returns:

  • bool

    bool.

Examples:

>>> Point3D(1.0, 2.0, 3.0).IsZero()
False
>>> Point3D(0.0, 0.0, 0.0).IsZero()
True

Set overloaded

Set(point: Point3D)

Override with another point

Parameters:

Examples:

>>> this_point = Point3D(1.0, 2.0, 3.0)
>>> other_point = Point3D(3.0, 2.0, 1.0)
>>> this_point.Set(other_point)
>>> this_point
Point3D(3, 2, 1)
Set(x: float, y: float, z: float)

Override coordinates with new values

Parameters:

  • x (float) –

    coordinate.

  • y (float) –

    coordinate.

  • z (float) –

    coordinate.

Examples:

>>> some_point = Point3D(1.0, 2.0, 3.0)
>>> some_point.Set(3.0, 2.0, 1.0)
>>> some_point
Point3D(3, 2, 1)

Values

Values() -> list[float]

Get copy of X,Y,Z coordinates as python list

Returns:

  • list[float]

    List of X,Y,Z coordinates in exactly this order

Examples:

>>> example_point_3d.Values()
[1.0, 2.0, 3.0]

__add__ overloaded

__add__(vec: Vector3D) -> Point3D

Move the point by vector 3D

Parameters:

Returns:

Examples:

>>> Point3D(1.0, 2.0, 3.0) + Vector3D(1.0, 2.0, 3.0)
Point3D(2, 4, 6)
__add__(vec: Vector2D) -> Point3D

Move the point by vector 2D. Z axis will be ignored

Parameters:

Returns:

Examples:

>>> Point3D(1.0, 2.0, 3.0) + Vector2D(1.0, 2.0)
Point3D(2, 4, 3)
__add__(point: Point3D) -> Point3D

Point translation by point

Formula: Point(new) = Point(this) + Point

This is not standard math operation and is implemented only as practical use case for point moving in %Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Service::Move method with Vector3D operand.

Parameters:

Returns:

Examples:

>>> Point3D(1.0, 2.0, 3.0) + Point3D(1.0, 2.0, 3.0)
Point3D(2, 4, 6)

__eq__

__eq__(point: Point3D) -> bool

Comparison of points without tolerance.

Be careful, this method work without tolerance!

Parameters:

  • point (Point3D) –

    Compared point.

Returns:

  • bool

    True when points are equal, otherwise false.

__iadd__

__iadd__(point: Point3D) -> Point3D

In-place point translation by a point

This is not standard math operation and is implemented only as practical use case for point moving in Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Move method with Vector3D operand.

Parameters:

Returns:

Examples:

>>> point =  Point3D(1.0, 2.0, 3.0)
>>> point += Point3D(3.0, 2.0, 1.0)
>>> point
Point3D(4, 4, 4)

__idiv__

__idiv__(divider: float) -> Point3D

In-place division operator for a division by a scalar.

Parameters:

  • divider (float) –

    Divider.

Returns:

Examples:

>>> point = Point3D(2.0, 4.0, 6.0)
>>> point /= 2.0
>>> point
Point3D(1, 2, 3)

__init__ overloaded

__init__()

Initialize point in the origin

Examples:

>>> Point3D()
Point3D(0, 0, 0)
__init__(point: Point3D)

Copy contructor

Parameters:

  • point (Point3D) –

    Point which will be copied.

__init__(point: Point2D)

Initialize from a 2D point

The Z-coordinate is set to 0

Parameters:

  • point (Point2D) –

    2D Point which will be copied to the 3D point.

Examples:

>>> point_2d = Point2D(1.0, 2.0)
>>> Point3D(point_2d)
Point3D(1, 2, 0)
__init__(refPoint: Point3D, point: Point3D)

Initialize from a point in a local coordinate system

Parameters:

  • refPoint (Point3D) –

    Reference point.

  • point (Point3D) –

    Relative point

Examples:

>>> ref_point = Point3D(10.0, 10.0, 10.0)
>>> local_point = Point3D(1.0, 2.0, 3.0)
>>> Point3D(ref_point, local_point)
Point3D(11, 12, 13)
__init__(x: float, y: float, z: float)

Initialize from individual X,Y and Z coordinates in a global coordinate system

Parameters:

  • x (float) –

    X coordinate of point

  • y (float) –

    Y coordinate of point

  • z (float) –

    Z coordinate of point

__isub__

__isub__(point: Point3D) -> Point3D

In-place negative point translation by a point

This is not standard math operation and is implemented only as practical use case for point moving in Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Move method with Vector3D operand.

Parameters:

Returns:

Examples:

>>> point =  Point3D(1.0, 2.0, 3.0)
>>> point -= Point3D(3.0, 2.0, 1.0)
>>> point
Point3D(-2, 0, 2)

__mul__ overloaded

__mul__(matrix: Matrix2D) -> Point3D

Point transformation by a 2D matrix

Parameters:

  • matrix (Matrix2D) –

    2D transformation Matrix

Returns:

Examples:

>>> point =  Point3D(1.0, 2.0, 3.0)
>>> point * rotation_by_90_deg
Point3D(-2, 1, 3)
__mul__(matrix: Matrix3D) -> Point3D

Point transformation by a 3D matrix

Parameters:

  • matrix (Matrix3D) –

    3D transformation Matrix

Returns:

Examples:

>>> point =  Point3D(1.0, 2.0, 3.0)
>>> point * rotation_by_90_deg_around_x
Point3D(1, -3, 2)
__mul__(scale: float) -> Point3D

Scale point with a factor

Parameters:

  • scale (float) –

    scaling factor

Returns:

Examples:

>>> point =  Point3D(1.0, 2.0, 3.0)
>>> point * 2.0
Point3D(2, 4, 6)

__ne__

__ne__(point: Point3D) -> bool

Comparison of points without tolerance.

Be careful, this method work without tolerance!

Parameters:

  • point (Point3D) –

    Compared point.

Returns:

  • bool

    True when points are not equal, otherwise false.

__repr__

__repr__() -> str

Convert to string

__sub__ overloaded

__sub__(vec: Vector3D) -> Point3D

Move the point by reversed vector 3D

Parameters:

Returns:

Examples:

>>> Point3D(3.0, 6.0, 9.0) - Vector3D(2.0, 4.0, 6.0)
Point3D(1, 2, 3)
__sub__(vec: Vector2D) -> Point3D

Move the point by reversed vector 2D. Z coordinate stays unchanged.

Parameters:

Returns:

Examples:

>>> Point3D(3.0, 6.0, 9.0) - Vector2D(2.0, 4.0)
Point3D(1, 2, 9)
__sub__(point: Point3D) -> Point3D

Point translation by negative point

Formula: Point(new) = Point(this) - Point

This is not standard math operation and is implemented only as practical use case for point moving in %Allplan. In this case given operand point represent offset from Zero point. For standard move operation please use Service::Move method with Vector3D operand.

Parameters:

Returns:

Examples:

>>> Point3D(3.0, 6.0, 9.0) - Point3D(2.0, 4.0, 6.0)
Point3D(1, 2, 3)

__truediv__

__truediv__(divider: float) -> Point3D

Division operator.

Parameters:

  • divider (float) –

    Divider.

Returns:

Examples:

>>> Point3D(2.0, 4.0, 6.0) / 2.0
Point3D(1, 2, 3)
Placeholder