geom2d.fillet

Connect Line/Arc segments with a fillet arc.

geom2d.fillet.connect_fillet(seg1: Line | Arc, farc: Arc, seg2: Line | Arc) tuple[Line | Arc, Arc, Line | Arc] | None

Connect a fillet arc between two segments.

Parameters:
  • seg1 – First segment, an Arc or a Line.

  • farc – The fillet arc.

  • seg2 – Second segment, an Arc or a Line.

Returns:

(seg1, fillet_arc, seg2)

Return type:

A tuple containing the adjusted segments and fillet arc

geom2d.fillet.create_fillet_arc(seg1: Line | Arc, seg2: Line | Arc, radius: float, adjust_radius: bool = False) Arc | None

Create a fillet arc between two Line/Arc segments.

Parameters:
  • seg1 – A Line or Arc.

  • seg2 – A Line or Arc connected to seg1.

  • radius – The radius of the fillet.

  • adjust_radius – Shrink radius to fit segments if they are too short to accommodate the specified radius. This only works on line->line fillets.

Returns:

An Arc, or None if the fillet radius is too big to fit or if the two segments are already tangentially (G1) connected.

geom2d.fillet.fillet_path(path: Iterable[Line | Arc | CubicBezier], radius: float, fillet_close: bool = True, adjust_radius: bool = False) Sequence[Line | Arc]

Fillet a path of connected Line and Arc segments.

Attempt to insert a circular arc of the specified radius to connect adjacent path segments.

Parameters:
  • path – An iterable of connected Line or Arc segments.

  • radius – The radius of the fillet arc.

  • fillet_close – If True and the path is closed then add a terminating fillet.

  • adjust_radius – Shrink radius to fit segments if they are too short to accommodate the specified radius. This only works on line->line fillets.

Returns:

A new path with fillet arcs. If no fillets are created then the original path will be returned.

geom2d.fillet.fillet_polygon(poly: Iterable[TPoint], radius: float, fillet_close: bool = True, adjust_radius: bool = False) Sequence[Line | Arc]

Fillet polygon edges.

Attempt to insert a circular arc of the specified radius connecting adjacent polygon segments.

Parameters:
  • poly – A list of polygon vertices.

  • radius – The radius of the fillet arc.

  • fillet_close – If True and the path is closed then add a terminating fillet. Default is True.

  • adjust_radius – Shrink radius to fit segments if they are too short to accommodate the specified radius. This only works on line->line fillets.

Returns:

A new path with fillet arcs as a list of Line and Arc segments. If no fillets are created then the original path will be returned.

geom2d.fillet.fillet_segments(seg1: Line | Arc, seg2: Line | Arc, radius: float, adjust_radius: bool = False) tuple[Line | Arc, Arc, Line | Arc] | None

Try to create a fillet between two segments.

Parameters:
  • seg1 – First segment, an Arc or a Line.

  • seg2 – Second segment, an Arc or a Line.

  • radius – Fillet radius.

  • adjust_radius – Shrink radius to fit segments if they are too short to accommodate the specified radius.

Returns:

(seg1, fillet_arc, seg2) Returns None if the segments cannot be connected with a fillet arc (either they are too small or somehow degenerate.)

Return type:

A tuple containing the adjusted segments and fillet arc