Перейти до основного вмісту

raygeo.ops.polyline

LinkStrategy

Functions

find_pass_entry()

find_pass_entry(ops: ops.Ops) -> tuple[float, float, float] | None

Find the entry point of an Ops sequence.

Scans for the first travel (MoveTo) endpoint, falling back to the first moving command endpoint.

ParameterTypeDescription
opsops.OpsAn ~raygeo.ops.Ops container.
Returnstuple[float, float, float] | None(x, y, z) or None if no moving commands exist.

Entry and exit points from find_pass_entry / find_pass_exit

Entry and exit points from find_pass_entry / find_pass_exit

find_pass_exit()

find_pass_exit(ops: ops.Ops) -> tuple[float, float, float] | None

Find the exit point of an Ops sequence.

Scans backwards for the last moving command endpoint.

ParameterTypeDescription
opsops.OpsAn ~raygeo.ops.Ops container.
Returnstuple[float, float, float] | None(x, y, z) or None if no moving commands exist.
link_passes(
passes: list[ops.Ops],
safe_z: float,
strategy: str | LinkStrategy,
) -> ops.Ops

Join ordered machining passes into a single Ops sequence.

The first pass is emitted as-is; subsequent passes are prefixed with travel moves according to strategy:

  • "retract" / LinkStrategy.RETRACT — retract to safe_z, move XY at that height, then descend to the next pass start Z.
  • "stay_down" / LinkStrategy.STAY_DOWN — move directly from the previous pass end to the next pass start without retracting.
ParameterTypeDescription
passeslist[ops.Ops]Ordered list of ~raygeo.ops.Ops passes.
safe_zfloatZ height for retract moves (mm).
strategystr | LinkStrategyLinking strategy.
Returnsops.OpsA single **~raygeo.ops.Ops** container.

Three passes linked with StayDown vs Retract strategies

Three passes linked with StayDown vs Retract strategies

polyline_to_ops()

polyline_to_ops(
points: list[tuple[float, float, float]],
move_first: bool = True,
) -> ops.Ops

Convert a 3-D polyline into an Ops command sequence.

When move_first is True the first point is emitted as a MoveTo and subsequent points as LineTo. When move_first is False every point is emitted as a LineTo (useful for appending a polyline to an in-progress cut).

ParameterTypeDescription
pointslist[tuple[float, float, float]]List of (x, y, z) tuples.
move_firstbool = TrueWhether to emit the first point as a MoveTo.
Returnsops.OpsAn **~raygeo.ops.Ops** container.

polyline_to_ops with move_first=True vs move_first=False

polyline_to_ops with move_first=True vs move_first=False