TOOL / CNC / GCODE-VIEWER

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.

Runs locally CNC Machining 刀路检查 #g代码查看器#gcode viewer online#刀路可视化
LIVE WORKBENCH / gcode-viewer

Sample input is pre-filled and editable. Everything runs locally in your browser — nothing is uploaded.

XY toolpath preview
X 0.0 … 20.0

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.

Active blocks9
Rapid G01
Cut G1/G2/G35
Bounding box20.00 × 20.00 mm
XY path length85.70 mm
Blocks (first 12)
LINECODEMOTIONCOMMENT
001( DEMO / square + arc )—DEMO / square + arc
002G21 G90 G17——
003G0 X0 Y0 Z5G0—
004G1 X10 Y0 F200G1—
005G2 X20 Y0 I5 J0G2—
006G1 X20 Y20G1—
007G1 X0 Y20G1—
008G1 X0 Y0G1—
009M30——
FAQ

FAQ

How are G2/G3 arcs rendered?

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.

Are R-format arcs supported?

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.

Is G91 incremental mode supported?

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.

  1. 粘贴或编辑 G 代码(默认带一段”方形 + 圆弧”示例)。
  2. 预览区以中性色带表示快速定位 G0、工业黄色带表示切削进给;工业蓝为起点、工业黄为终点。
  3. 统计区给出有效程序段数、G0/G1/G2/G3 次数、包围盒尺寸与 XY 路径总长,展开明细可看逐行解析结果。包围盒与长度只统计程序中真实出现的移动点,不会插入虚构的原点。

当前仅解析 XY 坐标做几何示意:支持 G0/G1/G2/G3、I/J 圆心增量、G90/G91;G17 等平面选择指令未做校验,R 半径格式、刀具半径补偿(G41/G42)、宏变量、固定循环与 G2/G3 的完整螺旋线均未实现,长度按 mm 假定。不能用于实际加工前的唯一校核,请以机床仿真与首件试切为准。

NEXT / RELATED TOOLS

Related tools

ALL IN SECTOR ↗