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
GetArcHelpConstructions
GetArcHelpConstructions() -> Arc2DList
GetFilletType
overloaded
staticmethod
GetFilletType(line1: Line2D, line2: Line2D) -> eFilletType
GetFilletType(line: Line2D, arc: Arc2D) -> eFilletType
GetFilletType(arc1: Arc2D, arc2: Arc2D) -> eFilletType
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:
-
eFilletType
–eFilletType
GetFillets
GetFillets() -> Arc2DList
Get all possible fillets
Returns:
-
Arc2DList
–possible fillets
Examples:
line_1
and line_3
have a common end point at (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):
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
Get all line help constructions
Returns:
-
object
–all line help constructions
GetNearest
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:
-
tuple[Polyline2D, Polyline2D]
–tuple(firs part of polyline, second part of polyline)
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:
-
Polyline2D
–which will be trimmed
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:
-
Polyline2D
–polyline which will be updated
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:
-
Polyline2DList
–Result polylines
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(
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:
-
Polyline2D
–polyline which will be updated
__init__
overloaded
Initialize
constructor
Parameters:
-
geoObj1
(object
) –IGeometry object
-
geoObj2
(object
) –IGeometry object
-
r
(float
) –radius
__init__(element: FilletCalculus2D)