Pular para o conteúdo principal

raygeo.ops.feature.narrow

Functions

analyze_pocket()

analyze_pocket(
polygon: Sequence[tuple[float, float]],
holes: Sequence[Sequence[tuple[float, float]]] | None = None,
tool_radius: float = 3,
tolerance: float = 0.5,
min_slot_width: float | None = None,
) -> list[tuple[list[tuple[float, float]], str, float, list[int]]]

Analyze a pocket and return classified narrow regions.

Calls find_narrow_passages with max_width = 1.5 × 2 × tool_radius, then classifies each passage as Narrow (toroidal), Slot, or Unreachable based on the minimum passage width. Each entry in the returned list is a tuple of (polygon, class, min_width, entry_edge_indices).

  • polygon — list of (x, y) vertices of the narrow passage.
  • class"narrow", "slot", or "unreachable".
  • min_width — estimated minimum passage width in mm.
  • entry_edge_indices — list of vertex indices of entry-side edges.

Raises: RuntimeError — If the polygon cannot be analyzed.

ParameterTypeDescription
polygonSequence[tuple[float, float]]Outer boundary polygon.
holesSequence[Sequence[tuple[float, float]]] | None = NoneList of hole (island) polygons.
tool_radiusfloat = 3Tool radius in mm.
tolerancefloat = 0.5Additional clearance tolerance in mm.
min_slot_widthfloat | None = NoneMinimum passage width for slotting in mm. Defaults to 2 × tool_radius (tool diameter) when None.
Returnslist[tuple[list[tuple[float, float]], str, float, list[int]]]List of (polygon, class, min_width, entry_edge_indices) tuples.

A pocket with staircase island produces passages of three widths, showing all classification levels

A pocket with staircase island produces passages of three widths, showing all classification levels