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

@@ -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:**