G code is a text format that drives CNC machines.
It is used by CAM software to design jobs by creating a new toolpath (center line) from vector format designs ie. DXF, EPS, DWG etc.
A reader (graphic viewer) would only use X & Y coordinates for a flat view, or X, Y & Z for a 3D representation of the G code toolpath.
The file parsing would omit all other text inputs except:
G0 (move with pen up)
G1 (move with pen down)
G2 (Clockwise arc: X & Y = arc endpoint, I = Arc center X, J = arc center Y)
One could use different colors and line type (dashed and solid) for the penup and pendown moves.
My problem is scaling the whole job onto the panel and how to handle the G2 (Arc).
--- G code ---
[Toolpath name: Profile 1]
[---= Begin Job =---]
G90
M3
G53 Z0
[End Mill (6 mm)]
G0X1.9685Y2.1654
G0Z0.2000
[End Mill (6 mm)]
G0
G0Z0.0000
G1Z-0.3937F47
G1Y5.7087F142
G2X2.1654Y5.9055I0.1969J0.0000
G1X9.6457
G2X9.8425Y5.7087I0.0000J-0.1969
G1Y2.1654
G2X9.6457Y1.9685I-0.1969J0.0000
G1X2.1654
G2X1.9685Y2.1654I0.0000J0.1969
[End Mill (6 mm)]
G0
G0Z0.2000
G0Z0.2000
M5
G53Z0
M2
---