diff --git a/README.md b/README.md index e6656a7..585af92 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # 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. + +--- + ## Capacitors by net pair **Script:** `CapacitorsByNetPair.pas` @@ -103,6 +107,57 @@ Use **.env** (optional): set `FILE1`, `FILE2`, and `COMPARE_OUTPUT`; CLI argumen python3 compare_protel_locations.py tests/sample_protel_ascii.pcb tests/sample_protel_ascii_rev2.pcb ``` +--- + +## Spreadsheet diff by designator + +**Script:** `diff_spreadsheets.py` + +Compares two spreadsheets (`.xlsx` or `.csv`) on a designator column. Data is read **from row 10** by default (first 9 rows skipped). Outputs which designators are only in file1, only in file2, or in both. + +**Usage:** + +```bash +pip install pandas openpyxl +python3 diff_spreadsheets.py sheet1.xlsx sheet2.xlsx -o output/spreadsheet_diff.json +``` + +Options: `--designator-col 0` (0-based column index), `--start-row 9` (0-based; 9 = row 10). Env: `SHEET1`, `SHEET2`, `DIFF_OUTPUT`. + +**Test:** `tests/sheet1.csv` and `tests/sheet2.csv` (designators from row 10): + +```bash +python3 diff_spreadsheets.py tests/sheet1.csv tests/sheet2.csv --start-row 9 +``` + +--- + +## Find bottom termination parts (QFN, DFN, BGA) by description + +**Script:** `find_bottom_termination_parts.py` + +Reads the same spreadsheet format (designator column, data from row 10) plus **description** and optionally **package** columns. Finds components whose description or package indicates **bottom termination**, including: + +- **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`. + +**Usage:** + +```bash +python3 find_bottom_termination_parts.py sheet.xlsx --description-col 1 +python3 find_bottom_termination_parts.py sheet.xlsx --description-col 3 +``` + +Env: `SHEET`, `BOTTOM_TERM_OUTPUT`, `DESCRIPTION_COL` (default 1), `START_ROW` (default 9). No package column; only description is searched. + +**Test:** `tests/sheet_with_descriptions.csv` (description col 3): + +```bash +python3 find_bottom_termination_parts.py tests/sheet_with_descriptions.csv --description-col 3 --start-row 9 +``` + ### Notes - Only components with **exactly two pads** (each on a net) and **designator starting with `C`** are included (treated as capacitors). To include all two-pad parts, edit the script and remove the `And (UpperCase(Copy(Component.Name.Text, 1, 1)) = 'C')` condition.