diff --git a/lib/shared/export-snippet.ts b/lib/shared/export-snippet.ts index 878e1ef4b..8efbf7766 100644 --- a/lib/shared/export-snippet.ts +++ b/lib/shared/export-snippet.ts @@ -38,6 +38,7 @@ import { getPlatformConfigWithCliDefaults } from "lib/shared/get-platform-config import { loadLocalStepModelFsMap } from "lib/shared/load-local-step-model-fs-map" import { mergePlatformConfigs } from "lib/shared/platform-config-utils" import { convertCircuitJsonToSchematicPdf } from "./convert-circuit-json-to-schematic-pdf" +import { convertModelUrlsToFileUrls } from "../../cli/build/convert-model-urls-to-file-urls" import { convertToKicadLibrary } from "./convert-to-kicad-library" import { importFromUserLand } from "./importFromUserLand" import { isCircuitJsonFile } from "./is-circuit-json-file" @@ -348,7 +349,7 @@ export const exportSnippet = async ({ case "gltf": outputContent = JSON.stringify( await convertCircuitJsonToGltf( - circuitJson, + convertModelUrlsToFileUrls(circuitJson), getCircuitJsonToGltfOptions({ format: "gltf" }), ), null, @@ -358,7 +359,7 @@ export const exportSnippet = async ({ case "glb": outputContent = Buffer.from( (await convertCircuitJsonToGltf( - circuitJson, + convertModelUrlsToFileUrls(circuitJson), getCircuitJsonToGltfOptions({ format: "glb" }), )) as ArrayBuffer, ) diff --git a/tests/cli/export/__snapshots__/export-glb-relative-step-model.snap.png b/tests/cli/export/__snapshots__/export-glb-relative-step-model.snap.png index 81e498d22..9083ab727 100644 Binary files a/tests/cli/export/__snapshots__/export-glb-relative-step-model.snap.png and b/tests/cli/export/__snapshots__/export-glb-relative-step-model.snap.png differ diff --git a/tests/cli/export/export-glb-relative-step-model.test.ts b/tests/cli/export/export-glb-relative-step-model.test.ts index d1a89ce89..9aa55ff66 100644 --- a/tests/cli/export/export-glb-relative-step-model.test.ts +++ b/tests/cli/export/export-glb-relative-step-model.test.ts @@ -47,11 +47,7 @@ test( [...stderr.matchAll(/Failed to load STEP from [^:]+/g)].map( ([message]) => message, ), - ).toMatchInlineSnapshot(` - [ - "Failed to load STEP from ./libraries/model.step", - ] - `) + ).toMatchInlineSnapshot(`[]`) const glb = await readFile(path.join(tmpDir, "export.glb")) await expect( renderGLTFToPNGFromGLB(glb, GLB_SNAPSHOT_CAMERA),