# Gコード ビューア

> Gコードファイルを開くと、各行がどんな動きになるかが分かります。プログラムの一覧は工具の動きに合わせてスクロールし、現在の行が3Dツールパス上で強調表示されます。行をタップすれば、その行が何をするのかを正確に確認できます。円弧、単位、送り速度も順にチェックします。

Human page: https://unmakelabs.com/ja-jp/gcode-viewer/. This is the version for AI agents.

## What it does

Gコード ビューアで、Gコードを1行ずつ図として読む。 Gコードファイルを開くと、各行がどんな動きになるかが分かります。プログラムの一覧は工具の動きに合わせてスクロールし、現在の行が3Dツールパス上で強調表示されます。行をタップすれば、その行が何をするのかを正確に確認できます。円弧、単位、送り速度も順にチェックします。

## Gコード ビューアで分かること

Gコードは多くのCNC工作機械で使われている言語です。G0は早送り、G1は直線切削、G2とG3は円弧切削、X・Y・Zは目標位置、Fは送り速度を表します。Gコード ビューアはこれらの行を工具が通る経路に変換するので、頭の中で座標を思い描かなくても、形状を目で見て各行を前後の流れの中で理解できます。

## こんな方に

Gコードを学んでいる方、デバッグしている方に。見習いや学生、Grbl・Mach3・LinuxCNCでCNCルーターやフライス盤を使う趣味の方、手書きやスクリプトでGコードを作成する方、ポストプロセッサが厄介な1行をどう出力したか確認したいプログラマーの方などに向いています。

## Facts

- **1行ずつ確認:** プログラム一覧とツールパスが双方向に連動：行または経路上の点をタップ
- **対応コード:** G0-G3, G17/18/19, G20/21, G90/91, G90.1/91.1, G4, G28/G53, G41/42, G43, G54-59, G81-89, G92-95, M3-M9, M6, M98/M99
- **チェック項目:** 円弧の終点が円周上にあるか、R指定の円弧が短すぎないか、送り速度の指定漏れ、単位の指定漏れ、不明なワード
- **ダウンロード:** PNG、原寸（1:1）の平面図SVG、概要JSON

## How a person does it

1. **ファイルを開く.** .gcode、.nc、.ngc、.tapファイルをドロップするか、選択するか、リンクを貼り付けます。ファイルはアップロードされません。
2. **1行ずつ進める.** ◀ ▶ ボタンまたは矢印キーで1行ずつ進めます。現在の行はスライダーの上に表示され、経路上ではオレンジ色で強調表示されます。再生ボタンを押すと、全体が約30秒に収まる速度で動きを再生します。
3. **問題のある行を見つける.** 警告では、問題ごとに分かりやすい言葉と行番号を表示します。タップするとその行へ移動します。一覧では該当する行が黄色または赤で示されます。

## Open a file by link (works today)

The viewer runs in a browser. Any public file URL can be opened by adding `?src=` (URL-encoded): `https://unmakelabs.com/ja-jp/gcode-viewer/?src=https://unmakelabs.com/apps/nc/samples/bracket.nc`. The host must allow cross-origin reads (GitHub raw, most object storage and CDNs do). A camera view can be added after `#`: `#t=0.5&v=px,py,pz,tx,ty,tz&r=0&u=mm&rr=10000` (t position in machining time 0 to 1, default 1 = whole program; v camera; r=0 hides rapids; u units when the file states none; rr rapid rate in mm/min for the time estimate).

Embed: `<iframe src="https://unmakelabs.com/embed/nc/?src=<url-encoded file URL>" width="100%" height="480" style="border:0"></iframe>`.

## Send your own file (live)

`POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/nc_inspect/jobs?wait=25` with the file as multipart `file` (or JSON `file_base64` + `filename`, or `file_url`), API tool `nc_inspect`: Inspect a CNC program (G-code, Heidenhain). The same engine code as this page. No sign-up; Free: 5 full results per IP per day without a key (resets at 00:00 UTC); POST /v1/keys gives an instant key with 25 more full results (one-time, not renewed); each accepted correction adds 1 free call (up to 20 a month). Options (JSON in `options`): `rapid_mm_min`: rapid feed for the time estimate in mm/min (default 10000); `tool_change_s`: seconds per tool change (default 6).

```bash
# NC program: tools, extents, run time
curl -s -F "file=@part.nc" "https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/nc_inspect/jobs?wait=25"
```

## Good to know

Gコードはモーダルです。G1やG2は別の移動コードで置き換えられるまで有効なままなので、XとYだけの行は直前の移動を引き継ぎます。G2が有効なまま次の行に中心の指定がない場合、実際の制御装置は停止します。ビューアではこれを「中心のない円弧」として警告し、直線で描画します。G20もG21もないGコードファイルはミリメートルとして読み込み、インチに切り替えることもできます。

## Not done by this tool

- マクロ変数（#100）や角括弧内の式は評価しません
- 極座標（G16）、座標回転（G68）、スケーリング（G51）はまだ描画しません（一覧には表示されます）
- Gコードの編集はできません（編集にはテキストエディタをお使いください）

## Value

Opens an NC program (G-code: Fanuc, Haas, Mach3, Grbl, LinuxCNC and CAM post-processor output; Siemens Sinumerik and Heidenhain Klartext in part; 3D-printer G-code) in the browser with nothing to install and draws the 3D toolpath: cuts coloured per tool, rapids dashed, play and scrub with the running line highlighted in the listing. Reports the extents of the cutting moves, cutting and rapid travel, an estimated machining time from the programmed feeds (rapid rate and tool-change time adjustable), the tools with feeds, speeds and cutting time, and warnings with line numbers (arcs whose end is off the circle, missing feeds, missing units, unsupported codes, cycles and macros not drawn). Downloads a PNG, a 1:1 plan-view SVG and a JSON summary. Free, no sign-up.

## When it fits

- A machinist or setter wants to see what an NC program will do before running it, on a phone or shop PC with no CAM seat: shape, depth, extents against the stock, tools and roughly how long it takes.
- A CAM programmer wants to check post-processor output (arc format, units, tool changes, drilling cycles, feeds) or find the line that makes a control alarm on an arc.
- Someone has a .nc, .tap, .gcode, .ngc or .cnc file from a customer, a forum or a hobby CNC router and wants to know what it cuts, how big and in which units.

### When not

- Collision checking against the machine, fixtures or the stock model, material removal simulation, or verified cycle times on a specific machine (acceleration is not modelled): use the CAM's or the control's own simulation.
- Programs built mostly from macro variables, loops or control-specific cycles (Fanuc Macro B, Heidenhain Q parameters and CYCL DEF, Sinumerik CYCLE pockets): these parts are listed as warnings, not drawn.

## Why use it instead of the alternatives

- Nothing to install: the page opens a public NC program from a link (?src=, with #t= for the point in the program and #v= for the camera) and an embed shows the toolpath in any page.
- NCViewer (ncviewer.com) draws G-code locally in the browser with an editor, line stepping, 5-axis and lathe modes; its side panels are the code editor, a position readout and machine options (checked Dec 2026), with no tool list with feeds, speeds and per-tool times and no list of problems with line numbers. CAMotics and desktop editors such as CIMCO Edit need installing (CIMCO is paid); controls and CAM systems simulate only for their own users.
- This viewer: free in any browser incl. phones, nothing uploaded, line-by-line playback, tool list with feeds/speeds/times, plain warnings with line numbers (arcs a control would reject, missing units or feeds, codes not drawn), Heidenhain and Sinumerik read in part, plan-view SVG at 1:1, share link and embed.

### What rebuilding it would take

- Write a reader that handles modal G-code state (motion, plane, absolute/incremental, units, feed modes), arcs by I/J/K and by R including >180° and full circles, helical arcs, drilling cycles G81-G89 with G98/G99, subprograms (M98/M99, M97) and Sinumerik/Heidenhain variants.
- Draw millions of segments smoothly on a phone, scrub by machining time, highlight the running line, and time every move from its feed.
- Explain every unsupported code or broken arc in plain words with its line number, and export a scale-true plan view.
- A set of hand-worked test programs with known lengths, extents and times to keep the reader honest as dialects are added.

## Quality

No score published; the limits above say what it does not do. Check results that matter before you rely on them.

## Risk for the user

- Free and unlimited; no sign-up, no ads.
- A viewer, not a machine simulation: it does not check collisions, and some codes are not drawn (listed as warnings). Prove out every program on the machine as usual.

_Status: the NC viewer page works; agents send their own file to POST https://y64b3d8qbc.execute-api.eu-central-1.amazonaws.com/v1/nc_inspect/jobs?wait=25._

## Privacy

- Files opened in the page are read on the user's device and not uploaded unless the user clicks Share.
- Files opened by link (?src=) are fetched from where they are stored.
- The page loads three.js from a public code server, which receives the visitor's IP address for that request.

## Data

ブラウザ内で開きます。共有しない限り、ファイルはお使いのデバイスから出ません。共有したファイルは30日間保管されます。

## FAQ

- **G2とG3の違いは何ですか？** 平面を上から見て（G17では+Z方向から）、G2は時計回り、G3は反時計回りに円弧を切削します。中心はI・J・K（初期設定では始点からの相対値）で、または半径をRで指定します（180°を超える円弧はRを負の値にします）。ビューアはどちらの形式も描画し、終点が円周上にあるかをチェックします。
- **Gコードが極端に小さく、または大きく表示されるのはなぜですか？** 多くの場合は単位が原因です。G20はインチ、G21はミリメートルを意味します。どちらも指定されていないファイルは、ミリメートルとして読み込み、ワンタップでインチに切り替えられます。また、古いファナックの制御装置では、小数点のない数値を1000分の1単位として読みます（X10 = 0.010 mm）。CAMソフトは常に小数点を出力するため、これが問題になることはまれです。
- **機械では動く円弧が警告されるのはなぜですか？** 各円弧は制御装置と同じ方法でチェックしています。終点は中心（I/J/K）の周りの円周上に、0.0127 mmまたは半径の0.1%以内の誤差で位置している必要があり、R指定の円弧は弦の長さの半分より短くできません。許容誤差は制御装置によって異なる（パラメータで設定）ため、警告された円弧でも実際には動く場合があります。ただし、ポストプロセッサが出力した円弧で機械がアラームを出したときは、まずここを確認してください。すべての円弧がインクリメンタルのI/Jでは不合格でも、アブソリュートの中心座標なら合う場合は、ビューアが自動で切り替えてその旨を表示します。
- **本当に無料ですか？** はい。ファイル数の制限、広告、登録、有料プランはありません。200 MBまでのプログラムを開けます。
- **プログラムはアップロードされますか？** 共有した場合のみです。共有したファイルはリンクが使えるよう30日間保管され、いつでも削除できます。それ以外の場合、プログラムやお客様の部品の情報は外に出ません。
- **AIエージェントでNCプログラムを読めますか？** エージェントは公開されているプログラムをリンクでこのビューアーに開き（このページに?src=とファイルのアドレスを付けます）、「ダウンロード」＞「概要（JSON）」で概要を読み取れます。同じ概要をデータで返すAPIも予定しています。
- **運営者は？** Unmake Labsです。お問い合わせ：hello@unmakelabs.com

## Related pages

- [NCプログラム ビューア](https://unmakelabs.com/ja-jp/nc-viewer/)
- [.tapファイル ビューア](https://unmakelabs.com/ja-jp/tap-file-viewer/)
