From f374651bc49d86e8f09083685ed93fba400aab35 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 12 Nov 2025 17:42:16 -0800 Subject: [PATCH] fixup! fixup! [Pather / RenderPather] move common functionality into PatherMixin; redo hierarchy --- masque/builder/tools.py | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/masque/builder/tools.py b/masque/builder/tools.py index 5458f1b..ac505ff 100644 --- a/masque/builder/tools.py +++ b/masque/builder/tools.py @@ -401,15 +401,15 @@ class BasicTool(Tool, metaclass=ABCMeta): gen_straight, sport_in, _sport_out = self.straight for step in batch: - straight_length, ccw, in_transition, out_transition = step.data + data = step.data assert step.tool == self if step.opcode == 'L': - if in_transition: - ipat, iport_theirs, _iport_ours = in_transition + if data.in_transition: + ipat, iport_theirs, _iport_ours = data.in_transition pat.plug(ipat, {port_names[1]: iport_theirs}) - if not numpy.isclose(straight_length, 0): - straight_pat_or_tree = gen_straight(straight_length, **kwargs) + if not numpy.isclose(data.straight_length, 0): + straight_pat_or_tree = gen_straight(data.straight_length, **kwargs) pmap = {port_names[1]: sport_in} if isinstance(straight_pat_or_tree, Pattern): straight_pat = straight_pat_or_tree @@ -427,11 +427,11 @@ class BasicTool(Tool, metaclass=ABCMeta): else: straight = tree <= straight_pat_or_tree pat.plug(straight, pmap) - if ccw is not None: + if data.ccw is not None: bend, bport_in, bport_out = self.bend - pat.plug(bend, {port_names[1]: bport_in}, mirrored=bool(ccw)) - if out_transition: - opat, oport_theirs, oport_ours = out_transition + pat.plug(bend, {port_names[1]: bport_in}, mirrored=bool(data.ccw)) + if data.out_transition: + opat, oport_theirs, oport_ours = data.out_transition pat.plug(opat, {port_names[1]: oport_ours}) return tree @@ -578,7 +578,7 @@ class AutoTool(Tool, metaclass=ABCMeta): itrans_dxy = self._itransition2dxy(in_transition) out_transition = self.transitions.get(('unk' if out_ptype is None else out_ptype, stype if ccw is None else btypeo), None) - otrans_dxy = self._otransition2dxy(in_transition, bend_angle) + otrans_dxy = self._otransition2dxy(out_transition, bend_angle) b_transition = None if ccw is not None and btypei != stype: @@ -625,15 +625,16 @@ class AutoTool(Tool, metaclass=ABCMeta): pat.add_port_pair(names=(port_names[0], port_names[1])) for step in batch: - _stype, gen_straight, sport_in, _sport_out = step.data.straight_tuple + data = step.data + _stype, gen_straight, sport_in, _sport_out, _length_bounds = data.straight_tuple assert step.tool == self if step.opcode == 'L': - if step.data.in_transition: - ipat, iport_theirs, _iport_ours = step.data.in_transition + if data.in_transition: + ipat, iport_theirs, _iport_ours = data.in_transition pat.plug(ipat, {port_names[1]: iport_theirs}) - if not numpy.isclose(step.data.straight_length, 0): - straight_pat_or_tree = gen_straight(step.data.straight_length, **kwargs) + if not numpy.isclose(data.straight_length, 0): + straight_pat_or_tree = gen_straight(data.straight_length, **kwargs) pmap = {port_names[1]: sport_in} if isinstance(straight_pat_or_tree, Pattern): straight_pat = straight_pat_or_tree @@ -651,19 +652,18 @@ class AutoTool(Tool, metaclass=ABCMeta): else: straight = tree <= straight_pat_or_tree pat.plug(straight, pmap) - if step.data.b_transition: - btpat, btport_bend, btport_straight = step.data.b_transition + if data.b_transition: + btpat, btport_bend, btport_straight = data.b_transition pat.plug(btpat, {port_names[1]: btport_straight}) - if step.data.ccw is not None: - bend, bport_in, bport_out = step.data.bend_tuple - pat.plug(bend, {port_names[1]: bport_in}, mirrored=bool(step.data.ccw)) - if step.data.out_transition: - opat, oport_theirs, oport_ours = step.data.out_transition + if data.ccw is not None: + bend, bport_in, bport_out = data.bend_tuple + pat.plug(bend, {port_names[1]: bport_in}, mirrored=bool(data.ccw)) + if data.out_transition: + opat, oport_theirs, oport_ours = data.out_transition pat.plug(opat, {port_names[1]: oport_ours}) return tree - @dataclass class PathTool(Tool, metaclass=ABCMeta): """