Generated laser-cut pendant¶
Open the example · JavaScript source
This advanced example runs two independent WASM modules: the Viewer SDK renders the product, while a small geometry generator turns text and a font into GLB bytes. The page then merges those bytes as a viewer part.
const bytes = await buildLaserCut(generator, fontBytes, text, dimensions);
await viewer.removePart('laser-cut');
await viewer.mergePart('laser-cut', bytes, {
format: 'glb', filename: 'laser-cut.glb'
});
viewer.setMaterial('Pendant Metal', 'Silver 925');
The revision counter discards obsolete results when a user types faster than generation finishes. A promise chain serializes remove/merge transactions. These are application concerns; the Viewer SDK accepts the resulting Uint8Array directly.
