Opens a G-code file and draws the whole print path in 3D, centered on a grid. Extrusion moves are green, travel moves blue and retractions red. Hold the left mouse button to rotate and scroll to zoom.
I print a lot in 3D and wanted to understand what a slicer actually sends to the printer. Instead of reading about it, I wrote a viewer: about 300 lines of C, raylib for the window and the 3D drawing, and a G-code parser of my own. It deliberately stays small. It reads G0 and G1 moves only, treats X, Y and Z as absolute, and draws the whole file at once without a layer view, which is enough to see a Benchy appear line by line.
Hand-Written Parser
Reads G0 and G1 moves, no libraries
Colour-Coded Moves
Extrusion green, travel blue, retraction red
Orbit Camera
Rotate with the mouse, scroll to zoom