G-code Viewer & XY Toolpath Preview
Paste G-code to resolve modal G0/G1/G2/G3 and G90/G91, preview the XY toolpath, and compute block counts, bounding box and path length.
Sample input is pre-filled and editable. Everything runs locally in your browser — nothing is uploaded.
Neutral band = rapid G0, yellow band = cutting feed; blue start / yellow end. Geometry preview only — not a substitute for machine simulation or a trial cut.
Blocks (first 12)
| LINE | CODE | MOTION | COMMENT |
|---|---|---|---|
| 001 | ( DEMO / square + arc ) | — | DEMO / square + arc |
| 002 | G21 G90 G17 | — | — |
| 003 | G0 X0 Y0 Z5 | G0 | — |
| 004 | G1 X10 Y0 F200 | G1 | — |
| 005 | G2 X20 Y0 I5 J0 | G2 | — |
| 006 | G1 X20 Y20 | G1 | — |
| 007 | G1 X0 Y20 | G1 | — |
| 008 | G1 X0 Y0 | G1 | — |
| 009 | M30 | — | — |
FAQ
The centre comes from I/J offsets; angles are normalised for CW (G2) or CCW (G3) and sampled into 24 segments. Preview only, not a controller interpolator.
Not yet. Blocks lacking I/J are listed with line numbers and an explicit warning; the preview falls back to straight lines and must not be used to judge the real toolpath.
Yes. The parser tracks G90/G91 and current position, accumulating incremental X/Y/Z offsets while preserving modal motion codes.
How to use
The article body below is currently available in full only in Chinese; the interface, titles, descriptions and FAQ follow your selected language.
- 粘贴或编辑 G 代码(默认带一段”方形 + 圆弧”示例)。
- 预览区以中性色带表示快速定位 G0、工业黄色带表示切削进给;工业蓝为起点、工业黄为终点。
- 统计区给出有效程序段数、G0/G1/G2/G3 次数、包围盒尺寸与 XY 路径总长,展开明细可看逐行解析结果。包围盒与长度只统计程序中真实出现的移动点,不会插入虚构的原点。
当前仅解析 XY 坐标做几何示意:支持 G0/G1/G2/G3、I/J 圆心增量、G90/G91;G17 等平面选择指令未做校验,R 半径格式、刀具半径补偿(G41/G42)、宏变量、固定循环与 G2/G3 的完整螺旋线均未实现,长度按 mm 假定。不能用于实际加工前的唯一校核,请以机床仿真与首件试切为准。