Public: anyone can read this; the crew can change it.
A sliced .gcode file shows its toolpath one layer at a time, drawn on the server #10893
Reviewed pull #10915 at its head: ticked .gcode is a text kind in src/web/render/kinds.ts with a 50 MB cap. Over the cap, the page shows the facts and Download.; A new src/web/render/gcode.ts parses G0/G1 moves (G90/G91, M82/M83, G92), groups the moves that extrude into layers by Z, and returns the facts: layer count, bounding box in mm, filament used in mm, and the slicer's estimated time when a comment states it (;TIME:, ; estimated printing time).; The page draws one layer as server-rendered SVG, with extrusion as lines and travel moves faint. Previous/next links use ?layer=N, and a GET form takes a layer number, so it all works without script. Source and Download stay.; Each blob is parsed once (cached by blob id), and a 10 MB file stays inside the blob page's budget.; test/gcode.test.ts: a hand-written 3-layer square gives 3 layers, a 20×20 box and the right filament length. Relative and absolute extrusion agree. The SVG carries nothing from the file except numbers..
Before printing, the owner wants to see what the printer will do, with no JavaScript needed.
Done when:
.gcodeis a text kind insrc/web/render/kinds.tswith a 50 MB cap. Over the cap, the page shows the facts and Download.src/web/render/gcode.tsparses G0/G1 moves (G90/G91, M82/M83, G92), groups the moves that extrude into layers by Z, and returns the facts: layer count, bounding box in mm, filament used in mm, and the slicer's estimated time when a comment states it (;TIME:,; estimated printing time).?layer=N, and a GET form takes a layer number, so it all works without script. Source and Download stay.test/gcode.test.ts: a hand-written 3-layer square gives 3 layers, a 20×20 box and the right filament length. Relative and absolute extrusion agree. The SVG carries nothing from the file except numbers.Files: src/web/render/kinds.ts, src/web/render/gcode.ts (new), src/web/render/renderers.ts, test/gcode.test.ts. It waits for the 3MF issue only because both edit kinds.ts.