Skip to content

FilletCalculus2D

Canonical path: NemAll_Python_Geometry.FilletCalculus2D

Class for fillet calculation

Examples:

Calculate all possible fillets like:

>>> fillet = FilletCalculus2D(line_1, line_2, 1.0)
>>> for arc in fillet.GetFillets():
...     arc.Center, arc.StartAngle.Deg, arc.EndAngle.Deg
(Point2D(4, 0), 90.0, 180.0)
(Point2D(4, 0), 180.0, 450.0)
(Point2D(4, 2), 270.0, 540.0)
(Point2D(4, 2), 180.0, 270.0)
(Point2D(2, 0), 90.0, 360.0)
(Point2D(2, 0), 0.0, 90.0)
(Point2D(2, 2), 270.0, 360.0)
(Point2D(2, 2), 0.0, 270.0)

Calculate a fillet nearest to a specific point like:

>>> fillet = FilletCalculus2D(line_1, line_2, 1.0)
>>> fillet.GetNearest(Point2D(0, 1))
Arc2D(
   CenterPoint(2, 2)
   MinorRadius(1)
   MajorRadius(1)
   AxisAngle(0)
   StartAngle(0)
   EndAngle(4.712...)
   IsCounterClockwise(1))

ClickedOnObject overloaded staticmethod

ClickedOnObject(
    line: Line2D, clickedPoint: Point2D, searchRadius: float
) -> bool

Check if click point is a point located on given line

Parameters:

  • line (Line2D) –

    Line2D which will be checked

  • clickedPoint (Point2D) –

    clicked point

  • searchRadius (float) –

    search radius

Returns:

  • bool

    true if point is on the line

ClickedOnObject(arc: Arc2D, clickedPoint: Point2D, searchRadius: float) -> bool

Check if click point is a point located on given arc

Parameters:

  • arc (Arc2D) –

    Arc2D which will be checked

  • clickedPoint (Point2D) –

    clicked point

  • searchRadius (float) –

    search radius

Returns:

  • bool

    true if point is on the arc

GetArcHelpConstructions

GetArcHelpConstructions() -> Arc2DList

Get all arc help constructions

Returns:

GetFilletType overloaded staticmethod

GetFilletType(line1: Line2D, line2: Line2D) -> eFilletType

Get fillet type for two lines

Parameters:

  • line1 (Line2D) –

    first line

  • line2 (Line2D) –

    second line

Returns:

GetFilletType(line: Line2D, arc: Arc2D) -> eFilletType

Get fillet type for line and arc

Parameters:

Returns:

GetFilletType(arc1: Arc2D, arc2: Arc2D) -> eFilletType

Get fillet type for two arcs

Parameters:

  • arc1 (Arc2D) –

    first arc

  • arc2 (Arc2D) –

    second arc

Returns:

GetFilletType(geometry1: object, geometry2: object) -> eFilletType

Get fillet type for two geometry objects

Parameters:

  • geometry1 (object) –

    first geometry element

  • geometry2 (object) –

    second geometry element

Returns:

GetFillets

GetFillets() -> Arc2DList

Get all possible fillets

Returns:

Examples:

line_1 and line_3 have a common end point at (2, 1):

>>> line_1, line_3
(Line2D(0, 1, 2, 1), Line2D(2, 5, 2, 1))

In this case, one fillet is returned:

>>> FilletCalculus2D.GetFilletType(line_1, line_3)
NemAll_Python_Geometry.eFilletType.FT_LL_INTERSECTION_AT_THE_END
>>> fillet = FilletCalculus2D(line_1, line_3, 1.0)
>>> arc = fillet.GetFillets()[0]
>>> arc.Center, arc.StartAngle.Deg, arc.EndAngle.Deg
(Point2D(1, 2), 270.0, 360.0)

line_1 and line_2 don't have a common end point, but their extension intersects at (2, 1):

>>> line_1, line_2
(Line2D(0, 1, 2, 1), Line2D(3, 5, 3, 0))

In this case, 8 fillets are returned:

>>> FilletCalculus2D.GetFilletType(line_1, line_2)
NemAll_Python_Geometry.eFilletType.FT_LL_INTERSECTION_ON_LINE
>>> fillet = FilletCalculus2D(line_1, line_2, 1.0)
>>> for arc in fillet.GetFillets():
...     arc.Center, arc.StartAngle.Deg, arc.EndAngle.Deg
(Point2D(4, 0), 90.0, 180.0)
(Point2D(4, 0), 180.0, 450.0)
(Point2D(4, 2), 270.0, 540.0)
(Point2D(4, 2), 180.0, 270.0)
(Point2D(2, 0), 90.0, 360.0)
(Point2D(2, 0), 0.0, 90.0)
(Point2D(2, 2), 270.0, 360.0)
(Point2D(2, 2), 0.0, 270.0)

For an arc and line (non-tangent), multiple fillets are returned:

>>> FilletCalculus2D.GetFilletType(arc_1, line_1)
NemAll_Python_Geometry.eFilletType.FT_LC_TWO_INTERSECTION
>>> fillet = FilletCalculus2D(line_1, arc_1, 1.0)
>>> for arc in fillet.GetFillets():
...     arc.Center, round(arc.StartAngle.Deg), round(arc.EndAngle.Deg)
(Point2D(0, 2), 270, 270)
(Point2D(2, 0), 90, 180)
(Point2D(2, 0), 180, 450)
(Point2D(-2, 0), 90, 360)
(Point2D(-2, 0), 0, 90)

GetLineHelpConstructions

GetLineHelpConstructions() -> object

Get all line help constructions

Returns:

  • object

    all line help constructions

GetNearest

GetNearest(point: Point2D) -> Arc2D

Get the nearest fillet to the point

Parameters:

Returns:

  • Arc2D

    nearest arc to the point

SplitPolylineBySegment staticmethod

SplitPolylineBySegment(
    polyline: Polyline2D, segment: int
) -> tuple[Polyline2D, Polyline2D]

Split polyline by given segment

Parameters:

  • polyline (Polyline2D) –

    polyline which will be split by given segment

  • segment (int) –

    segment where polyline will be split

Returns:

TrimByHelpConstruction overloaded staticmethod

TrimByHelpConstruction(
    line: Line2D, hcLine: Line2D, intersections: Point3DList
) -> Line2D

Trim line by given help construction

Parameters:

  • line (Line2D) –

    which will be trimmed

  • hcLine (Line2D) –

    line help construction

  • intersections (Point3DList) –

    intersection points

Returns:

  • Line2D

    which will be trimmed

TrimByHelpConstruction(
    polyline: Polyline2D,
    segment: Line2D,
    hcLine: Line2D,
    intersections: Point3DList,
) -> Polyline2D

Trim polyline by given help construction

Parameters:

  • polyline (Polyline2D) –

    which will be trimmed

  • segment (Line2D) –

    selected segment

  • hcLine (Line2D) –

    line help construction

  • intersections (Point3DList) –

    intersection points

Returns:

TrimByHelpConstruction(
    arc: Arc2D, hcArc: Arc2D, intersections: Point3DList
) -> Arc2D

Trim arc by given help construction

Parameters:

  • arc (Arc2D) –

    which will be trimmed

  • hcArc (Arc2D) –

    arc help construction

  • intersections (Point3DList) –

    intersection points

Returns:

  • Arc2D

    which will be trimmed

UpdateGeometry overloaded staticmethod

UpdateGeometry(
    geoPolyline: Polyline2D, fillet: Arc2D, selectedGeometry: object
) -> Polyline2D

Update polyline geometry

Parameters:

  • geoPolyline (Polyline2D) –

    polyline which will be updated

  • fillet (Arc2D) –

    Arc2D

  • selectedGeometry (object) –

    selected geometry

Returns:

UpdateGeometry(
    geoPolyline: Polyline2D,
    fillet: Arc2D,
    selectedGeometry1: object,
    selectedGeometry2: object,
) -> Polyline2DList

Update polyline geometry

Parameters:

  • geoPolyline (Polyline2D) –

    polyline which will be updated

  • fillet (Arc2D) –

    Arc2D

  • selectedGeometry1 (object) –

    First selected segment

  • selectedGeometry2 (object) –

    Second selected segment

Returns:

UpdateGeometry(geoArc: Arc2D, fillet: Arc2D, selectedGeometry: object) -> Arc2D

Update arc geometry

Parameters:

  • geoArc (Arc2D) –

    arc which will be updated

  • fillet (Arc2D) –

    Arc2D

  • selectedGeometry (object) –

    selected geometry

Returns:

  • Arc2D

    arc which will be updated

UpdateGeometry(
    geoLine: Line2D, fillet: Arc2D, selectedGeometry: object
) -> Line2D

Update lien geometry

Parameters:

  • geoLine (Line2D) –

    line which will be updated

  • fillet (Arc2D) –

    Arc2D

  • selectedGeometry (object) –

    selected geometry

Returns:

  • Line2D

    line which will be updated

UpdateGeometry(
    geoPolygon: Polygon2D,
    fillet: Arc2D,
    segment1: Line2D,
    segment2: Line2D,
    segmentCount: int = 36,
) -> Polygon2D

Update polygon geometry

Parameters:

  • geoPolygon (Polygon2D) –

    polygon which will be updated

  • fillet (Arc2D) –

    Arc2D

  • segment1 (Line2D) –

    first selected geometry

  • segment2 (Line2D) –

    second selected geometry

  • segmentCount (int, default: 36 ) –

    required count of segments of the polygonized fillet

Returns:

  • Polygon2D

    polygon which will be updated

UpdateGeometry(geoSpline: Spline2D, fillet: Arc2D) -> Spline2D

Update spline geometry

Parameters:

  • geoSpline (Spline2D) –

    spline which will be updated

  • fillet (Arc2D) –

    Arc2D

Returns:

  • Spline2D

    spline which will be updated

UpdateGeometry(
    geoPolyline: Polyline2D,
    fillet: Arc2D,
    selectedGeometry1: object,
    selectedGeometry2: object,
    segmentCount: int = 36,
) -> Polyline2D

Update polyline geometry

Parameters:

  • geoPolyline (Polyline2D) –

    polyline which will be updated

  • fillet (Arc2D) –

    Arc2D

  • selectedGeometry1 (object) –

    the first selected geometry

  • selectedGeometry2 (object) –

    the second selected geometry

  • segmentCount (int, default: 36 ) –

    required count of segments of the polygonized fillet

Returns:

__init__ overloaded

__init__()

Initialize

__init__(geoObj1: object, geoObj2: object, r: float)

constructor

Parameters:

  • geoObj1 (object) –

    IGeometry object

  • geoObj2 (object) –

    IGeometry object

  • r (float) –

    radius

__init__(line1: Line2D, line2: Line2D, r: float)

constructor

Parameters:

  • line1 (Line2D) –

    Line2D

  • line2 (Line2D) –

    Line2D

  • r (float) –

    radius

__init__(line: Line2D, arc: Arc2D, r: float)

constructor

Parameters:

  • line (Line2D) –

    Line2D

  • arc (Arc2D) –

    Arc2D

  • r (float) –

    radius

__init__(arc1: Arc2D, arc2: Arc2D, r: float)

constructor

Parameters:

  • arc1 (Arc2D) –

    Arc2D

  • arc2 (Arc2D) –

    Arc2D

  • r (float) –

    radius

__init__(arc: Arc2D, point: Point2D)

constructor

Parameters:

__init__(line: Line2D, point: Point2D)

constructor

Parameters:

__init__(element: FilletCalculus2D)

Copy constructor

Parameters:

Placeholder