Geo2Gcode: From 3D Geometry to CNC Programs through Structured Machining Primitives
Organizations: IPAI, Seoul National University · Dept. of ECE & ASRI, Seoul National University
Abstract
Turning a 3D shape into a Computer Numerical Control (CNC) program is still largely manual. For every part, a machinist chooses setups, tools, step-downs, and toolpath patterns. We present Geo2Gcode, which converts a target mesh directly into standard G-code through structured machining primitives. Each primitive couples an indexed machining direction, a closed per-view reconstruction of the target, and explicit tool-radius, layer-height, and clearing-pattern parameters, and compiles deterministically into layerwise toolpaths via signed-distance queries. Most of the fidelity comes from this compiler. A lightweight selector trained with a voxel stock simulator fills in primitive parameters without per-part manual settings, approaching the finest fixed setting at about a quarter of its toolpath length. In simulation on ABC parts, Geo2Gcode reaches roughing fidelity comparable to an expert-tuned commercial CAM setup with a moderately longer toolpath, and clearly improves on a default CAM configuration. Generated programs run in a commercial G-code simulator, and one part is machined on a physical CNC mill. These results demonstrate that roughing programs can be generated directly from geometry without per-part CAM tuning.
Figures & tables
| Method | Tuning | ABC | ShapeNet | ||||||
|---|---|---|---|---|---|---|---|---|---|
| IoU | F1 | CD | NC | IoU | F1 | CD | NC | ||
| CSG-Stump [ 27 ] | ✓ | 0.787 | 0.879 | 0.428 | 0.884 | 0.697 | 0.827 | 0.521 | 0.866 |
| ExtrudeNet [ 28 ] | ✓ | 0.769 | 0.875 | 0.505 | 0.871 | 0.607 | 0.773 | 0.918 | 0.844 |
| CAPRI-Net [ 38 ] | ✓ | 0.768 | 0.866 | 0.312 | 0.914 | 0.700 | 0.824 | 0.447 | 0.895 |
| SECAD-Net [ 21 ] | ✓ | 0.776 | 0.867 | 0.398 | 0.900 | 0.650 | 0.784 | 2.405 | 0.852 |
| CNC-Net [ 36 ] | ✗ | 0.780 | 0.889 | 1.127 | 0.864 | 0.698 | 0.817 | 2.154 | 0.844 |
| Method | IoU | F1 | CD | NC |
|---|---|---|---|---|
| CSG-Stump | 0.751 | 0.856 | 0.645 | 0.858 |
| ExtrudeNet | 0.735 | 0.852 | 0.743 | 0.842 |
| CAPRI-Net | 0.728 | 0.846 | 0.624 | 0.883 |
| SECAD-Net | 0.742 | 0.845 | 0.765 | 0.872 |
| CNC-Net | 0.772 | 0.884 | 1.204 | 0.858 |
| Ours | 0.827 | 0.899 | 0.525 | 0.910 |
| Parameter policy | IoU | F1 | CD | NC | T |
|---|---|---|---|---|---|
| Random | 0.781 | 0.863 | 0.905 | 0.521 | 533.5 |
| Fixed (fine) | 0.856 | 0.917 | 0.427 | 0.936 | 1634.0 |
| Fixed (coarse) | 0.718 | 0.818 | 0.666 | 0.853 | 129.1 |
| Fixed (const. triple) | 0.788 | 0.897 | 0.583 | 0.901 | 1219.0 |
| Fixed (const. triple, alt.) | 0.793 | 0.872 | 0.574 | 0.923 | 627.4 |
| Greedy sim. search | 0.821 | 0.907 | 0.471 | 0.918 | 641.3 |
| Method | IoU | F1 | CD | NC | T |
|---|---|---|---|---|---|
| MeshCAM (non-expert) | 0.783 | 0.854 | 1.474 | 0.868 | 1488.6 |
| MeshCAM (expert) | 0.833 | 0.904 | 0.555 | 0.910 | 375.7 |
| Ours (no tuning) | 0.837 | 0.907 | 0.493 | 0.914 | 451.3 |
| Ours (5-ep. tuning) | 0.848 | 0.912 | 0.460 | 0.922 | 423.1 |
| Ours, axis-aligned | 0.834 | 0.905 | 0.501 | 0.920 | 451.6 |
| Metric | 6-axes | Rand(5) | Rand(6) | Ours | |
|---|---|---|---|---|---|
| Coverage | ABC | 92.67 | 83.52 | 89.11 | 96.42 |
| ShapeNet | 91.27 | 79.77 | 84.73 | 92.75 |
| Proxy | Non-exp. | Expert | Ours |
|---|---|---|---|
| Gouge 0.1 mm (%) | 89.61 | 92.31 | 98.57 |
| Mean P95 overcut (mm) | 0.249 | 0.262 | 0.217 |
| Local dim. variation | 0.678 | 0.726 | 0.228 |
| Junction angle ( ∘ ) | 52.4 | 39.9 | 27.1 |
| Curvature consistency | 1.15 | 7.57 | 0.69 |
| Accel. violation rate | 1.8e-6 | 4.0e-4 | 1.3e-5 |
| Excluded | IoU | F1 | CD | NC | T |
|---|---|---|---|---|---|
| Spiral | 0.797 | 0.876 | 0.615 | 0.911 | 508.1 |
| Periphery | 0.806 | 0.882 | 0.565 | 0.914 | 529.0 |
| Zigzag | 0.811 | 0.886 | 0.611 | 0.917 | 441.3 |
| Contour | 0.756 | 0.849 | 0.891 | 0.847 | 444.4 |
| None (Ours) | 0.848 | 0.912 | 0.460 | 0.922 | 423.1 |
| Method | IoU | F1 | CD | NC |
|---|---|---|---|---|
| CNC-Net (per-shape tuned) | 0.630 | 0.765 | 1.234 | 0.780 |
| Ours (zero-shot) | 0.770 | 0.866 | 0.710 | 0.859 |
| Excluded | IoU | F1 | CD | NC | T |
|---|---|---|---|---|---|
| 0.792 | 0.871 | 0.603 | 0.903 | 413.6 | |
| 0.851 | 0.914 | 0.456 | 0.921 | 774.8 | |
| None (Ours) | 0.848 | 0.912 | 0.460 | 0.922 | 423.1 |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| ABC 7K | ABC 15K | |||
|---|---|---|---|---|
| Method | Acc. | F1 | Acc. | F1 |
| DeepMill | 96.3 | 97.2 | 96.3 | 97.3 |
| Ours | 96.5 | 98.2 | 96.8 | 98.4 |
| Method | Path Smoothness ( ∘ ) | Curv. consistency | G1 segment-length std. (mm) | Accel. violation |
|---|---|---|---|---|
| MeshCAM (non-expert) | 52.4 9.6 | 1.15 0.25 | 12.28 7.21 | 1.77e-6 |
| MeshCAM (expert) | 39.9 17.3 | 7.57 12.2 | 8.23 4.12 | 4.0e-4 |
| Ours | 27.1 14.2 | 0.69 0.24 | 7.75 2.88 | 1.32e-5 |
| Method | Local dim. variation | Gouging tol. mm (%) | Gouging tol. mm (%) | Mean per-part P95 overcut (mm) |
|---|---|---|---|---|
| MeshCAM (non-expert) | 0.678 | 89.61 | 90.03 | 0.249 |
| MeshCAM (expert) | 0.726 | 92.31 | 92.53 | 0.262 |
| Ours | 0.228 | 98.57 | 99.29 | 0.217 |
| Resolution | Smooth | IoU | F1 | CD | NC | T |
|---|---|---|---|---|---|---|
| ✓ | 0.810 | 0.886 | 0.686 | 0.912 | 397.6 | |
| ✓ | 0.824 | 0.889 | 0.585 | 0.912 | 409.3 | |
| ✓ | 0.848 | 0.902 | 0.493 | 0.914 | 423.1 | |
| ✗ | 0.826 | 0.898 | 0.530 | 0.893 | 442.5 |
| Method | IoU | F1 | CD | NC |
|---|---|---|---|---|
| 6-axes | 0.792 | 0.876 | 0.711 | 0.881 |
| Rand(5) | 0.740 | 0.839 | 0.710 | 0.869 |
| Rand(6) | 0.751 | 0.846 | 0.700 | 0.873 |
| Ours | 0.848 | 0.912 | 0.460 | 0.922 |
| Method | Training budget | Total pretraining time (h) |
|---|---|---|
| CSG-Stump | 1000 epochs | 80 |
| ExtrudeNet | 1000 epochs | 60 |
| CAPRI-Net | 1000 epochs | 9 |
| SECAD-Net | 1000 epochs | 8 |
| CNC-Net | 100 epochs | 50 |
| Ours | 2,000 episodes | 30 |
| Method | Fine-tuning time per sample |
|---|---|
| CSG-Stump | 60 min |
| ExtrudeNet | 30 min |
| CAPRI-Net | 3 min |
| SECAD-Net | 3 min |
| CNC-Net | 50 min |
| Ours | 10 min |
| Selector | Terminal IoU | Time proxy |
|---|---|---|
| Uniform random (expectation) | .5938 | 884.7 |
| Learned (five seeds) | .7457 | 1258.5 |
| Frozen heuristic | .7517 | 1492.8 |
| Validation-selected fixed | .7682 | 945.5 |
| Retrospective oracle | .7834 | 1057.3 |
Manufacturing
Manufacturing research develops methods and systems to design, plan, automate, monitor, and improve industrial production.
See all 87 papers