Skip to content

Polyline2DUtil

Canonical path: NemAll_Python_Geometry.Polyline2DUtil

Implemtation of the utilities for Polyline2D

Methods:

AlignSegmentsToBaseSegment staticmethod

AlignSegmentsToBaseSegment(
    dimensionLine: Polyline2D, indexBaseSegment: int = 1
) -> bool

Align the points of the dimension line

Parameters:

  • dimensionLine (Polyline2D) –

    Dimension line

  • indexBaseSegment (int, default: 1 ) –

    Index of the base segment (default = 1)

Returns:

  • bool

    true, if all points are aligned

AppendToPolyline2D overloaded

AppendToPolyline2D(
    polyline: Polyline2D, append: Line2D
) -> tuple[bool, Polyline2D, bool, bool]

Appends a line to a polyline the way that the line is always appended at the end

Parameters:

  • polyline (Polyline2D) –

    Polyline to be appended to

  • append (Line2D) –

    Line to be appended

Returns:

  • tuple[bool, Polyline2D, bool, bool]

    tuple(True if successful, false if line is not valid or is not connected to polyline, Resulting polyline, Returns if function has to swap the polyline point order, Returns is function has to swap the appended line/polyline point order)

AppendToPolyline2D(
    polyline: Polyline2D, append: Polyline2D
) -> tuple[bool, Polyline2D, bool, bool]

Appends a line to a polyline the way that the line is always appended at the end

Parameters:

  • polyline (Polyline2D) –

    Polyline to be appended to

  • append (Polyline2D) –

    Polyline to be appended

Returns:

  • tuple[bool, Polyline2D, bool, bool]

    tuple(True if successful, false if line is not valid or is not connected to polyline, Resulting polyline, Returns if function has to swap the polyline point order, Returns is function has to swap the appended line/polyline point order)

CreatePolyline2D staticmethod

CreatePolyline2D(
    startPnt: Point2D,
    endPnt: Point2D,
    corners: int,
    diameter: float,
    systemAngle: float,
    bCenterPnt: bool,
    bClockwise: bool,
) -> tuple[Polyline2D, Point2D]

Create a Polyline2D

Parameters:

  • startPnt (Point2D) –

    Start point

  • endPnt (Point2D) –

    End point

  • corners (int) –

    Count of the corners

  • diameter (float) –

    Contains the diameter of the rectangle

  • systemAngle (float) –

    Angle of the window where the rectangle will be drawn

  • bCenterPnt (bool) –

    point is center point: true/false

  • bClockwise (bool) –

    Determines the direction of rotation

Returns:

GetOutlinePolylineSideFromPoint staticmethod

GetOutlinePolylineSideFromPoint(
    polygon: Polygon2D,
    fromPoint: Point2D,
    directionPoint: Point2D,
    axis_object: object,
) -> tuple[int, Polyline2D]

Get the outline polygon side by a point

Parameters:

  • polygon (Polygon2D) –

    Polygon

  • fromPoint (Point2D) –

    From point

  • directionPoint (Point2D) –

    Direction point

  • axis_object (object) –

    Axis

Returns:

GetPolyline2DSegment staticmethod

GetPolyline2DSegment(
    polyline: Polyline2D, clickPoint: Point2D
) -> tuple[int, Line2D]

Get the closest segment for the given click point

Parameters:

  • polyline (Polyline2D) –

    Polyline to analyze

  • clickPoint (Point2D) –

    Click point to analyze

Returns:

  • tuple[int, Line2D]

    tuple(Index of the end point of the clicked line, Segment of the polyline, where the click point is on)

RemoveNonCorners staticmethod

RemoveNonCorners(outline: Polyline2D)

Normalize the polygon by removing points, which are no corners

Parameters:

  • outline (Polyline2D) –

    Closed polygon outline of a wall