add the toolctx() context manager to simplify temporary retool() calls

This commit is contained in:
Jan Petykiewicz 2024-10-05 15:51:58 -07:00
commit cd60dcc765
2 changed files with 39 additions and 1 deletions

View file

@ -265,6 +265,12 @@ def main() -> None:
# when using pather.retool().
pather.path_to('VCC', None, -50_000, out_ptype='m1wire')
# Now extend GND out to x=-50_000, using M2 for a portion of the path.
# We can use `pather.toolctx()` to temporarily retool, instead of calling `retool()` twice.
with pather.toolctx(M2_tool, keys=['GND']):
pather.path_to('GND', None, -40_000)
pather.path_to('GND', None, -50_000)
# Save the pather's pattern into our library
library['Pather_and_BasicTool'] = pather.pattern