What Is G-Code in 3D Printing?

G-code is the instruction language your 3D printer speaks. Every movement, temperature change, and extrusion command comes from G-code. Here is what it is and how it fits into the printing workflow.

G-Code: The Language of 3D Printers

G-code (Geometric Code) is a numerical control programming language that originated in CNC machining in the 1950s. 3D printers adopted it as their instruction format. Every 3D printer — from a $200 Ender 3 to a $10,000 industrial machine — reads G-code to execute prints.

You almost never need to write G-code yourself. The slicer software generates it automatically from your 3D model and settings. But understanding what G-code is and what it contains helps demystify the printing workflow and makes troubleshooting more approachable.

What G-Code Actually Contains

Movement Commands

G0 and G1 commands tell the printer where to move the print head and at what speed. G0 is a rapid move (travel between print areas). G1 is a coordinated move with simultaneous extrusion. Every line of deposited plastic starts with a G1 command specifying X, Y, Z coordinates and extrusion amount.

Temperature Commands

M104 sets the hot end temperature. M140 sets the bed temperature. M109 and M190 are the waiting versions — they tell the printer to wait until the target temperature is reached before continuing. The startup section of every G-code file begins with these commands.

Fan and Extrusion

M106 controls the part cooling fan speed. E values in movement commands control how much filament the extruder feeds. The slicer calculates the exact E value for every move based on line width, layer height, and filament diameter.

The G-Code Workflow

The path from 3D model to finished print always passes through G-code:

1. You design or download a 3D model (STL or 3MF file).

2. You import the model into a slicer and configure settings like layer height, infill, and supports.

3. The slicer generates a G-code file. A typical 3D print generates a G-code file that is hundreds of thousands of lines long.

4. The G-code transfers to the printer via SD card, USB drive, or Wi-Fi depending on the machine.

5. The printer’s firmware reads and executes the G-code line by line, building the object from the first layer to the last.

When Bambu Studio processes an OreKo 3MF file, it generates a highly optimised G-code specific to your Bambu Lab printer model with acceleration profiles, pressure advance, and multi-colour tool changes all embedded in the file. The result is a print that runs closer to the printer’s mechanical limits than a generic slicer profile would achieve.

OreKo 3MF Files Generate Optimised G-Code Automatically

Open the 3MF file in Bambu Studio, slice, and the G-code is generated with all settings pre-configured.