Use outputs/ for all JSON output

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-11 12:36:14 +13:00
parent 22b4117990
commit 758991d75d
7 changed files with 17 additions and 17 deletions

View File

@@ -2,22 +2,22 @@
# Capacitors by net pair
INPUT_FILE=board.pcb
OUTPUT_FILE=output/capacitors_by_net_pair.json
OUTPUT_FILE=outputs/capacitors_by_net_pair.json
# Compare Protel locations
FILE1=board_v1.pcb
FILE2=board_v2.pcb
COMPARE_OUTPUT=output/compare_locations.json
COMPARE_OUTPUT=outputs/compare_locations.json
THRESHOLD=1.0
# Spreadsheet diff (designator column, data from row 10)
SHEET1=sheet1.xlsx
SHEET2=sheet2.xlsx
DIFF_OUTPUT=output/spreadsheet_diff.json
DIFF_OUTPUT=outputs/spreadsheet_diff.json
DESIGNATOR_COL=0
START_ROW=9
# Find bottom termination parts (search description column only; no package column)
SHEET=sheet.xlsx
BOTTOM_TERM_OUTPUT=output/bottom_termination_parts.json
BOTTOM_TERM_OUTPUT=outputs/bottom_termination_parts.json
DESCRIPTION_COL=1

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
*.json
.env
output/
outputs/

View File

@@ -1,6 +1,6 @@
# Altium Scripts
**Convention:** All Python scripts use **.env** for input/output paths (and optional settings); you can override any value via **CLI**. Copy `.env.example` to `.env` and edit.
**Convention:** All Python scripts use **.env** for input/output paths (and optional settings); you can override any value via **CLI**. All scripts write JSON output to the **`outputs/`** folder by default. Copy `.env.example` to `.env` and edit.
---
@@ -71,7 +71,7 @@ Finds all **two-pad components** on the PCB that share the same two nets (e.g. d
python3 capacitors_by_net_pair.py board.PcbDoc -o out.json
```
**Input/output from .env:** Copy `.env.example` to `.env` and set `INPUT_FILE` and `OUTPUT_FILE`. The script reads these when the optional `python-dotenv` package is installed; CLI arguments override them. Without `.env`, you can still pass the input file and `-o` on the command line. By default the JSON is written to **`output/capacitors_by_net_pair.json`** (the `output/` directory is created if needed).
**Input/output from .env:** Copy `.env.example` to `.env` and set `INPUT_FILE` and `OUTPUT_FILE`. The script reads these when the optional `python-dotenv` package is installed; CLI arguments override them. Without `.env`, you can still pass the input file and `-o` on the command line. By default the JSON is written to **`outputs/capacitors_by_net_pair.json`** (the `outputs/` directory is created if needed).
See **`capacitors_by_net_pair.py`** for the script. It parses COMP/PATTERN/VALUE and NET/PIN data from the ASCII file and produces the same JSON shape as the DelphiScript.
@@ -87,7 +87,7 @@ python3 capacitors_by_net_pair.py tests/sample_protel_ascii.pcb -o tests/out.jso
**Script:** `compare_protel_locations.py`
Loads two Protel PCB 2.8 ASCII files and reports **which components have moved** between them. Component position is the centroid of pin coordinates. Output is written to `output/compare_locations.json` by default.
Loads two Protel PCB 2.8 ASCII files and reports **which components have moved** between them. Component position is the centroid of pin coordinates. Output is written to `outputs/compare_locations.json` by default.
- **Moved:** designators with different (x, y) in file2, with old position, new position, and distance.
- **Only in file1 / only in file2:** components that appear in just one file.
@@ -96,7 +96,7 @@ Loads two Protel PCB 2.8 ASCII files and reports **which components have moved**
```bash
python3 compare_protel_locations.py board_v1.pcb board_v2.pcb
python3 compare_protel_locations.py board_v1.pcb board_v2.pcb -o output/compare_locations.json
python3 compare_protel_locations.py board_v1.pcb board_v2.pcb -o outputs/compare_locations.json
```
Use **.env** (optional): set `FILE1`, `FILE2`, and `COMPARE_OUTPUT`; CLI arguments override them. Use `--threshold N` to set the minimum position change to count as moved (default 1.0).
@@ -119,7 +119,7 @@ Compares two spreadsheets (`.xlsx` or `.csv`) on a designator column. Data is re
```bash
pip install pandas openpyxl
python3 diff_spreadsheets.py sheet1.xlsx sheet2.xlsx -o output/spreadsheet_diff.json
python3 diff_spreadsheets.py sheet1.xlsx sheet2.xlsx -o outputs/spreadsheet_diff.json
```
Options: `--designator-col 0` (0-based column index), `--start-row 9` (0-based; 9 = row 10). Env: `SHEET1`, `SHEET2`, `DIFF_OUTPUT`.
@@ -141,7 +141,7 @@ Reads the same spreadsheet format (designator column, data from row 10) plus **d
- **Package types:** QFN, DFN, BGA, LGA, SON, MLF, MLP, WDFN, WQFN, VQFN, etc.
- **Generic:** “bottom termination” (e.g. with 0201 or 0402)
Outputs matching designators, description, package, and the matched pattern to `output/bottom_termination_parts.json`.
Outputs matching designators, description, package, and the matched pattern to `outputs/bottom_termination_parts.json`.
**Usage:**

View File

@@ -187,7 +187,7 @@ def build_net_key(net1: str, net2: str) -> str:
def main() -> int:
default_input = os.environ.get("INPUT_FILE", "").strip() or None
default_output = os.environ.get("OUTPUT_FILE", "").strip() or "output/capacitors_by_net_pair.json"
default_output = os.environ.get("OUTPUT_FILE", "").strip() or "outputs/capacitors_by_net_pair.json"
parser = argparse.ArgumentParser(description="List capacitors by net pair from Protel PCB 2.8 ASCII")
parser.add_argument(
@@ -199,7 +199,7 @@ def main() -> int:
parser.add_argument(
"-o", "--output",
default=default_output,
help="Output JSON path (default: OUTPUT_FILE from .env or output/capacitors_by_net_pair.json)",
help="Output JSON path (default: OUTPUT_FILE from .env or outputs/capacitors_by_net_pair.json)",
)
parser.add_argument("--all-two-pad", action="store_true", help="Include all 2-pad parts, not only C*")
args = parser.parse_args()

View File

@@ -99,7 +99,7 @@ def main() -> int:
default_file2 = os.environ.get("FILE2", "").strip() or None
default_output = (
os.environ.get("COMPARE_OUTPUT", "").strip()
or "output/compare_locations.json"
or "outputs/compare_locations.json"
)
default_threshold = os.environ.get("THRESHOLD", "").strip()
try:
@@ -126,7 +126,7 @@ def main() -> int:
"-o",
"--output",
default=default_output,
help="Output JSON path (default: COMPARE_OUTPUT from .env or output/compare_locations.json)",
help="Output JSON path (default: COMPARE_OUTPUT from .env or outputs/compare_locations.json)",
)
parser.add_argument(
"--threshold",

View File

@@ -57,7 +57,7 @@ def read_designators(path: str, designator_col: int = 0, start_row: int = 9) ->
def main() -> int:
default1 = os.environ.get("SHEET1", "").strip() or None
default2 = os.environ.get("SHEET2", "").strip() or None
default_out = os.environ.get("DIFF_OUTPUT", "").strip() or "output/spreadsheet_diff.json"
default_out = os.environ.get("DIFF_OUTPUT", "").strip() or "outputs/spreadsheet_diff.json"
default_col = os.environ.get("DESIGNATOR_COL", "").strip()
default_start = os.environ.get("START_ROW", "").strip()
try:

View File

@@ -95,7 +95,7 @@ def is_bottom_termination_in_description(description: str) -> tuple[bool, str]:
def main() -> int:
default_sheet = os.environ.get("SHEET", "").strip() or None
default_out = os.environ.get("BOTTOM_TERM_OUTPUT", "").strip() or "output/bottom_termination_parts.json"
default_out = os.environ.get("BOTTOM_TERM_OUTPUT", "").strip() or "outputs/bottom_termination_parts.json"
default_des_col = os.environ.get("DESCRIPTION_COL", "").strip()
default_start = os.environ.get("START_ROW", "").strip()
try: