How do you read a G-code file and inspect its layers?
Understand G0/G1 moves, X/Y/Z/E/F fields, layer comments, and the checks to run before printing.
As of 4 August 2026, reading an FDM G-code file starts with its positioning and extrusion modes, followed by the X, Y, Z, E, and F fields in G0/G1 moves. A layer preview should check extrusion paths, travel moves, model bounds, and height changes together.
What changed in this update?
G0/G1 fields, layer markers, and the validation sequence from a 364-layer file were added.
Which fields matter in G0 and G1 lines?
G0 and G1 define linear moves. X, Y, and Z set the target position; E controls extruder motion; F sets feed rate in millimeters per minute. G90/G91 switch axis positioning and M82/M83 switch extrusion between absolute and relative mode, so a move cannot be interpreted correctly without the active modes.
How are layers identified in G-code?
Slicers can mark layers with comments such as `;LAYER:` or `;LAYER_CHANGE`. When those comments are absent, increasing Z values on extrusion moves can identify layer boundaries. Variable layer height requires sorting actual extrusion heights instead of assuming one fixed Z increment.
What should a G-code preview verify before printing?
Check that the first layer stays inside the build plate, the last layer reaches the expected height, no layers disappear, and travel paths do not contain unexpected long jumps. QR64Code's 4 August 2026 test file contained 64,882 lines, 364 layers, and a 72.9 mm height; the viewer placed the first and last layer in the same file sequence.
Frequently asked questions
Does the E value always equal filament used?
No. Retractions, reprimes, and G92 resets must be accounted for; filament use comes from positive extrusion deltas or a slicer summary.
Does every Z move start a new layer?
No. Z-hop temporarily changes height during travel. Layer detection should combine extrusion, slicer comments, and persistent Z levels.