0
0
3D Printingknowledge~10 mins

Common G-code commands (G0, G1, G28, M104, M106) in 3D Printing - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Common G-code commands (G0, G1, G28, M104, M106)
Start
Read G-code command
Match command type
Move fast
Update position
Next command or End
The flow shows how a 3D printer reads each G-code command and executes actions like moving, homing, heating, or controlling the fan.
Execution Sample
3D Printing
G28
M104 S200
G1 X50 Y25.3 F1500
M106 S255
G0 X0 Y0
This sequence homes the printer, sets extruder temp to 200°C, moves slowly to X50 Y25.3, turns fan on full speed, then moves fast to X0 Y0.
Analysis Table
StepCommandActionParametersResult
1G28Home all axesNonePosition reset to X0 Y0 Z0
2M104 S200Set extruder tempS=200Extruder heating to 200°C
3G1 X50 Y25.3 F1500Move with controlled speedX=50, Y=25.3, F=1500Position moves to X50 Y25.3 at speed 1500
4M106 S255Turn fan onS=255Fan set to maximum speed
5G0 X0 Y0Move fastX=0, Y=0Position moves quickly to X0 Y0
6EndNo more commandsNoneExecution stops
💡 All commands executed; no more commands to process.
State Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4After Step 5Final
PositionX?, Y?, Z?X0, Y0, Z0X0, Y0, Z0X50, Y25.3, Z0X50, Y25.3, Z0X0, Y0, Z0X0, Y0, Z0
Extruder TempRoom tempRoom temp200°C heating200°C heating200°C heating200°C heating200°C heating
Fan SpeedOffOffOff255 (max)255 (max)255 (max)255 (max)
Key Insights - 3 Insights
Why does G28 reset the position to zero?
G28 homes all axes, moving them to their physical zero points, so the printer knows its exact starting position (see Step 1 in execution_table).
What is the difference between G0 and G1 commands?
G0 moves the print head quickly without extruding, while G1 moves at a controlled speed and usually extrudes material (see Steps 3 and 5).
How does M104 affect the printer during printing?
M104 sets the extruder temperature but does not wait for it to reach the target; heating happens in the background (Step 2).
Visual Quiz - 3 Questions
Test your understanding
Looking at the execution_table, what is the printer's position after Step 3?
AX50, Y25.3, Z0
BX0, Y0, Z0
CX?, Y?, Z?
DX100, Y100, Z0
💡 Hint
Check the 'Position' variable in variable_tracker after Step 3.
At which step does the fan turn on to maximum speed?
AStep 2
BStep 4
CStep 5
DStep 3
💡 Hint
Look at the 'Fan Speed' variable in variable_tracker and the 'Action' column in execution_table.
If the command M104 S200 was changed to M104 S220, what would change in the execution_table?
AFan speed changes to 220
BPosition resets to X220 Y0 Z0
CExtruder heating to 220°C instead of 200°C
DNo change at all
💡 Hint
M104 controls extruder temperature; see Step 2 in execution_table.
Concept Snapshot
Common G-code commands:
G0 - Move fast without extrusion
G1 - Move controlled with extrusion
G28 - Home all axes (reset position)
M104 - Set extruder temperature (non-blocking)
M106 - Control fan speed
Used to control 3D printer movements and settings step-by-step.
Full Transcript
This visual execution shows how common G-code commands control a 3D printer. The printer reads each command in order: G28 homes the axes to zero position, M104 sets the extruder temperature to 200°C, G1 moves the print head slowly to X50 Y25.3, M106 turns the fan on at full speed, and G0 moves the head quickly back to X0 Y0. Variables like position, extruder temperature, and fan speed update after each command. Key points include understanding that G28 resets position, G0 moves fast without extrusion, G1 moves with controlled speed and extrusion, M104 sets temperature without waiting, and M106 controls the fan. The quiz questions help reinforce these steps by asking about position after moves, when the fan turns on, and effects of changing temperature commands.