← Commit history

Initial commit: skill/kicad10-to-altium

barrett-land ·cc397428e6 ·2mo ago
2 files changed +127
README.mdadded+74
@@ -0,0 +1,74 @@+# kicad10-to-altium++Get KiCad symbols into Altium Designer correctly — especially from **KiCad 10**.++![kicad10-to-altium](docs/hero.png)++## The problem++Altium 26's KiCad importer understands the format **through KiCad 9**. A KiCad 10 file still+imports, but silently drops **property visibility** — so every field that is hidden in KiCad lands+*visible* in Altium, stacking into an unreadable pile on top of the symbol.++Measured on the same `Device:R` symbol from each installed KiCad:++| Source | Importer warnings | **Hidden preserved** |+|---|---|---|+| KiCad 8 | 1 | 5 ✓ |+| KiCad 9 | 2 | 5 ✓ |+| **KiCad 10** | **7** | **0 ✗** |+| KiCad 10 → 9 (this skill) | 2 | **5 ✓** |++Pins and body geometry survive in every case. It is the metadata that degrades.++**KiCad 9 cannot open a KiCad 10 library at all** (`Unable to load library`), so there is no+"re-save it in KiCad 9" escape hatch for a v10-only third-party library. Hence the converter.++## Use it++```bash+python3 kicad_v10_to_v9.py in.kicad_sym -o out_v9.kicad_sym+kicad-cli sym export svg out_v9.kicad_sym -o /tmp/svg     # must exit 0+```++Then import headlessly via the `AdomBridge` extension, link a real footprint model, normalise the+text style with `altium_set_text_style`, and — for symbols already imported badly — repair+visibility in place with `altium_set_visibility`.++## The other silent difference: font and colour++The importer does not reuse the document's default font. Read straight out of the `.SchLib`+binary, a hand-made part and an imported one in the *same* library disagree on every text object:++| | Font | Face / size | `Color` |+|---|---|---|---|+| Hand-made Altium part | `FontID=1` | Times New Roman 10 | `8388608` |+| **KiCad-imported part** | `FontID=3` / `4` | **Yu Gothic UI Light 8** | **`8650884`** |++Altium stores colour as **BGR**, so `8388608` = `$800000` = navy RGB(0,0,128); the imported+`8650884` is RGB(4,2,132), just off enough to read as a rendering artefact instead of wrong data.+The importer also *appends* fonts rather than reusing them, so a library imported into repeatedly+accumulates near-duplicate table entries.++## Derived symbols: the failure a token-perfect conversion still hits++KiCad 9 resolves `(extends "Base")` in a **single forward pass**, so a derived symbol placed before+its base makes the entire library fail to load. KiCad 10 does not care about order — so v10 files+store the derived symbol first, and real ones do.++`kicad-cli` reports only `Unable to load library`, naming neither symbol, on a file that **KiCad 10+opens fine**. That asymmetry is the diagnostic: *loads in 10, fails in 9* means a v9-only rule.+This converter topologically reorders symbols so each base precedes its dependants.++Derived symbols are how KiCad ships most ICs — every part in `MCU_ST_STM32F1` is one — so ignoring+order works on passives and fails on practically every real IC.++## Why a parser and not a regex++`hide` is **relocated** between versions, not renamed: KiCad 9 nests `(hide yes)` *inside*+`(effects …)`; KiCad 10 moved it *out* to be a direct child of `property`. Substituting the token+in place yields a file that is neither version — KiCad 9 rejects it and Altium ignores the orphan+token, so visibility is still lost **while the warning count drops**, which looks like success.++See [SKILL.md](SKILL.md) for the full workflow, what downgrading costs, and the operational+gotchas (serial-only verbs, timeouts that actually succeeded, stuck `X2.EXE` launchers).
page.jsonadded+53
@@ -0,0 +1,53 @@+{+  "slug": "kicad10-to-altium",+  "version": "1.1.0",+  "type": "skill",+  "description": "Import KiCad 10 symbols into Altium Designer correctly. Altium 26 supports KiCad through 9 only, so a raw KiCad 10 import silently loses property visibility and every hidden field lands visible. Downgrades v10 to v9 first, then imports headlessly, links the footprint, and repairs visibility.",+  "tags": [+    "skill",+    "kicad",+    "altium",+    "import",+    "library",+    "eda"+  ],+  "dependencies": {+    "barrett-land/adom-desktop-altium-bridge": "*"+  },+  "scripts": {+    "install": "./install.sh",+    "uninstall": "./uninstall.sh"+  },+  "needs_sudo": false,+  "discovery_triggers": [+    "import kicad symbol into altium",+    "kicad 10 to altium",+    "kicad symbols show all fields in altium",+    "altium import lost hidden fields",+    "downgrade kicad 10 library",+    "kicad to altium library"+  ],+  "discovery_pitch": "Use when bringing KiCad symbols into Altium, especially from KiCad 10, or when an imported symbol shows a pile of overlapping text fields.",+  "sample_prompts": [+    {+      "label": "Import a symbol",+      "prompt": "Import this KiCad symbol into my Altium resistors library"+    },+    {+      "label": "Fix a bad import",+      "prompt": "My imported Altium symbol shows all its fields overlapping, fix it"+    },+    {+      "label": "Downgrade a library",+      "prompt": "Convert this KiCad 10 library to KiCad 9"+    }+  ],+  "hero": {+    "type": "image",+    "path": "docs/hero.png"+  },+  "author": {+    "name": "barrett-land",+    "email": "[email protected]"+  }+}\ No newline at end of file