From bae1303e42432cbc358c2b9535e1031afb8fc540 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 23 Apr 2026 09:20:16 -0500 Subject: [PATCH] new model viewer fix 2 --- src/server/services/stepConverter.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/services/stepConverter.ts b/src/server/services/stepConverter.ts index 40347fc..133d330 100644 --- a/src/server/services/stepConverter.ts +++ b/src/server/services/stepConverter.ts @@ -53,9 +53,11 @@ export async function convertStepFile( sourceFile: path.basename(inputPath), meshCount: result.meshes.length, meshes: result.meshes.map(mesh => { - const pos = mesh.attributes.position.array - const nor = mesh.attributes.normal?.array - const idx = mesh.index.array + // Explicitly wrap in typed arrays — WASM may return array-like objects + // without a .buffer property, which would break Buffer.from(). + const pos = new Float32Array(mesh.attributes.position.array) + const nor = mesh.attributes.normal ? new Float32Array(mesh.attributes.normal.array) : null + const idx = new Uint32Array(mesh.index.array) return { positions: Buffer.from(pos.buffer, pos.byteOffset, pos.byteLength).toString('base64'), normals: nor ? Buffer.from(nor.buffer, nor.byteOffset, nor.byteLength).toString('base64') : null,