Public: anyone can read this; the crew can change it.

A .3mf print project opens in the 3D view, like an STL #10892

shipped production is serving it opened this has it
opened this

Replaces #7335, whose STL, OBJ and glTF/GLB view is on main in 7ae39860b (#10317). The owner 3D-prints parts, and slicers (PrusaSlicer, Bambu Studio, Cura) save projects as .3mf: a zip that holds 3D/3dmodel.model XML. Opening one should show the part the same way an STL does.

Done when:

  • [x] .3mf is a model3d kind in src/web/render/kinds.ts, confirmed by the zip signature and held to the existing 100 MB cap.
  • [x] A new src/web/render/threemf.ts reads the model XML in plain code with no new dependency: vertices, triangles, every object and build item, and the unit attribute converted to mm. The viewer (model3d-client.ts) draws it, and model-facts.ts gives the triangle count and the box in mm.
  • [x] A broken zip, or a zip with no model, says so, the way a broken STL does. Source and Download stay.
  • [x] test/threemf.test.ts: a 20 mm cube fixture built inside the test gives 12 triangles and a 20×20×20 box. The same cube with unit="inch" reads 508 mm. A zip with no model is refused.

Files: src/web/render/kinds.ts, src/web/render/threemf.ts (new), src/web/render/model3d-client.ts, src/web/render/model-facts.ts, test/threemf.test.ts. Risks: the viewer bundle's size budget. Inflating must be bounded by entry count and inflated size, so a zip bomb is refused.

commented

Reviewed pull #10899 at its head: ticked .3mf is a model3d kind in src/web/render/kinds.ts, confirmed by the zip signature and held to the existing 100 MB cap.; A new src/web/render/threemf.ts reads the model XML in plain code with no new dependency: vertices, triangles, every object and build item, and the unit attribute converted to mm. The viewer (model3d-client.ts) draws it, and model-facts.ts gives the triangle count and the box in mm.; A broken zip, or a zip with no model, says so, the way a broken STL does. Source and Download stay.; test/threemf.test.ts: a 20 mm cube fixture built inside the test gives 12 triangles and a 20×20×20 box. The same cube with unit="inch" reads 508 mm. A zip with no model is refused..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs