From d39b0792a9b4ab741a27041d8f670fcaf964a8c8 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 14 Jul 2026 10:50:46 +0000 Subject: [PATCH] Add direct .SchLib parameter writer (schlib_write.py): write SOP mandatory params into symbol, Value=value-only, remove UL Manufacturer_Name/Part_Number; docs updated --- SKILL.md | 55 +++++++ assets/CHANGELOG.xlsx | Bin 5530 -> 5530 bytes references/schlib_parameters.md | 122 +++++++++++++++ scripts/altium_params.py | 189 +++++++++++++++++++++++ scripts/schlib_write.py | 261 ++++++++++++++++++++++++++++++++ 5 files changed, 627 insertions(+) create mode 100644 references/schlib_parameters.md create mode 100644 scripts/altium_params.py create mode 100644 scripts/schlib_write.py diff --git a/SKILL.md b/SKILL.md index bcd0922..5159e39 100644 --- a/SKILL.md +++ b/SKILL.md @@ -290,6 +290,12 @@ python scripts/fill_templates.py part.json \ --template assets/template/template.xlsx --dest // --design design.json ``` +Once you have the symbol and its Library Ref, you can also produce the **mandatory symbol +parameters** the SOP requires on the `.SchLib` (Manufacturer, Manufacturer Part, Value, +Tolerance, Operating Temperature, RoHS, Datasheet, Process, Vecmocon Part Code, …) — see +*Mandatory symbol parameters* below. This is optional per run but is how the datasheet values +land in the Altium symbol's properties. + ### 7. Assemble the part folder The staging folder `/` should now hold the four files: the per-part `.xlsx`, the @@ -306,6 +312,47 @@ This places the folder at `components///` — creating the Class fol doesn't exist yet, or pushing into it if it does — and commits and pushes. Confirm to the user where it landed. +## Mandatory symbol parameters (.SchLib) + +The SOP (§5) requires every schematic symbol to carry a fixed parameter set in its Altium +properties — `Manufacturer`, `Manufacturer Part`, `Value`, `Tolerance`, `Operating +Temperature`, `ROHS`, `Datasheet`, `Process`, `Vecmocon Part Code`, and the two second-source +fields — with the **Comment** set to the MPN. The skill can stamp these onto the symbol from +the datasheet. + +The skill writes these **directly into the `.SchLib` in pure Python** with +`scripts/schlib_write.py` (it rebuilds the OLE around the enlarged `Data` stream, preserving +every other byte, and strips the Ultra-Librarian `Manufacturer_Name` / `Manufacturer_Part_Number` +defaults that duplicate the SOP fields). Three kinds of value: + +- **Read from the datasheet** (don't just echo given text — open the PDF and fill the real, + verified values): `Value` = the **value only** in shorthand (e.g. `1u`, `12p`, `10k` — no + package), plus `Manufacturer`, `Manufacturer Part`, `Operating Temperature`, `Tolerance`, + `ROHS`, `Datasheet`, and `Process` by inference from the package. +- **Leave blank for now** — `Manufacturer 2` / `Manufacturer Part 2` (the second source). Don't + populate these by default; they stay hidden in Altium until filled later. (An optional + cross-reference search to find a second source is documented in + `references/schlib_parameters.md` but is currently off — only do it if the engineer asks.) +- **Ask the engineer** — only `Vecmocon Part Code` (internal, not derivable). + +Leave any genuinely-unknown field blank — the SOP hides blank parameters, so a gap simply stays +empty until filled. The full method for the second-source search is in +`references/schlib_parameters.md`. + +Collect the values into a `params.json` and write them into the symbol: + +```bash +python scripts/schlib_write.py --schlib .SchLib --params params.json --out //.SchLib +``` + +Deliver the resulting `.SchLib`; the engineer opens it in Altium once to confirm it loads, then +**Saves to Server** with a revision note. The full parameter set, each value's source, the +`params.json` shape (incl. the `remove` list), and the mini-stream size caveat are in +`references/schlib_parameters.md` — read it before building the parameter set. If a file doesn't +round-trip, fall back to `scripts/altium_params.py` (emits an Altium DXP script to apply the same +parameters from inside Altium). Always have the engineer confirm the file opens in Altium — the +skill writes Altium's own binary format, so Altium is the final validator. + ## Per-typeid versioning Versioning is **per typeid**, not global. Each typeid carries its own `template_version` and @@ -462,6 +509,9 @@ plain flat push, but it does not merge the changelog or blank the token, so pref engineering string for each part's Description column). Defines a format for **every** type: the four SOP-defined ones (RES/CAP/Zener/TVS) are strict, the rest are the house extension on the same basis. Read it before filling any Description. +- `references/schlib_parameters.md` — the SOP **mandatory symbol parameters** (§5) for the + `.SchLib`: the parameter set, where each value comes from, and how the generated Altium script + stamps them onto the symbol. - `assets/template/versions.json` — per-typeid `template_version` + `skill_version`. - `assets/CHANGELOG.xlsx` — global version/parameter changelog (created on first add; merged into the skill repo's copy in Gitea by `push-skill`). @@ -472,6 +522,11 @@ plain flat push, but it does not merge the changelog or blank the token, so pref - `scripts/append_parameter.py` — append parameter(s) to a typeid, bump its versions, write the changelog. - `scripts/altium_refs.py` — read Library/Footprint Ref from `.SchLib`/`.PcbLib`. +- `scripts/schlib_write.py` — write the SOP mandatory parameters **directly into a `.SchLib`** + (pure-Python OLE rebuild; removes the Ultra-Librarian `Manufacturer_Name` / + `Manufacturer_Part_Number` defaults). Primary path; see `references/schlib_parameters.md`. +- `scripts/altium_params.py` — fallback: generate an Altium DelphiScript that stamps the same + parameters onto a `.SchLib` from inside Altium (DXP → Run Script). - `scripts/gitea_components.py` — `check-mpn`, `find-part` (locate an existing part to update), `checkout`, `list-type`, `place-part`, `commit-push`, `push-part` (library repo), and `push-skill` (skill repo: token-blanked push + append-only changelog merge). diff --git a/assets/CHANGELOG.xlsx b/assets/CHANGELOG.xlsx index cdd51ab1ee007787a79bd094c18ccc9e926e5211..888a6a81821450b3e75acb57bc6fa676dafdbd3d 100644 GIT binary patch delta 1742 zcmY*a3pCS=25oEP_A$hmm!gv9?UyoyOGCcr0cE4%6nKPcOiaAE=r_ZNv@@P znPua86vO?ympn#c*DI?`jL_wtQ~&?}d(QWK&i9<}_k7R!d>@|@!xBSz4_B}Z5(EOt zfxJ)W$@8Gzr$zohJ2Ppkd4v1uJoh$?{8chUIBp%~c--?Q{2Ic^$xWKdRE}YWj_8|) zudY;uEF60e!gg$l*I3gINfn>c`YKjcyMmh40!Hx_nmNQ4R3QC7w-ze~`3Y0#Vs%18;`d!>He2Ud%HtGGA`BU?rP_7Dn-$i6a7d-Gn z$*fZFC>M?4$uXD{kV9~4?H02P%guRVI-+YKZ)Z!4HD2`Kjt)$9H%FgiJ3SmIPQ@F} zzNYfs0rDgECq5X^HCebmaTYRx^sjO86g)pw+p^KyT5EYR!lW(U0!`MNThIL9>~Z-0 zjPdl|uatndIbp3z9hH^aVMQ@(!4j~Q`<5ORGlJQ@Wq8^)O4&&3a;;q&5%!lgO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