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,