Color-preserving STEP→GLB so the web 3D viewer can drop OCCT#671
Merged
Conversation
The web 3D viewer (labwired scene3d etc.) prefers glbUrl and only falls back to a 7.6MB in-browser OCCT wasm to parse raw STEP. Baking a GLB for every geometry part removes that — the browser loads a small pre-tessellated mesh via three.js. But the kernel's fromSTEP→export glb DISCARDS AP214 per-face colors (1 grey material), which would render the new Adafruit sensors as grey blobs. So non-board url-STEP parts now go through scripts/stepToColoredGlb.ts: it reads the STEP with occt-import-js (same decoder labwired ran client-side) and ports its per-face color grouping into a colored GLB (per-color material). Verified: 8 Adafruit sensors bake to 3–7 material colored GLBs (140–620KB). buildBoardGlbs generalized to all geometry parts, per-part non-fatal (boards still guaranteed). Authored + url-board paths unchanged. Signed-off-by: Andrii Shylenko <14119286+w1ne@users.noreply.github.com>
The FreeCAD library ingest crashed with DuplicateCatalogIdError on the ANSI sprocket parts: 'Simplex ½x¼' and 'Simplex ½x⁵⁄₁₆' both slugified to 'sprocket-ansi-simplex-x-z08' because every distinguishing glyph is non-alphanumeric and got stripped. NFKD decomposes ½→1⁄2, ⁵⁄₁₆→5⁄16 etc. to ASCII digits before the strip, yielding distinct slugs. Surfaces only on a FreeCAD-ingest cache MISS (why earlier deploys passed on a warm cache). Signed-off-by: Andrii Shylenko <14119286+w1ne@users.noreply.github.com>
The FreeCAD library repeats parts across folders (LM8UU under both Bearings/ and Mountings/). ingestDirectory's strict duplicate-id guard (right for curated electronics) aborted the whole catalog build when upstream drifted into such a dupe — surfacing only on a cache MISS. Add an onDuplicate policy: 'throw' (default, unchanged for curated sources + all existing tests) vs 'skip' (keep the first file per id, drop + log the rest). The FreeCAD bulk importer uses 'skip'. Explicit sidecar-id collisions still always throw (authoring bug). Signed-off-by: Andrii Shylenko <14119286+w1ne@users.noreply.github.com>
In-process, occt-import-js's wasm heap accumulated across every url-STEP conversion and never freed — after ~a dozen parts the process was memory- starved and the heavy board CLI exports that followed hit the timeout (spawnSync ETIMEDOUT). Invoke the converter via 'node --import tsx' per part so its heap is released on exit, and bump the per-part timeout 300s→600s. Signed-off-by: Andrii Shylenko <14119286+w1ne@users.noreply.github.com>
w1ne
enabled auto-merge
July 24, 2026 15:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets the web 3D viewer (labwired scene3d etc.) load small pre-tessellated colored GLBs via three.js instead of parsing raw STEP with a 7.6 MB in-browser OCCT wasm.
What
scripts/stepToColoredGlb.ts— reads a STEP with occt-import-js (same decoder labwired ran client-side) and ports its per-face color grouping into a colored GLB (one material per color). The kernel's ownfromSTEP→export glbdrops AP214 colors (1 grey material); this keeps them.buildBoardGlbsgeneralized from boards-only to all geometry parts, per-part non-fatal (boards still guaranteed). Authored + url-board paths unchanged. The color converter runs in a fresh subprocess per part so occt's wasm heap can't accumulate.Verified
8 Adafruit sensors → 3–7 material colored GLBs, 140–620 KB (vs 7.6 MB OCCT per page load).
Also fixes (pre-existing, surface on a FreeCAD-ingest cache miss)
½x¼vs½x⁵⁄₁₆) don't collide.onDuplicate: 'skip'policy for the bulk FreeCAD import (real cross-folder dupes like LM8UU); curated electronics stay strict. + tests.Note
Catalog deploy (
parts-catalog.yml, dispatch-only) is currently gated by unrelated 70–85 MB marketplace-wave board STEPs that exceed the export timeout — tracked separately. Merging lands the code; it does not auto-deploy.