From a comparison with Casys-AI/mcp-build123d: that server exports GLTF binary alongside STEP/STL, specifically so MCP apps with embedded UI can hand the result to a three.js viewer for interactive orbit/pan/zoom inspection.
export() currently supports step, stl, 3mf, dxf, svg (src/build123d_mcp/tools/export.py). glTF/GLB is the natural web-viewer interchange format and would let users drop exported parts straight into three.js, <model-viewer>, Babylon, Blender, etc.
This is cheaper than it looks: src/build123d_mcp/viewer.py already contains a self-contained, zero-dependency glTF 2.0 binary encoder (encode_glb()) used by the live session viewer, fed by the existing tessellation path. Adding glb to _VALID_FORMATS and wiring the tessellate → encode_glb → temp-and-rename write path into export_file() should need no new dependencies.
Suggested scope:
export(filename, format="glb") for 3D shapes (2D shapes rejected, same as step/stl/3mf)
- Reuse the existing tessellation quality settings the viewer uses, or expose a coarse/fine knob if trivial
- Multi-format export (
format="step,glb") should work since it goes through the same list handling
From a comparison with Casys-AI/mcp-build123d: that server exports GLTF binary alongside STEP/STL, specifically so MCP apps with embedded UI can hand the result to a three.js viewer for interactive orbit/pan/zoom inspection.
export()currently supportsstep, stl, 3mf, dxf, svg(src/build123d_mcp/tools/export.py). glTF/GLB is the natural web-viewer interchange format and would let users drop exported parts straight into three.js,<model-viewer>, Babylon, Blender, etc.This is cheaper than it looks:
src/build123d_mcp/viewer.pyalready contains a self-contained, zero-dependency glTF 2.0 binary encoder (encode_glb()) used by the live session viewer, fed by the existing tessellation path. Addingglbto_VALID_FORMATSand wiring the tessellate →encode_glb→ temp-and-rename write path intoexport_file()should need no new dependencies.Suggested scope:
export(filename, format="glb")for 3D shapes (2D shapes rejected, same as step/stl/3mf)format="step,glb") should work since it goes through the same list handling