Skip to content

Line3D

Canonical path: NemAll_Python_Geometry.Line3D

Representation class for 3D line.

EndPoint property writable

EndPoint: Point3D

Get the end point.

Get the end point in world coordinate system.

EndRelPoint property writable

EndRelPoint: Point3D

End point in local coordinate system

RefPoint property writable

RefPoint: Point3D

Reference point of the line (origin of the line's local coordinate system)

StartPoint property writable

StartPoint: Point3D

Get the start point.

Get the start point in world coordinate system.

StartRelPoint property writable

StartRelPoint: Point3D

Start point in local coordinate system

To2D property

To2D: Line2D

convert to 2D3

EqualRef

EqualRef(line: Line3D) -> bool

Check, whether the reference point of another line is equal to the reference point of this line.

Reference point of a line is by default (0,0,0), regardless of the start point of the line.

Parameters:

  • line (Line3D) –

    Line to compare

Returns:

  • bool

    True if the reference points are equal, False otherwise

Examples:

>>> this_line = Line3D(0, 0, 0, 1, 1, 1)
>>> this_line.EqualRef(Line3D(1, 1, 1, 2, 2, 2))
True
>>> this_line.RefPoint = Point3D(1, 1, 1)
>>> this_line.EqualRef(Line3D(1, 1, 1, 2, 2, 2))
False

GetCenterPoint

GetCenterPoint() -> Point3D

Get the center point in world coordinate system

Returns:

Examples:

line_3 is a line from (0, 0, 0) to (5, 5, 5). The center point is at:

>>> Line3D(0, 0, 0, 5, 5, 5).GetCenterPoint()
Point3D(2.5, 2.5, 2.5)

GetCoords

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

Get individual line coordinates as a tuple

Returns:

  • float

    Start point X coordinate

  • float

    Start point Y coordinate

  • float

    Start point Z coordinate

  • float

    End point X coordinate

  • float

    End point Y coordinate

  • float

    End point Z coordinate

GetEndPoint

GetEndPoint() -> Point3D

Get the end point.

Get the end point in world coordinate system.

Returns:

GetEndRelPoint

GetEndRelPoint() -> Point3D

Get the end point in local coordinate system, which has its origin in the reference point.

Returns:

  • Point3D

    End point in local coordinate system

GetRefPoint

GetRefPoint() -> Point3D

Get the reference point of the line (origin of the line's local coordinate system)

Returns:

GetStartPoint

GetStartPoint() -> Point3D

Get the start point.

Get the start point in world coordinate system.

Returns:

GetStartRelPoint

GetStartRelPoint() -> Point3D

Get the start point in local coordinate system, which has its origin in the reference point.

Returns:

GetVector

GetVector() -> Vector3D

Get the vector from start to end point.

Returns:

  • Vector3D

    Vector from the start to the end point

Examples:

>>> Line3D(1, 1, 1, 2, 2, 2).GetVector()
Vector3D(1, 1, 1)

Is2DLine

Is2DLine() -> bool

Check, whether the line is locaten in XY plane (both Z coordinates are 0)

Returns:

  • bool

    True if the line is a 2D line, False otherwise

Examples:

>>> Line3D(0, 0, 0, 1, 1, 0).Is2DLine()
True
>>> Line3D(0, 0, 0, 1, 1, 1).Is2DLine()
False

IsPoint

IsPoint() -> bool

Check, whether the line is a point (start point equal end point)

Returns:

  • bool

    Line is a point: true/false

Examples:

>>> Line3D(1, 1, 1, 1, 1, 1).IsPoint()
True
>>> Line3D(0, 0, 0, 1, 1, 1).IsPoint()
False

Reverse

Reverse()

Reverse the line

Examples:

>>> line = Line3D(0, 0, 0, 1, 1, 1)
>>> line.Reverse()
>>> line
Line3D(1, 1, 1, 0, 0, 0)

Set overloaded

Set(x1: float, y1: float, z1: float, x2: float, y2: float, z2: float)

Set the line with new world coordinate values

Parameters:

  • x1 (float) –

    X coordinate of start point

  • y1 (float) –

    Y coordinate of start point

  • z1 (float) –

    Z coordinate of start point

  • x2 (float) –

    X coordinate of end point

  • y2 (float) –

    Y coordinate of end point

  • z2 (float) –

    Z coordinate of end point

Set(line: Line3D)

Override the line with another line

Parameters:

Set(startPoint: Point3D, endPoint: Point3D)

Set the line with new start and end points

Parameters:

  • startPoint (Point3D) –

    start point.

  • endPoint (Point3D) –

    end point.

Set(refPoint: Point3D, startPoint: Point3D, endPoint: Point3D)

Set the line with new start, end and reference points

Parameters:

  • refPoint (Point3D) –

    Reference point.

  • startPoint (Point3D) –

    relative start point.

  • endPoint (Point3D) –

    relative end point.

SetEndPoint

SetEndPoint(endPoint: Point3D)

Set end point

Set end point in world coordinate system.

Parameters:

  • endPoint (Point3D) –

    End point.

SetEndRelPoint

SetEndRelPoint(endPoint: Point3D)

Set the end point in local coordinate system, which has its origin in the reference point.

Parameters:

  • endPoint (Point3D) –

    End point.

SetRefPoint

SetRefPoint(refPoint: Point3D)

Set the reference point of the line (origin of the line's local coordinate system)

Parameters:

  • refPoint (Point3D) –

    Reference point.

SetStartPoint

SetStartPoint(startPoint: Point3D)

Set start point

Set start point in world coordinate system.

Parameters:

  • startPoint (Point3D) –

    Start point.

SetStartRelPoint

SetStartRelPoint(startPoint: Point3D)

Set the start point in local coordinate system, which has its origin in the reference point.

Parameters:

  • startPoint (Point3D) –

    Start point.

TrimEnd

TrimEnd(ds: float)

Trim the line at the end

Parameters:

  • ds (float) –

    The length by which to trim the line. Negative value extends the line.

TrimStart

TrimStart(ds: float)

Trim the line at the start

Parameters:

  • ds (float) –

    The length by which the line will be trimmed. Negative value extends the line.

__eq__

__eq__(line: Line3D) -> bool

Check, whether two lines are equal.

IMPORTANT: This method works withour tolerance. Use Comparison.Equal to compare with tolerance and avoid floating point errors.

Parameters:

  • line (Line3D) –

    line to be compared.

Returns:

  • bool

    True when lines are equal, otherwise false.

__init__ overloaded

__init__()

Initialize

__init__(line2D: Line2D)

Copy constructor.

Copy Line2D to Line3D at z=0.0

Parameters:

  • line2D (Line2D) –

    Line2D which will be copied.

__init__(line: Line3D)

Copy constructor.

Copy Line3D

Parameters:

  • line (Line3D) –

    Line3D which will be copied.

__init__(point1: Point3D, point2: Point3D)

Constructor.

Constructs a Line3D from point1 to point2 in world coordinates.

Parameters:

  • point1 (Point3D) –

    start point of line.

  • point2 (Point3D) –

    end point of line.

__init__(startPoint: Point3D, vec: Vector3D)

Constructor.

Constructs a Line3D from point1 to point1+vec in world coordinates.

Parameters:

  • startPoint (Point3D) –

    start point of line.

  • vec (Vector3D) –

    translation vector.

__init__(x1: float, y1: float, z1: float, x2: float, y2: float, z2: float)

Constructor.

Constructs a Line3D from 6 doubles in world coordinates.

Parameters:

  • x1 (float) –

    X coordinate of start point.

  • y1 (float) –

    Y coordinate of start point.

  • z1 (float) –

    Z coordinate of start point.

  • x2 (float) –

    X coordinate of end point.

  • y2 (float) –

    Y coordinate of end point.

  • z2 (float) –

    Z coordinate of end point.

__init__(refPoint: Point3D, startPoint: Point3D, endPoint: Point3D)

Constructor.

Constructs a Line3D in local coordinate system.

Parameters:

  • refPoint (Point3D) –

    Reference point.

  • startPoint (Point3D) –

    relative start point.

  • endPoint (Point3D) –

    relative end point.

__mul__ overloaded

__mul__(matrix: Matrix2D) -> Line3D

2D matrix transformation.

Multiplies line start and end point with matrix.

Parameters:

  • matrix (Matrix2D) –

    2D transformation Matrix

Returns:

__mul__(matrix: Matrix3D) -> Line3D

3D matrix transformation.

Multiplies line start and end point with matrix.

Parameters:

  • matrix (Matrix3D) –

    3D transformation Matrix

Returns:

__repr__

__repr__() -> str

Convert to string

Placeholder