G-code Reference Sheet Classic WorkBench

G-code Reference Sheet (Classic WorkBench)


G-Code is the basic language of 3D printing.  A G-Code file provides a complete set of machine instructions which the printer needs to complete a part.  These files are generated by processing a 3D model using a slicing program such as Simplify3D, and are generally loaded onto the printer using a SD card, or a USB cable.

This page contains commonly used codes for the 3D Platform X1000 and 3D Platform WorkBench printers. Never enter G-Codes manually on your machine unless you have a complete understanding of what the code will do.



G Code
Usage
Example
G0/G1
Linear move.  Moves to coordinates XY (or Z) and extrudes E material at a speed of F
G1 X500 Y500 E50 F3600
G2
Clockwise arc move. Moves in an arc to coordinates XY, pivoting around relative coordinates IJ, extrudes E material between the two points at speed F
G3 X90 Y30 I13.5 J1 E20 F3600
G3
Counter-clockwise arc move.  Function is identical to G2 but reversed
G3 X50 Y50 J30 E10.34 F4800
G4
Dwell for duration P (Milliseconds) or S (seconds)
G4 S2
G20
Change coordinate mode to Inch
G20
G21
Change coordinate mode to millimeter (default)
G21
G28
Home axes.  G28 to home all, or specify XYZ
G28 XY
G90
Set moves to absolute positioning mode.  Moves will be in reference to machine zero
G90
G91
Set moves to relative positioning mode.  Moves will be in reference to last toolhead position
G91
G92
Override current tool position with given coordinates
G92 X50 Y50 Z1.34

M Code
Usage
Example
M0
Unconditional stop, Finishes buffered moves and shuts down. Machine will need to be reset
M0
M1
Conditional stop.  Finished buffered moves and shuts down. Machine may be woken up by sending additional GCode
M1
M17
Enables stepper motors (Extruders)
M17
M82
Set extruder to absolute mode. (Similar to G90)
M82
M83
Set extruder to relative mode. (Similar to G91)
M83
M84
Stop idle hold (disable stepper motors during periods of inactivity).  This command should only be used after a job is complete
M84
M92
Set axis steps per unit for axes X Y Z or E (extruder drive motor)
M92 X128.03 Y127.97
M104
Set extruder temperature to value S for toolhead T
M104 S200 T0
M105
Get extruder temperature.  This will write extruder temps to serial console/host program
M105
M106
Turn print cooling fan on to speed S (PWM value from 0-255)
M106 S255
M107
Turn print cooling fan off
M107
M108
Cancel heating.  This will cancel a heat-and wait cycle such as M109
M108
M109
Set extruder temperature to S and wait for temperature to stabilize before continuing
M109 S215
M112
Emergency stop.  Terminates moves, shuts down machine
M112
M114
Get current position.  Writes current position to serial console or host
M114
M115
Get current firmware version
M115
M117
Displays message on bottom line of LCD screen
M117 Hello World
M119
Get endstop status.  Used to check if axis home switches are triggering properly
M119
M120
Enable endstop detection
M120
M121
Disable endstop detection
M121
M140
Set bed temperature to S
M140 S70
M190
Set bed temperature to S and wait for temperature to stabilize before continuing
M190 S70
M201
Set maximum acceleration values for axes XYZ and E.  Vales are in mm/s^2
M201 X2300 Y2300 Z100 E2000
M206
Set home offset.  This is controlled from the LCD screen as Babystepping,  If a value is set, machine will home with G28, then apply offset given
M206 Z-0.2
M218
Set tool offset in XY for extruder number.  Tool 0 always has an offset of 0.0.  Tool 1 is set in relation to Tool 0
M218 T1 X0.24 Y25.43
M221
Set extruder override percentage (Extrusion multiplier, flow rate) in S as a percentage of original flow
M221 S95
M226
Wait for state of pin P to change to S
M226 P44 S
M300
Plays beep for P milliseconds
M300 P1000
M301
Sets PID parameters for extruder heaters
M301 P73.24 I3.3 D95.32
M302
Set allowable extrusion temperature to S.  If extruder is below this value extrusion commands will be ignored.  Set to M302 S0 to enable extruder moves without heating (may cause stripped filament)
M302 S170
M303
Run PID tuning cycle on heater E at temperature S.  For bed use M303 E-1
M303 E0 S200
M304
Set PID parameters for bed
M304 P300.23 I1.64 D1240.5
M500
Save settings to EEPROM memory
M500
M501
Replace current settings with last saved state from EEPROM
M501
M502
Wipe user-changed settings to factory default.  Use with caution
M502
M503
Print settings to serial console or host
M503

Full list of G-Codes found on the Reprap Wiki .