NC to GLB: Preview a CNC Toolpath in 3D Viewers
Upload a CNC .nc program and get a GLB mesh that traces every cutting move as a thin tube along the tool centerline. Expect it to open lying on its back and far larger than the part, because GLB assumes Y-up and meters while your program uses Z-up machine units.
Download Started!
How would you rate your experience with MiConvert?
Why turn an NC program into GLB
A .nc file is a G-code program for a mill, router or laser: a list of motion commands and coordinates that a controller executes. It contains no surface, so web viewers such as three.js, Babylon.js or Google's model-viewer have nothing to draw. GLB, the single-file binary version of glTF, is the format those viewers load directly, which makes it a practical way to share or embed a picture of a toolpath without CAM software on the other end.
The conversion runs on our servers as a Python job. Feed moves (G1, G2, G3, plus lines that carry only coordinates) form the path, lines marked G0 are skipped, and the plunge from clearance height into the first cut is kept. Because the reader does not track modal motion, a coordinate-only line that follows a G0 counts as a feed move, so modal rapids show up in the GLB as cuts. G90, G91 and G92 are applied in order, as a controller would apply them. The path is then marked in a voxel grid, and marching cubes builds a closed tube around it at a fixed 0.2 mm radius before the mesh is written out as GLB.
Coordinates keep their programmed values, with no re-centering, although the surface is snapped to the voxel grid. Several things do not survive. Arcs use only their end points, so a G2 or G3 curve becomes a straight chord, and a full circle written as one arc disappears. G20 inch programs are not scaled. Rotary A, B and C words, tool changes, cutter compensation, work offsets, canned drilling cycles, feeds, spindle speed and laser power are not interpreted. The tube radius has nothing to do with your cutter, so the GLB shows where the tool center went, not the finished part or the removed material. It is one merged mesh with no material or color.
Orientation and scale need attention in this format. GLB is defined as Y-up and in meters, but the numbers from a Z-up millimeter program are copied in unchanged. A 300 mm job opens lying on its back as a 300-unit object, which an AR viewer would treat as something 300 meters wide.
This suits people who want to show a toolpath on a product page or in a forum post, check a program's overall travel at a glance, or send a colleague something that opens on a phone. Large jobs come out coarse, because the grid cell is at least 0.3 mm and grows to one 250th of the longest side, so fine detail on a 1 m router job will not be visible.
How to convert NC to GLB
- Confirm the file is a G-code program saved as .nc or .cnc. Controller extensions such as .tap, .ngc or .mpf are not accepted, so save a copy with the .nc extension.
- Open it in a text editor and check that cutting moves use G1, G2 or G3 and that no line outside a comment contains an E word.
- Upload the file. Guests can send up to 50 MB per file and up to 10 files at once.
- Let the server trace the feed moves, build the tube mesh and write the GLB.
- Download the result within about 4 hours, then rotate it so the program's Z axis points up and scale it by 0.001 if you need true size in a viewer or AR scene.
What the NC to GLB converter does
- Reads CNC programs with the .nc or .cnc extension
- Skips lines marked G0 and keeps G1, G2 and G3 feed moves plus the plunge into the first cut. Coordinate-only lines that follow a G0 are still drawn as cuts, so have your post-processor repeat G0 on every rapid line.
- Applies G90 absolute, G91 incremental and G92 position resets while tracing the path
- Builds a closed surface around the path with marching cubes at a 0.2 mm tube radius, with normals fixed
- Delivers one self-contained binary GLB, and refuses an empty mesh with an error instead of sending it
- Per-file limits from 50 MB for guests up to 1 GB on Pro, with batches of 10 to 50 files depending on plan
Video Tutorial
Convert NC to GLB on any device — PC, Mac, iPhone, or Android! 🔗 https://miconvert.com/en/nc-to-glb?utm_source=youtube&utm_medium=social&utm_campaign=nc-to-glb No app needed! Just visit MiConvert.c
NC to GLB questions
Why does my GLB open on its side and far too large?
The program's Z-up millimeter numbers are written straight into a format that viewers read as Y-up meters, and no axis or unit conversion is applied. Rotate the model so the original Z axis points up and scale it by 0.001 before using it in AR or next to other assets.
Should I choose GLB or glTF for a toolpath?
Choose GLB. The separate glTF output from this converter is currently delivered without its .bin buffer files, so viewers cannot load it. GLB keeps everything in one file and does not have that problem.
What does 'No movement/extrusion commands found in G-Code file' mean?
The parser found no cutting moves it could use. Common causes are a program with only G0 rapids, a file that is not G-code at all, a renamed binary file, or a CNC program containing an E word outside a comment, which makes it read as 3D-printer G-code. Upload the posted program itself and make sure cuts are written with G1, G2 or G3.
Why are my circles missing or my curves faceted?
Arc centers (I, J and R) are not read, so each G2 or G3 is drawn as a straight line to its end point, and a full circle whose start and end match produces nothing. If your CAM post-processor can output arcs as short line segments, use that option before converting.
My .nc file comes from steel detailing software. Will it work here?
Not on this page. DSTV steel files also use .nc, but they describe plates and profiles rather than toolpaths. Sent to GLB they produce a meaningless tiny mesh that is still reported as a success. Use the NC to DXF converter, which reads DSTV and returns a layered 2D drawing.
Why does a large router job look lumpy?
Mesh resolution depends on job size: the grid cell is the larger of 0.3 mm and the longest side divided by 250. A 500 mm sheet is sampled at 2 mm, so passes closer together than that merge into one blob. Splitting a big program into separate files per area gives each one a finer grid.
What happens to my file after conversion?
The program you upload is deleted as soon as the conversion finishes, and the GLB stays available to download for up to 4 hours before it is removed automatically. Transfers go over HTTPS through Cloudflare. The download link is a long random token rather than a one-time link, so anyone you share it with can use it until it expires. File names and basic job details such as size and outcome are logged.