add plug_into arg
This commit is contained in:
parent
24c77fd3c3
commit
383b5a0bef
@ -287,6 +287,7 @@ class Pather(Builder):
|
|||||||
length: float,
|
length: float,
|
||||||
*,
|
*,
|
||||||
tool_port_names: tuple[str, str] = ('A', 'B'),
|
tool_port_names: tuple[str, str] = ('A', 'B'),
|
||||||
|
plug_into: str | None = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> Self:
|
) -> Self:
|
||||||
"""
|
"""
|
||||||
@ -307,6 +308,8 @@ class Pather(Builder):
|
|||||||
tool_port_names: The names of the ports on the generated pattern. It is unlikely
|
tool_port_names: The names of the ports on the generated pattern. It is unlikely
|
||||||
that you will need to change these. The first port is the input (to be
|
that you will need to change these. The first port is the input (to be
|
||||||
connected to `portspec`).
|
connected to `portspec`).
|
||||||
|
plug_into: If not None, attempts to plug the wire's output port into the provided
|
||||||
|
port on `self`.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
self
|
self
|
||||||
@ -323,7 +326,11 @@ class Pather(Builder):
|
|||||||
in_ptype = self.pattern[portspec].ptype
|
in_ptype = self.pattern[portspec].ptype
|
||||||
tree = 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)
|
||||||
abstract = self.library << tree
|
abstract = self.library << tree
|
||||||
return self.plug(abstract, {portspec: tool_port_names[0]})
|
if plug_into is not None:
|
||||||
|
output = {plug_into: tool_port_names[1]}
|
||||||
|
else:
|
||||||
|
output = {}
|
||||||
|
return self.plug(abstract, {portspec: tool_port_names[0], **output})
|
||||||
|
|
||||||
def path_to(
|
def path_to(
|
||||||
self,
|
self,
|
||||||
@ -334,6 +341,7 @@ class Pather(Builder):
|
|||||||
x: float | None = None,
|
x: float | None = None,
|
||||||
y: float | None = None,
|
y: float | None = None,
|
||||||
tool_port_names: tuple[str, str] = ('A', 'B'),
|
tool_port_names: tuple[str, str] = ('A', 'B'),
|
||||||
|
plug_into: str | None = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> Self:
|
) -> Self:
|
||||||
"""
|
"""
|
||||||
@ -362,6 +370,8 @@ class Pather(Builder):
|
|||||||
tool_port_names: The names of the ports on the generated pattern. It is unlikely
|
tool_port_names: The names of the ports on the generated pattern. It is unlikely
|
||||||
that you will need to change these. The first port is the input (to be
|
that you will need to change these. The first port is the input (to be
|
||||||
connected to `portspec`).
|
connected to `portspec`).
|
||||||
|
plug_into: If not None, attempts to plug the wire's output port into the provided
|
||||||
|
port on `self`.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
self
|
self
|
||||||
@ -411,7 +421,15 @@ class Pather(Builder):
|
|||||||
raise BuildError(f'path_to routing to behind source port: y0={y0:g} to {position:g}')
|
raise BuildError(f'path_to routing to behind source port: y0={y0:g} to {position:g}')
|
||||||
length = numpy.abs(position - y0)
|
length = numpy.abs(position - y0)
|
||||||
|
|
||||||
return self.path(portspec, ccw, length, tool_port_names=tool_port_names, **kwargs)
|
return self.path(
|
||||||
|
portspec,
|
||||||
|
ccw,
|
||||||
|
length,
|
||||||
|
tool_port_names=tool_port_names,
|
||||||
|
plug_into=plug_into,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def mpath(
|
def mpath(
|
||||||
self,
|
self,
|
||||||
|
Loading…
Reference in New Issue
Block a user