Skip to main content

raygeo.ops.assembly.adaptive

ResumePointNotFoundError

Raised when all resume strategies fail to find an engagement point.

RoutingError

Raised when all route strategies fail to find a path.

Functions

adaptive_clearing()

adaptive_clearing(
part: ops.part.Part,
tool_radius: float = 3,
step_over: float = 1.5,
step_length: float = 0.6,
target_z: float = -5,
safe_z: float = 2,
max_deflection_deg: float = 30,
wall_margin: float = 0,
area_tolerance: float = 1,
cut_feed_rate: int = 1200,
cut_power: float = 1,
start_pos: tuple[float, float] | None = None,
start_heading: float | None = None,
expansion_batch_size: int = 20,
profile: bool = False,
cut_direction: str = 'ccw',
trace_path: str | None = None,
on_progress: Callable[[dict], None] | None = None,
batch_size: int = 128,
) -> ops.assembly.AssemblyResult

Run forward-stepping adaptive clearing.

Starting from the pre-populated cleared area inside part, uses a constant-engagement stepping solver to generate a continuous spiral toolpath from the seed clearing to the pocket wall.

The caller is responsible for populating the part's cleared area with the entry polygons (e.g. via a workplan built by raygeo.cnc.machining.entry.build_entry_workplan and executed by raygeo.cnc.machining.plan.Workplan) and prepending the entry Ops to the result.

ParameterTypeDescription
partops.part.PartThe part whose cleared field tracks accumulated workpiece state and whose geometry defines the pocket boundary and islands.
tool_radiusfloat = 3Tool radius in mm (default 3.0).
step_overfloat = 1.5Step-over distance (default 1.5).
step_lengthfloat = 0.6Forward step length in mm (default 0.6).
target_zfloat = -5Cutting Z height (default -5.0).
safe_zfloat = 2Retract Z height for travel (default 2.0).
max_deflection_degfloat = 30Maximum steering deflection per step in degrees (default 30).
wall_marginfloat = 0Extra clearance between tool and boundary (default 0.0).
area_tolerancefloat = 1Stop when remaining uncut area drops below this threshold (default 1.0).
cut_feed_rateint = 1200Feed rate for cutting moves (default 1200).
cut_powerfloat = 1Laser power for cutting moves (0.0-1.0, default 1.0).
start_postuple[float, float] | None = NoneInitial tool position (x, y). When None, auto-detected from the cleared-area frontier.
start_headingfloat | None = NoneInitial tool heading in radians. When None, auto-detected as the CCW tangent at start_pos.
expansion_batch_sizeint = 20Batch cleared-area expansions every N steps (default 20). Larger values improve performance but may slightly reduce path quality.
profilebool = FalsePrint a profiling report to stdout (default False).
cut_directionstr = 'ccw'Rotational direction of all cutting moves. "cw" or "ccw" (default "ccw").
trace_pathstr | None = NoneWhen set, write a per-step binary trace file for the Python inspector (debug builds only).
on_progressCallable[[dict], None] | None = NoneOptional callback receiving progress dicts.
batch_sizeint = 128Ops batch size for on_progress (default 128).
Returnsops.assembly.AssemblyResultOps with cutting commands (entry not included).

Circle-seed clearing in a square pocket with central island: seed, toolpath, and remaining.

Circle-seed clearing in a square pocket with central island: seed, toolpath, and remaining.

Narrow pocket — 3D toolpath view (left) and 2D top-down with seed/remaining overlay (right).

Narrow pocket — 3D toolpath view (left) and 2D top-down with seed/remaining overlay (right).

Constant-engagement clearing cuts, MAT-routed travel links, coloured by progress.

Constant-engagement clearing cuts, MAT-routed travel links, coloured by progress.

target_area_per_distance()

target_area_per_distance(
radius: float,
advance: float,
step_length: float,
) -> float

Target cut-area per unit distance for the engagement solver.

ParameterTypeDescription
radiusfloatTool radius in mm.
advancefloatStep-over distance in mm.
step_lengthfloatForward step length in mm.
ReturnsfloatTarget area per distance (mm).

Left: area/distance vs advance for several step lengths. Right: vs step length for several advances.

Left: area/distance vs advance for several step lengths. Right: vs step length for several advances.

Two offset disks and a wall at x=R−advance: crescent beyond wall is fresh material.

Two offset disks and a wall at x=R−advance: crescent beyond wall is fresh material.