Use .env or CLI for paths and options
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Load two Protel PCB 2.8 ASCII files and report which components have moved
|
||||
between them. Component position is taken as the centroid of pin coordinates.
|
||||
|
||||
Input/output paths can be set in .env (FILE1, FILE2, COMPARE_OUTPUT); CLI overrides.
|
||||
All paths: use .env (FILE1, FILE2, COMPARE_OUTPUT) or CLI; CLI overrides .env.
|
||||
|
||||
Usage:
|
||||
python3 compare_protel_locations.py file1.pcb file2.pcb [-o report.json]
|
||||
@@ -101,6 +101,11 @@ def main() -> int:
|
||||
os.environ.get("COMPARE_OUTPUT", "").strip()
|
||||
or "output/compare_locations.json"
|
||||
)
|
||||
default_threshold = os.environ.get("THRESHOLD", "").strip()
|
||||
try:
|
||||
default_threshold = float(default_threshold) if default_threshold else 1.0
|
||||
except ValueError:
|
||||
default_threshold = 1.0
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Compare two Protel PCB ASCII files and list components that moved"
|
||||
@@ -126,8 +131,8 @@ def main() -> int:
|
||||
parser.add_argument(
|
||||
"--threshold",
|
||||
type=float,
|
||||
default=1.0,
|
||||
help="Minimum position change to count as moved (default: 1.0)",
|
||||
default=default_threshold,
|
||||
help="Minimum position change to count as moved (default: THRESHOLD from .env or 1.0)",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user