diff --git a/klayout_package/python/kqcircuits/masks/mask_set.py b/klayout_package/python/kqcircuits/masks/mask_set.py index 404981617..f36d4c418 100644 --- a/klayout_package/python/kqcircuits/masks/mask_set.py +++ b/klayout_package/python/kqcircuits/masks/mask_set.py @@ -19,6 +19,7 @@ import copy import os import logging +import sys from sys import argv from time import perf_counter from inspect import isclass @@ -29,6 +30,7 @@ from kqcircuits.chips.chip import Chip from kqcircuits.masks.multi_face_mask_layout import MultiFaceMaskLayout +from kqcircuits.run import argument_parser from kqcircuits.util.log_router import route_log from kqcircuits.pya_resolver import pya, is_standalone_session from kqcircuits.defaults import default_bar_format, TMP_PATH, default_face_id @@ -79,12 +81,17 @@ def __init__( with_grid=False, export_drc="", mask_export_layers=None, - export_path=TMP_PATH, + export_path=None, add_mask_name_to_chips=False, ): self._time = {"INIT": perf_counter(), "ADD_CHIPS": 0, "BUILD": 0, "EXPORT": 0, "END": 0} + if export_path is None: + arg_parser, _ = argument_parser() + arg_values, _ = arg_parser.parse_known_args(sys.argv[1:]) + export_path = TMP_PATH if not arg_values.p else arg_values.p + if view is None: self.view = KLayoutView() self.layout = self.view.layout @@ -100,6 +107,7 @@ def __init__( self.add_mask_name_to_chips = add_mask_name_to_chips self._extra_params = {} self._mask_set_dir = Path(export_path) / f"{name}_v{version}" + print(f"Exporting to: {str(self._mask_set_dir)}") self._mask_set_dir.mkdir(parents=True, exist_ok=True) diff --git a/klayout_package/python/kqcircuits/run.py b/klayout_package/python/kqcircuits/run.py index d90f7c592..3753621c2 100644 --- a/klayout_package/python/kqcircuits/run.py +++ b/klayout_package/python/kqcircuits/run.py @@ -91,6 +91,7 @@ def argument_parser(): ) mask_parser.add_argument("-s", "--skip_extras", action="store_true", help="Skip netlist and documentation export") mask_parser.add_argument("-c N", action="store_true", help="Limit the number of used CPUs to 'N'") + mask_parser.add_argument("-p", action="store", help="Path to export the mask to, defaults to TMP_PATH") singularity_parser.add_argument("--build", action="store_true", help="build singularity image locally") singularity_parser.add_argument(