How to create a G-code?


Editorial team Published on

You can create a G-code file by converting a 3D model or vector graphic using slicing or CAM software like Ultimaker Cura.

Steps to Make a G-code File for 3D Printing

  • Install a Slicer: Download and open a free 3D slicing program like Ultimaker Cura or PrusaSlicer.
  • Import Your Model: Load your 3D digital file (usually an .stl or .obj format) into the software.
  • Configure Settings: Choose your specific printer model, filament type (like PLA), layer height, and infill percentage.
  • Slice the Model: Click the Slice button. The software will convert your 3D shape into individual 2D layers and calculate the machine movements.
  • Export and Save: Save or export the final output as a .gcode file to your computer or removable SD/USB drive.

Alternative Methods for CNC and Lasers

If you are using a CNC milling machine or laser cutter instead of a 3D printer, the process is similar but uses CAM software (such as Fusion 360, FreeCAD, or Inkscape for plotters) rather than a standard 3D printer slicer. You import your vector or CAD design, define the tool paths, and use a machine-specific post-processor to export the G-code.