Compare commits

..

No commits in common. "22b53a930ce63efd145b561bb3d781cdd7cd2551" and "519e6ad618859043ec2dcc3c69585e930c8f6557" have entirely different histories.

6 changed files with 16 additions and 19 deletions

View File

@ -352,17 +352,16 @@ class Pather(Builder, PatherMixin):
except NotImplementedError:
# Fall back to drawing two L-bends
ccw0 = jog > 0
kwargs_no_out = kwargs | {'out_ptype': None}
kwargs_no_out = (kwargs | {'out_ptype': None})
t_tree0 = tool.path( ccw0, length / 2, port_names=tool_port_names, in_ptype=in_ptype, **kwargs_no_out)
t_pat0 = t_tree0.top_pattern()
(_, jog0), _ = t_pat0[tool_port_names[0]].measure_travel(t_pat0[tool_port_names[1]])
t_tree1 = tool.path(not ccw0, abs(jog - jog0), port_names=tool_port_names, in_ptype=t_pat0[tool_port_names[1]].ptype, **kwargs)
t_tree1 = tool.path(not ccw0, jog - jog0, port_names=tool_port_names, in_ptype=t_pat0[tool_port_names[1]].ptype, **kwargs)
t_pat1 = t_tree1.top_pattern()
(_, jog1), _ = t_pat1[tool_port_names[0]].measure_travel(t_pat1[tool_port_names[1]])
kwargs_plug = kwargs | {'plug_into': plug_into}
self.path(portspec, ccw0, length - abs(jog1), **kwargs_no_out)
self.path(portspec, not ccw0, abs(jog - jog0), **kwargs_plug)
self.path(portspec, ccw0, length - jog1, **kwargs_no_out)
self.path(portspec, not ccw0, jog - jog0, **kwargs)
return self
tname = self.library << tree

View File

@ -321,7 +321,7 @@ class PatherMixin(PortList, metaclass=ABCMeta):
else:
# S-bend, delegate to implementations
(travel, jog), _ = port_src.measure_travel(port_dst)
self.pathS(portspec_src, -travel, -jog, **dst_args)
self.pathS(portspec_src, -travel, jog, **dst_args)
elif numpy.isclose(angle, 0):
raise BuildError('Don\'t know how to route a U-bend yet (TODO)!')
else:

View File

@ -488,13 +488,12 @@ class RenderPather(PatherMixin):
ccw0 = jog > 0
kwargs_no_out = (kwargs | {'out_ptype': None})
t_port0, _ = tool.planL( ccw0, length / 2, in_ptype=in_ptype, **kwargs_no_out)
jog0 = Port((0, 0), 0).measure_travel(t_port0)[0][1]
t_port1, _ = tool.planL(not ccw0, abs(jog - jog0), in_ptype=t_port0.ptype, **kwargs)
jog1 = Port((0, 0), 0).measure_travel(t_port1)[0][1]
(_, jog0), _ = Port((0, 0), 0).measure_travel(t_port0)
t_port1, _ = tool.planL(not ccw0, jog - jog0, in_ptype=t_port0.ptype, **kwargs)
(_, jog1), _ = Port((0, 0), 0).measure_travel(t_port1)
kwargs_plug = kwargs | {'plug_into': plug_into}
self.path(portspec, ccw0, length - abs(jog1), **kwargs_no_out)
self.path(portspec, not ccw0, abs(jog - jog0), **kwargs_plug)
self.path(portspec, ccw0, length - jog1, **kwargs_no_out)
self.path(portspec, not ccw0, jog - jog0, **kwargs)
return self
out_port.rotate_around((0, 0), pi + port_rot)

View File

@ -768,7 +768,6 @@ class AutoTool(Tool, metaclass=ABCMeta):
l2_err: BuildError | None = err
else:
l2_err = None
raise NotImplementedError('TODO need to handle ldata below')
if not success:
# Failed to break

View File

@ -1169,13 +1169,12 @@ class Pattern(PortList, AnnotatableImpl, Mirrorable):
ports[new_name] = port
for name, port in ports.items():
pp = port.deepcopy()
p = port.deepcopy()
if mirrored:
pp.mirror()
pp.offset[1] *= -1
pp.rotate_around(pivot, rotation)
pp.translate(offset)
self.ports[name] = pp
p.mirror()
p.rotate_around(pivot, rotation)
p.translate(offset)
self.ports[name] = p
if append:
if isinstance(other, Abstract):

View File

@ -100,6 +100,7 @@ class Port(PositionableImpl, Rotatable, PivotableImpl, Copyable, Mirrorable):
return self
def mirror(self, axis: int = 0) -> Self:
self.offset[1 - axis] *= -1
if self.rotation is not None:
self.rotation *= -1
self.rotation += axis * pi