An .stl file as a 3D model
An .stl file (binary or ASCII) opens on its blob page as a part you can turn, with its facts above it:
Format, File size, Triangles and the Box (its size in the file's own units: an STL carries none, so it reads 20 × 20 × 20 units, not millimetres).
The first paint carries the triangle count and box, read by the server, so they show with JavaScript off.
src/web/render/stl.tsreads and checks the bytes (readStl);mesh.tsholds the shared parser;model3d.ts
draws the frame; model3d-client.ts is the viewer script (the vendored three.js, loaded only by this page).
- Turn it with the pointer (drag to orbit, wheel to zoom) or the arrow keys once the canvas has focus; Wireframe and
Axes are buttons beside the facts.
- The header and triangle count are checked against the byte length before any triangle is read. A truncated or
damaged file, one with no triangles or a coordinate that is not a number, is refused with a sentence and Download.
- Over 20 MB: refused with a sentence and never fetched; Download still streams it.
- The server reads the whole file, up to 20 MB, for the first paint, so the facts show with JavaScript off at any size the page opens.
- Try it: commit a
.stlto a repository and open its file page.
Pinned by test/render-stl.test.ts and test/model3d.test.ts. The viewer's neighbours: mesh-files.md.