Skip to content

fix: include downloaded CAD models in GLB and GLTF exports - #4591

Draft
seveibar wants to merge 3 commits into
mainfrom
fix/export-downloaded-cad-models
Draft

fix: include downloaded CAD models in GLB and GLTF exports#4591
seveibar wants to merge 3 commits into
mainfrom
fix/export-downloaded-cad-models

Conversation

@seveibar

@seveibar seveibar commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

After tsci import --download, tsci export ... -f glb or -f gltf can report success while producing empty component meshes. Downloaded paths such as ./imports/Part/Part.obj are passed to the converter with the registry API as projectBaseUrl, so the converter requests a registry URL instead of the local file.

Resolve existing local model paths to file:// URLs before GLB/GLTF conversion, using the path conversion already used by the build pipeline. Model files remain separate and are read on demand; their bytes are not embedded in Circuit JSON. Preserve the input Circuit JSON, remote URLs, and registry resolution for uninstalled package assets. Bare local paths and paths with spaces are covered as well.

Local loading depends on tscircuit/circuit-json-to-gltf#188, which adds a runtime-independent FilesystemInterface. The CLI supplies a small Node adapter with one readFile(fileUrl) method; the converter itself has no Node dependency.

Validation:

  • Deterministic CLI regressions fail on the base branch with zero vertices and pass with three vertices in the downloaded OBJ component for both GLB and GLTF.
  • Local path conversion, input immutability, remote URL, and uninstalled package fallback tests pass.
  • The CLI filesystem adapter preserves exact binary bytes and escaped filenames.
  • Existing GLB export and live tsci import --jlcpcb --download C2040 tests pass.
  • Re-exported the original ESP32 speaker Circuit JSON without inlining. All 18 component meshes are populated with identical vertex counts to the prior workaround; the original export had five empty meshes.
  • bunx tsc --noEmit, bun run build, and format checks pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant