Introduction
The traditional workflow in additive manufacturing—moving from a conceptual sketch to a physical 3D-printed object—is often a complex and time-consuming process. It typically requires mastering Computer-Aided Design (CAD) software to create a 3D mesh, which is then processed by a "slicer" to generate G-code. G-code serves as the machine instructions that dictate the movement and extrusion parameters for the printer. This dependency on explicit 3D geometry and technical expertise creates a significant bottleneck for rapid prototyping.
Image2Gcode proposes a radical shift by treating manufacturing as a translation task. By leveraging generative AI, this framework transforms 2D images, such as sketches or photographs, directly into printer-ready toolpaths, bypassing the traditional CAD-to-slicer pipeline entirely.
Methodology
The core of Image2Gcode is a data-driven "image-to-instruction" paradigm utilizing a Denoising Diffusion Probabilistic Model (DDPM). The framework treats G-code generation as a sequence modeling problem.
Architecture Components
- Vision Encoding: The system employs a pre-trained, frozen DinoV2 (Vision Transformer) encoder to extract high-level semantic and geometric features from the input image.
- Diffusion Core: A 1D U-Net decoder serves as the generative engine. During training, the model learns to reverse a Gaussian noise process applied to G-code sequences. Conditioned on visual features from DinoV2, it iteratively denoises random data into a coherent toolpath.
- Representation: The model predicts sequences of (X, Y, E) keypoints, representing spatial coordinates and extrusion amounts, rather than raw text.
- Conditioning: Multi-scale cross-attention layers fuse visual cues with trajectory sequences, allowing the model to determine boundaries and appropriate infill patterns based on the input image.
Dataset and Evaluation
The model was trained on the Slice-100K dataset, which contains over 100,000 aligned pairs of 3D mesh slices and their corresponding G-code toolpaths. To test the system's robustness, researchers evaluated it on "out-of-distribution" real-world data, including hand-drawn sketches and photographs of physical objects like wooden bowls and makeup compacts.
Key Results
- Path Efficiency: Image2Gcode achieved a 2.40% reduction in mean travel distance compared to traditional heuristic slicers, resulting in faster print times by minimizing non-extruding movements.
- Emergent Infill Strategies: The model demonstrated an ability to "choose" between various valid infill patterns (e.g., honeycomb or rectilinear) to satisfy geometric constraints, proving that diffusion models can effectively handle the "many-to-one" mapping inherent in toolpath generation.
- Robust Generalization: Despite training on synthetic renders, the model successfully generated manufacturable G-code from messy, real-world inputs.
- Physical Validation: The generated designs were successfully 3D-printed using Material Extrusion (MEX), confirming that the AI-generated paths are structurally sound and physically viable.
Conclusion and Future Work
While Image2Gcode currently operates on a slice-by-slice basis—limiting it to "2.5D" geometries—it represents a significant step toward simplifying additive manufacturing. Future research aims to develop a hierarchical generation pipeline for complex 3D features and integrate Large Language Models (LLMs) to allow for natural language control over print parameters like strength and speed.
Summary updated