path() should return a tree
This commit is contained in:
parent
5001664547
commit
80e0c5daa8
@ -324,10 +324,10 @@ class Pather(Builder):
|
|||||||
|
|
||||||
tool = self.tools.get(portspec, self.tools[None])
|
tool = self.tools.get(portspec, self.tools[None])
|
||||||
in_ptype = self.pattern[portspec].ptype
|
in_ptype = self.pattern[portspec].ptype
|
||||||
pat = tool.path(ccw, length, in_ptype=in_ptype, port_names=tool_port_names, **kwargs)
|
tree = tool.path(ccw, length, in_ptype=in_ptype, port_names=tool_port_names, **kwargs)
|
||||||
name = self.library.get_name(base_name)
|
name = self.library.get_name(base_name)
|
||||||
self.library[name] = pat
|
abstract = self.library << tree.rename_top(name)
|
||||||
return self.plug(Abstract(name, pat.ports), {portspec: tool_port_names[0]})
|
return self.plug(abstract, {portspec: tool_port_names[0]})
|
||||||
|
|
||||||
def path_to(
|
def path_to(
|
||||||
self,
|
self,
|
||||||
|
@ -65,7 +65,7 @@ class Tool:
|
|||||||
out_ptype: str | None = None,
|
out_ptype: str | None = None,
|
||||||
port_names: tuple[str, str] = ('A', 'B'),
|
port_names: tuple[str, str] = ('A', 'B'),
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> Pattern:
|
) -> Library:
|
||||||
"""
|
"""
|
||||||
Create a wire or waveguide that travels exactly `length` distance along the axis
|
Create a wire or waveguide that travels exactly `length` distance along the axis
|
||||||
of its input port.
|
of its input port.
|
||||||
@ -246,7 +246,7 @@ class BasicTool(Tool, metaclass=ABCMeta):
|
|||||||
out_ptype: str | None = None,
|
out_ptype: str | None = None,
|
||||||
port_names: tuple[str, str] = ('A', 'B'),
|
port_names: tuple[str, str] = ('A', 'B'),
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> Pattern:
|
) -> Library:
|
||||||
_out_port, data = self.planL(
|
_out_port, data = self.planL(
|
||||||
ccw,
|
ccw,
|
||||||
length,
|
length,
|
||||||
@ -270,7 +270,7 @@ class BasicTool(Tool, metaclass=ABCMeta):
|
|||||||
opat, oport_theirs, oport_ours = data.out_transition
|
opat, oport_theirs, oport_ours = data.out_transition
|
||||||
bb.plug(opat, {port_names[1]: oport_ours})
|
bb.plug(opat, {port_names[1]: oport_ours})
|
||||||
|
|
||||||
return bb.pattern
|
return tree
|
||||||
|
|
||||||
def planL(
|
def planL(
|
||||||
self,
|
self,
|
||||||
@ -422,7 +422,7 @@ class PathTool(Tool, metaclass=ABCMeta):
|
|||||||
out_ptype: str | None = None,
|
out_ptype: str | None = None,
|
||||||
port_names: tuple[str, str] = ('A', 'B'),
|
port_names: tuple[str, str] = ('A', 'B'),
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> Pattern:
|
) -> Library:
|
||||||
out_port, dxy = self.planL(
|
out_port, dxy = self.planL(
|
||||||
ccw,
|
ccw,
|
||||||
length,
|
length,
|
||||||
@ -430,7 +430,7 @@ class PathTool(Tool, metaclass=ABCMeta):
|
|||||||
out_ptype=out_ptype,
|
out_ptype=out_ptype,
|
||||||
)
|
)
|
||||||
|
|
||||||
pat = Pattern()
|
tree, pat = Library.mktree('_path')
|
||||||
pat.path(layer=self.layer, width=self.width, vertices=[(0, 0), (length, 0)])
|
pat.path(layer=self.layer, width=self.width, vertices=[(0, 0), (length, 0)])
|
||||||
|
|
||||||
if ccw is None:
|
if ccw is None:
|
||||||
@ -445,7 +445,7 @@ class PathTool(Tool, metaclass=ABCMeta):
|
|||||||
port_names[1]: Port(dxy, rotation=out_rot, ptype=self.ptype),
|
port_names[1]: Port(dxy, rotation=out_rot, ptype=self.ptype),
|
||||||
}
|
}
|
||||||
|
|
||||||
return pat
|
return tree
|
||||||
|
|
||||||
def planL(
|
def planL(
|
||||||
self,
|
self,
|
||||||
|
Loading…
Reference in New Issue
Block a user