Skip to content

v0.10.0 — three typed SolidWorks diagnostic commands (active-config, list-configs, list-components)

Choose a tag to compare

@KenM76 KenM76 released this 15 Jun 15:34
· 2 commits to main since this release

Closes `FR_solidworks_typed_commands.md` (pending 12 days). Brings the SW plugin to surface parity with the Office plugins' typed `info` / `list-accounts` / `search` commands.

Added

`solidworks active-config` — emit `{"path","title","type","config"}` for the active doc as JSON. Empty shape with exit 0 when no doc is open.

`solidworks list-configs []` — emit `{"path","active","configs":[{"name","is_derived"}...]}`. Reuses live doc if open, otherwise silent read-only `OpenDoc6` → read → `CloseDoc`. Active-doc fallback when path omitted.

`solidworks list-components [] [--config ]` — emit `{"path","config","components":[{"name","path","config","suppressed"}...]}`. Walks `IAssemblyDoc.GetComponents(false)` — all components recursively. Optional `--config` walks a specific configuration with defense-in-depth `ShowConfiguration2` + `ForceRebuild3` verification.

Safety discipline baked in

All four cited `personal_rag` lessons are wired into the implementation:

  • OpenDoc6 silent-config-arg bug — pass actual config name, never `""` (except for `list-configs` which reads NAMES that are config-independent)
  • ForceRebuild3 invalidates COM pointers — rebuild BEFORE component walks
  • `as` on COM RCWs returned as object is unreliable — every such cast is hard-cast inside try/catch. `as` is used only on TYPED returns
  • CloseDoc leaves components resident — `CloseDoc(title)` only the doc we opened; NEVER `CloseAllDocuments(true)` (would destroy user's unsaved work)

Live-verified

Against running SW 2026 SP1.1 with `TS-0229-180192.SLDASM` open:

  • `active-config` → correct active config (`DOORS PARALLEL TO FRAME`)
  • `list-configs` → 3 configs (Default + 2 derived) — `is_derived` flag correct
  • `list-components` → 769 components walked, 65 suppressed correctly identified (proves we're in the right config — the exact failure mode the OpenDoc6 lesson warned about)
  • Active-doc fallback (no path arg) → same result as explicit path
  • Error paths → exit 1 with clear messages

See `CHANGELOG.md` v0.10.0 entry for full implementation detail.