[Pather] make two-L path planning atomic (don't error out with only one half drawn)

This commit is contained in:
Jan Petykiewicz 2026-03-31 09:28:48 -07:00
commit e7f847d4c7
2 changed files with 45 additions and 4 deletions

View file

@ -415,8 +415,17 @@ class Pather(PortList):
self._apply_dead_fallback(portspec, length, jog, None, in_ptype, plug_into, out_rot=pi)
return self
self._traceL(portspec, ccw0, L1, **(kwargs | {'out_ptype': None}))
self._traceL(portspec, not ccw0, L2, **(kwargs | {'plug_into': plug_into}))
try:
out_port0, data0 = tool.planL(ccw0, L1, in_ptype=in_ptype, **(kwargs | {'out_ptype': None}))
out_port1, data1 = tool.planL(not ccw0, L2, in_ptype=out_port0.ptype, **kwargs)
except (BuildError, NotImplementedError):
if not self._dead:
raise
self._apply_dead_fallback(portspec, length, jog, None, in_ptype, plug_into, out_rot=pi)
return self
self._apply_step('L', portspec, out_port0, data0, tool)
self._apply_step('L', portspec, out_port1, data1, tool, plug_into)
return self
if out_port is not None:
self._apply_step('S', portspec, out_port, data, tool, plug_into)
@ -436,14 +445,16 @@ class Pather(PortList):
try:
R = self._get_tool_R(tool, ccw, in_ptype, **kwargs)
L1, L2 = length + R, abs(jog) - R
self._traceL(portspec, ccw, L1, **(kwargs | {'out_ptype': None}))
self._traceL(portspec, ccw, L2, **(kwargs | {'plug_into': plug_into}))
out_port0, data0 = tool.planL(ccw, L1, in_ptype=in_ptype, **(kwargs | {'out_ptype': None}))
out_port1, data1 = tool.planL(ccw, L2, in_ptype=out_port0.ptype, **kwargs)
except (BuildError, NotImplementedError):
if not self._dead:
raise
self._apply_dead_fallback(portspec, length, jog, None, in_ptype, plug_into, out_rot=0)
return self
else:
self._apply_step('L', portspec, out_port0, data0, tool)
self._apply_step('L', portspec, out_port1, data1, tool, plug_into)
return self
if out_port is not None:
self._apply_step('U', portspec, out_port, data, tool, plug_into)