[Pather] fix trace_into() for straight connections

This commit is contained in:
Jan Petykiewicz 2026-04-02 09:55:27 -07:00
commit bbe3586ba9
2 changed files with 11 additions and 1 deletions

View file

@ -535,7 +535,7 @@ class Pather(PortList):
if isinstance(portspec, str):
portspec = [portspec]
pos_keys = {'p', 'x', 'y', 'pos', 'position'}
pb = {k: bounds[k] for k in bounds if k in pos_keys}
pb = {k: bounds[k] for k in bounds if k in pos_keys and bounds[k] is not None}
if pb:
if len(portspec) > 1:
raise BuildError('Position bounds only allowed with a single port')

View file

@ -279,6 +279,16 @@ def test_pather_trace_into() -> None:
assert p.pattern.ports['G'].rotation is not None
assert numpy.isclose(p.pattern.ports['G'].rotation, pi)
# 5. Vertical straight connector
p.pattern.ports['I'] = Port((0, 0), rotation=pi / 2)
p.pattern.ports['J'] = Port((0, -10000), rotation=3 * pi / 2)
p.at('I').trace_into('J', plug_destination=False)
assert 'J' in p.pattern.ports
assert 'I' in p.pattern.ports
assert numpy.allclose(p.pattern.ports['I'].offset, (0, -10000))
assert p.pattern.ports['I'].rotation is not None
assert numpy.isclose(p.pattern.ports['I'].rotation, pi / 2)
def test_pather_jog_failed_fallback_is_atomic() -> None:
lib = Library()