Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

G-CODE

1. G-Code (Geometry code)


 G0: Rapidly moves the nozzle from one position to another through a straight line without
laying down any filament.
o G0 X0 Y0 Z0 F100: move the printhead rapidly to the origin at 100mm/s
o G0 X1 Y2 Z3: move the printhead rapidly to the position (1,2,3) at the feed rate from
the last G1 command if left out.
 G1: Moves the printer from one point to another on the build plate in a linear path.
o G1 X32 Y04 F50 E10: lay 10 unit of filament down in a straight line between the
current position to the position (32,4) (relatively or absolutely) at a rate of 50mm/s.
o If there is no feed rate or speed of the printhead, the printer will automatically use
the feed rate from the last G1 command if left out.
 G2: tells the machine to move clockwise in a circular pattern clockwise, with a defined
center of rotation.
o G2 X5 Y5 I2 J-2: move clockwise form the current position to the position (5,5)
(relatively or absolutely), with the center of rotation 2 unit from the right and 2 unit
from beneath the (always) current position.
 G3: tells the machine to move clockwise in a circular pattern counter-clockwise, with a
defined center of rotation.
o G3 X5 Y5 I2 J-2: move counter-clockwise form the current position to the position
(5,5) (relatively or absolutely), with the center of rotation 2 unit from the right and 2
unit from beneath the (always) current position.
 G4: Pauses the machine for a set period. During the pause, the machine still maintains its
state.
o G4 S10: pause the printer for 10 seconds
o G4 P10: pause the printer for 10 miliseconds
 G17: Select the XY plane as the working plane (default)
 G18: Select the XZ plane as the working plane
 G19: Select the YZ plane as the working plane
 G20: Sets the printer’s firmware to interpret all units as inches (including speed and
acceleration).
 G21: Sets the printer’s firmware to interpret all units as milimeters (including speed and
acceleration).
 G28: Homes the printer to establish a known location at the origin.
o G28 X Z: home only the X and Z axes
o G28: home all the axes
o G28 X5 Y5 Z5: home all the axes but pass through the point (5,5,5) before going to
the reference point.
 G90: Sets the printer to absolute positioning mode meaning all coordinates in the G-Code
are interpreted as positions in the XYZ plane relative to the printer’s origin. It also sets the
extruder to absolute mode unless the M83 command overrides it.
 G91: Sets the printer to relative positioning mode meaning all coordinates in the G-Code are
interpreted as positions in the XYZ plane relative to the current position. It also sets the
extruder to relative mode unless the M82 command overrides it.
 G92: Sets the current position as the specified coordinates.
o G92 X0 Y0 Z0: Set the current position as the origin and the new coordinate is based
on this origin.
o G92 X1 Y2 Z3: Set the current position as the position (1,2,3).
o G92 E0: Set the current position of the extruder to its origin.

2. M-Code (Miscellaneous commands)


 M0/M1: unconditional stop
o M0 P2000/ M1 P2000: sleep for 2000ms
o M0 S2/ M1 S2: sleep for 2s
 M81: Shuts down the printer’s PSU (power supply unit): all the heaters, motors, etc. will not
be able to work. If the board doesn’t have any alternative source of power, it also shuts
down
 M82: Puts only the extruder in absolute mode. Overriding G90 and G91 command written
before.
o Can be overriden by G90 and G91 written after.
o M82;
G1 X0.1 Y200.0 Z0.3 F1500.0 E15; Extruding 15 unit of filament
G1 X0.4 Y20 Z0.3 F1500.0 E30; Then, extruding 30 unit of filament
 M83: Puts only the extruder in relative mode. Overriding G90 and G91 command.
o Can be overriden by G90 and G91 written after.
o M82;
G1 X0.1 Y200.0 Z0.3 F1500.0 E15; Extruding 15 unit of filament
G1 X0.4 Y20 Z0.3 F1500.0 E30; Then, extruding 30-15=15 unit of filament
 M84: Disables one or more of the stepper and extruder motors
o M84 S10: disables all the steppers after being inactive for 10 seconds.
o M84 X Y: immediately idles the X and Y motors.
o M84: immediately idles all motors.
 M85: Shuts down the printer and firmware after a period of inactivity.
M85 S300: shut down the printer after it’s idle with no movement for 5 minutes
 M104: Heats up the nozzle, then immediately moves on to run other G-Code commands
while the hotend heats up in the background.
o M104 S200 T0: heat the first nozzle of a dual-extruder machine up to 200°C
o M104 S180 T1 B200: heat the second nozzle of a dual-extruder machine up to 180°C
and 200°C is the maximum temperature the hotend is allowed to reach.
 M106: Turns on the printer’s fan and sets its speed.
o M106 S255: set the nozzle cooling fan to 100% speed
o M106: set the nozzle cooling fan to 100% speed
o M106 S127 P1: set the second nozzle cooling fan to 50% speed
 M107: Shuts down one of the printer’s fans at a time
o M107: shuts down the print cooling fan
o M107 P1: shuts down the second print cooling fan
 M109: Heats up the nozzle, and wait until the temperature reached before moving on to run
other G-Code commands. (S only wait for heating, not for cooling. As for cooling and waiting,
use R)
o M109 S200 T0: heat the first nozzle of a dual-extruder machine up to 200°C
o M109 R40 T1: cool the second nozzle of a dual-extruder machine down to 40°C
 M125: Pauses the print and parks the printhead in a pre-configured parking location. It also
saves the nozzle’s current position to memory before parking.
o M125 X0 Y0 Z0 L9: park the nozzle at the origin and retract 9mm of filament
 M140: Sets a target temperature for the bed and continues executing other G-Code lines
immediately.
o M140 S80: heat the bed up to 80°C
 M190: Sets a target temperature for the bed and waits until the bed reaches it. (S only wait
for heating, not for cooling. As for cooling and waiting, use R)
o M190 R50: cool the bed down to 50°C
 M400: pauses the G-Code processing queue until all the current moves in the buffer are
complete. The processing queue waits in a loop till all the commands are completed.
M400 pauses processing until all the current moves are done
M81 shuts down the 3D printer

You might also like