Formalizing Linear Motion G-Code for Invariant Checking and Differential Testing of Fabrication Tools
Yumeng He, Chandrakana Nandi, Sreepathi Pai
Abstract
The computational fabrication pipeline for 3D printing is much like a compiler – users design models in Computer Aided Design (CAD) tools that are lowered to polygon meshes to be ultimately compiled to machine code by 3D slicers. For traditional compilers and programming languages, techniques for checking program invariants are well-established. Similarly, methods like differential testing are frequently used to uncover bugs in compilers themselves, which makes them more reliable. The fabrication pipeline would benefit from similar techniques but traditional approaches do not directly apply to the representations used in this domain. Unlike traditional programs, 3D models exist both as geometric objects (a CAD model or a polygon mesh) as well as machine code that ultimately runs on the hardware. The machine code, like in traditional compiling, is affected by many factors like the model, the slicer being used, and numerous user-configurable parameters that control the slicing process. In this work, we propose a new algorithm for lifting G-code (a common language used in many fabrication pipelines) by denoting a G-code program to a set of cuboids, and then defining an approximate point cloud representation for efficiently operating on these cuboids. Our algorithm opens up new opportunities: we show three use cases that demonstrate how it enables (1) error localization in CAD models through invariant checking, (2) quantitative comparisons between slicers, and (3) evaluating the efficacy of mesh repair tools. We present a prototype implementation of our algorithm in a tool, GlitchFinder , and evaluate it on 58 real-world CAD models. Our results show that GlitchFinder is particularly effective in identifying slicing issues due to small features, can highlight differences in how popular slicers (Cura and PrusaSlicer) slice the same model, and can identify cases where mesh repair tools (MeshLab and Meshmixer) introduce new errors during repair.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 2ef21167-bf9f-4cb1-bd9c-6abc307bcd61Cited by top-tier papers1
Ask how each one uses itBuilds on6
- Synthesizing structured CAD models with equality saturation and inverse transformationsChandrakana Nandi, Max Willsey, Adam Anderson, James R. Wilcox et al.PLDI 2020 · 65 citations
- babble: Learning Better Abstractions with E-Graphs and Anti-unificationDavid Cao, Rose Kunkel, Chandrakana Nandi, Max Willsey et al.POPL 2023 · 38 citations
- Imprimer: Computational Notebooks for CNC MillingJasper Tran O'Leary, Gabrielle Benabdallah, Nadya PeekCHI 2023 · 31 citations
- ShapeMOD: macro operation discovery for 3D shape programsR. Kenny Jones, David Charatan, Paul Guerrero, Niloy J. Mitra et al.SIGGRAPH 2021 · 24 citations
- Taxon: a Language for Formal Reasoning with Digital Fabrication MachinesJasper Tran O'Leary, Chandrakana Nandi, Khang Lee, Nadya PeekUIST 2021 · 9 citations
Related papers
- From Copy/Paste to Copying Pastes: Supporting Replication in an Online Digital Fabrication CommunityBlair Subbaraman, Nadya PeekCHI 2026 · 1 citation
- CADReview: Automatically Reviewing CAD Programs with Error Detection and CorrectionJiali Chen, Xusen Hei, Hongfei Liu, Yuancheng Wei et al.ACL 2025
- VisiPrint: Previewing 3D-Print Appearance from Real Material SamplesMaxine Perroni-Scharf, Faraz Faruqi, Sooyeon Ahn, Raul Hernandez et al.CHI 2026 · 1 citation
- SplatOverflow: Asynchronous Hardware TroubleshootingAmritansh Kwatra, Tobias M. Weinberg, Ilan Mandel, Ritik Batra et al.CHI 2025 · 12 citations
- G-ID: Identifying 3D Prints Using Slicing ParametersMustafa Doga Dogan, Faraz Faruqi, Andrew Day Churchill, Kenneth Friedman et al.CHI 2020 · 46 citations
