[docs / examples] Update docs and examples
This commit is contained in:
parent
8100d8095a
commit
fd2698c503
7 changed files with 132 additions and 107 deletions
|
|
@ -27,14 +27,14 @@ def main() -> None:
|
|||
# and remembers the selected port(s). This allows method chaining.
|
||||
|
||||
# Route VCC: 6um South, then West to x=0.
|
||||
# (Note: since the port points North into the pad, path() moves South by default)
|
||||
# (Note: since the port points North into the pad, trace() moves South by default)
|
||||
(rpather.at('VCC')
|
||||
.path(ccw=False, length=6_000) # Move South, turn West (Clockwise)
|
||||
.path_to(ccw=None, x=0) # Continue West to x=0
|
||||
.trace(False, length=6_000) # Move South, turn West (Clockwise)
|
||||
.trace_to(None, x=0) # Continue West to x=0
|
||||
)
|
||||
|
||||
# Route GND: 5um South, then West to match VCC's x-coordinate.
|
||||
rpather.at('GND').path(ccw=False, length=5_000).path_to(ccw=None, x=rpather['VCC'].x)
|
||||
rpather.at('GND').trace(False, length=5_000).trace_to(None, x=rpather['VCC'].x)
|
||||
|
||||
|
||||
#
|
||||
|
|
@ -49,45 +49,45 @@ def main() -> None:
|
|||
.retool(M1_tool) # this only retools the 'GND' port
|
||||
)
|
||||
|
||||
# We can also pass multiple ports to .at(), and then use .mpath() on them.
|
||||
# We can also pass multiple ports to .at(), and then route them together.
|
||||
# Here we bundle them, turn South, and retool both to M1 (VCC gets an auto-via).
|
||||
(rpather.at(['GND', 'VCC'])
|
||||
.mpath(ccw=True, xmax=-10_000, spacing=5_000) # Move West to -10k, turn South
|
||||
.retool(M1_tool) # Retools both GND and VCC
|
||||
.mpath(ccw=True, emax=50_000, spacing=1_200) # Turn East, moves 50um extension
|
||||
.mpath(ccw=False, emin=1_000, spacing=1_200) # U-turn back South
|
||||
.mpath(ccw=False, emin=2_000, spacing=4_500) # U-turn back West
|
||||
.trace(True, xmax=-10_000, spacing=5_000) # Move West to -10k, turn South
|
||||
.retool(M1_tool) # Retools both GND and VCC
|
||||
.trace(True, emax=50_000, spacing=1_200) # Turn East, moves 50um extension
|
||||
.trace(False, emin=1_000, spacing=1_200) # U-turn back South
|
||||
.trace(False, emin=2_000, spacing=4_500) # U-turn back West
|
||||
)
|
||||
|
||||
# Retool VCC back to M2 and move both to x=-28k
|
||||
rpather.at('VCC').retool(M2_tool)
|
||||
rpather.at(['GND', 'VCC']).mpath(ccw=None, xmin=-28_000)
|
||||
rpather.at(['GND', 'VCC']).trace(None, xmin=-28_000)
|
||||
|
||||
# Final segments to -50k
|
||||
rpather.at('VCC').path_to(ccw=None, x=-50_000, out_ptype='m1wire')
|
||||
rpather.at('VCC').trace_to(None, x=-50_000, out_ptype='m1wire')
|
||||
with rpather.at('GND').toolctx(M2_tool):
|
||||
rpather.at('GND').path_to(ccw=None, x=-40_000)
|
||||
rpather.at('GND').path_to(ccw=None, x=-50_000)
|
||||
rpather.at('GND').trace_to(None, x=-40_000)
|
||||
rpather.at('GND').trace_to(None, x=-50_000)
|
||||
|
||||
|
||||
#
|
||||
# Branching with save_copy and into_copy
|
||||
# Branching with mark and fork
|
||||
#
|
||||
# .save_copy(new_name) creates a port copy and keeps the original selected.
|
||||
# .into_copy(new_name) creates a port copy and selects the new one.
|
||||
# .mark(new_name) creates a port copy and keeps the original selected.
|
||||
# .fork(new_name) creates a port copy and selects the new one.
|
||||
|
||||
# Create a tap on GND
|
||||
(rpather.at('GND')
|
||||
.path(ccw=None, length=5_000) # Move GND further West
|
||||
.save_copy('GND_TAP') # Mark this location for a later branch
|
||||
.pathS(length=10_000, jog=-10_000) # Continue GND with an S-bend
|
||||
.trace(None, length=5_000) # Move GND further West
|
||||
.mark('GND_TAP') # Mark this location for a later branch
|
||||
.jog(offset=-10_000, length=10_000) # Continue GND with an S-bend
|
||||
)
|
||||
|
||||
# Branch VCC and follow the new branch
|
||||
(rpather.at('VCC')
|
||||
.path(ccw=None, length=5_000)
|
||||
.into_copy('VCC_BRANCH') # We are now manipulating 'VCC_BRANCH'
|
||||
.path(ccw=True, length=5_000) # VCC_BRANCH turns South
|
||||
.trace(None, length=5_000)
|
||||
.fork('VCC_BRANCH') # We are now manipulating 'VCC_BRANCH'
|
||||
.trace(True, length=5_000) # VCC_BRANCH turns South
|
||||
)
|
||||
# The original 'VCC' port remains at x=-55k, y=VCC.y
|
||||
|
||||
|
|
@ -99,27 +99,25 @@ def main() -> None:
|
|||
# Route the GND_TAP we saved earlier.
|
||||
(rpather.at('GND_TAP')
|
||||
.retool(M1_tool)
|
||||
.path(ccw=True, length=10_000) # Turn South
|
||||
.rename_to('GND_FEED') # Give it a more descriptive name
|
||||
.trace(True, length=10_000) # Turn South
|
||||
.rename('GND_FEED') # Give it a more descriptive name
|
||||
.retool(M1_tool) # Re-apply tool to the new name
|
||||
)
|
||||
|
||||
# We can manage the active set of ports in a PortPather
|
||||
pp = rpather.at(['VCC_BRANCH', 'GND_FEED'])
|
||||
pp.add_port('GND') # Now tracking 3 ports
|
||||
pp.drop_port('VCC_BRANCH') # Now tracking 2 ports: GND_FEED, GND
|
||||
pp.path_each(ccw=None, length=5_000) # Move both 5um forward (length > transition size)
|
||||
pp.select('GND') # Now tracking 3 ports
|
||||
pp.deselect('VCC_BRANCH') # Now tracking 2 ports: GND_FEED, GND
|
||||
pp.trace(None, each=5_000) # Move both 5um forward (length > transition size)
|
||||
|
||||
# We can also delete ports from the pather entirely
|
||||
rpather.at('VCC').delete() # VCC is gone (we have VCC_BRANCH instead)
|
||||
|
||||
|
||||
#
|
||||
# Advanced Connections: path_into and path_from
|
||||
# Advanced Connections: trace_into
|
||||
#
|
||||
|
||||
# path_into routes FROM the selected port TO a target port.
|
||||
# path_from routes TO the selected port FROM a source port.
|
||||
# trace_into routes FROM the selected port TO a target port.
|
||||
|
||||
# Create a destination component
|
||||
dest_ports = {
|
||||
|
|
@ -133,10 +131,10 @@ def main() -> None:
|
|||
|
||||
# Connect GND_FEED to DEST_A
|
||||
# Since GND_FEED is moving South and DEST_A faces West, a single bend will suffice.
|
||||
rpather.at('GND_FEED').path_into('DEST_A')
|
||||
rpather.at('GND_FEED').trace_into('DEST_A')
|
||||
|
||||
# Connect VCC_BRANCH to DEST_B using path_from
|
||||
rpather.at('DEST_B').path_from('VCC_BRANCH')
|
||||
# Connect VCC_BRANCH to DEST_B
|
||||
rpather.at('VCC_BRANCH').trace_into('DEST_B')
|
||||
|
||||
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue