# G-code Reference
# Contents
- G0: Rapid move
- G1: Linear move
- G4: Dwell
- G20: Set Units to Inches
- G21: Set Units to Millimeters
- G33: Mesh Compensation
- G90: Set to Absolute Positioning
- G91: Set to Relative Positioning
- G92: Set Position
- M2: Stop Print
- M3: Spindle On, Clockwise
- M4: Spindle On, Counter-Clockwise
- M5: Spindle Off
- M33: Resume stopped job
- M42: Set Custom IO pin state
- M82: Set to Absolute Extrusion
- M83: Set to Relative Extrusion
- M104: Set Extruder Temperature
- M106: Turn fan On
- M107: Turn fan off
- M109: Set Extruder Temperature and Wait
- M120: Push context
- M121: Pop context
- M140: Set Bed Temperature
- M141: Set Chamber Temperature
- M150: Set LED Color
- M190: Set Bed Temperature and Wait
- M191: Set Chamber Temperature and Wait
- M201: Set Max Acceleration
- M203: Set Max Speed
- M204: Set Printing and Travel Acceleration
- M213: Set max peak acceleration
- M220: Set Speed factor
- M221: Set Extrude factor
- M226: Wait until print is stopped
- M240: Take webcam screenshot
- M280: Set Servo Position
- M290: Baby Step Move
- M303: PID Autotune
- M400: Wait for moves to finish
- M572: Set Extruder Pressure Compensation
- M593: Configure Input Shaping
- M600: Pause Print
- M769: Update Job Status Progress
- M771: Lock door
- M772: Unlock door
- M780: Start laser scan
- M781: Stop laser scan
- M922: Set Z Motors Offsets
- M956: Collect accelerometer data
- T<number>: Tool Change
# G0: Rapid move
Rapid movement
Parameters:
- X - The position to move to on the X axis (Tool or Motor axis, see H parameter)
- Y - The position to move to on the Y axis (Tool or Motor axis, see H parameter)
- Z - The position to move to on the Z axis (Tool or Motor axis, see H parameter)
- U - The position to move to on the U axis (Motor axis, see H parameter)
- V - The position to move to on the V axis (Motor axis, see H parameter)
- W - The position to move to on the W axis (Motor axis, see H parameter)
- A - The position to move to on the A axis (Motor axis, see H parameter)
- B - The position to move to on the B axis (Motor axis, see H parameter)
- C - The position to move to on the C axis (Motor axis, see H parameter)
- E - The amount to extrude between the starting point and ending point
- F - The feedrate per minute of the move between the starting point and ending point (if supplied)
- H - Set direction of movement in relation to the endstop
- 0: Ignore, default, coordinates are given for the tool.
- 1: Move toward the endstop and check if it is hit, coordinates are given for the motors.
- 2: The endstops are ignored, but the coordinates are given for the motors.
- 5: Probe the height, coordinates are given for the motors.
- -1: Move away from the endstop, coordinates are given for the motors.
- NOTE: If the value is 1 or -1, the sign on parameters X, Y & Z are ignored and replaced according to the endstop’s position.
- P - Probe to use for probing Z axis or homing Z axis (Accessory number of the probe)
G0 Fnn: Sets the default speed for subsequent G0 moves
# G1: Linear move
Linear movement Parameters:
Same as G0
G1 Fnn: Sets the default speed for subsequent G1 moves
# G4: Dwell
Pauses the execution of the program for a specified amount of time.
Parameters:
- P - Time to wait, in milliseconds
- S - Time to wait, in seconds
# G20: Set Units to Inches
Sets the unit used by subsequent movement commands to inches.
Parameters: None.
# G21: Set Units to Millimeters
Sets the unit used by subsequent movement commands to millimeters.
Parameters: None.
# G33: Mesh Compensation
Manipulate the mesh
Parameters:
- D - Disable the mesh
- A - Activate the mesh
- C - Clear the mesh (cannot be undone)
- S - Save the pending points in the mesh (Does not activate the mesh)
To add a point to the pending points :
- X - X coordinate of the point to add
- Y - Y coordinate of the point to add
- Z - Z coordinate of the point to add
# G90: Set to Absolute Positioning
Sets positioning to absolute mode.
# G91: Set to Relative Positioning
Sets positioning to relative mode.
# G92: Set Position
Without parameter: equivalent to G92 X0 Y0 Z0
Parameters:
- X - New X axis position
- Y - New Y axis position
- Z - New Z axis position
- E - New extruder position
Will mark an axis as "homed" if a value is provided for it.
# M2: Stop Print
Stops the print. Usually only used explicitly in a macro/calibration with parameter F to stop the execution.
Parameters:
- F"" - Stops the print as failed and displays the message in the UI. [Optional]
# M3: Spindle On, Clockwise
Turns on the spindle clockwise. Applies to the selected spindle tool or the first configured spindle.
Parameters:
- S - Speed (rpm)
# M4: Spindle On, Counter-Clockwise
Turns on the spindle counter-clockwise. Applies to the selected spindle tool or the first configured spindle.
Parameters:
- S - Speed (rpm)
# M5: Spindle Off
Turns off the spindle. Applies to the selected spindle tool or the first configured spindle.
# M33: Resume stopped job
This method allows you to restart an interrupted job. (Should only be called from the M1033 macro that guides you through the process of resuming an interrupted job.)
This should be called once the tool is ready and the axes are homed. The presence of some G-codes in the print can prevent a job from being “resumable”.
Parameters:
- J - Job id
- S - Sequence number where to start
# M42: Set Custom IO pin state
Sets custom IO pin state.
Parameters:
- P - Format: "N-M" (N = IO module number, M = port number 0-7, e.g., P1-2)
- S - State: [0, false, off, 1, true, on]
# M82: Set to Absolute Extrusion
Sets extrusion to absolute mode.
# M83: Set to Relative Extrusion
Sets extrusion to relative mode.
# M104: Set Extruder Temperature
Sets target temperature for an extruder heater without waiting.
Parameters:
- S - Target temperature
- T - Format: “N-M” N being the tool number. M being the sub-tool number. Sub-tools go from top (0) to bottom.
- T - Format: “N” N being the tool number. All heaters of the tool are set.
- A - Format: “N-M” N being the accessory number. M being the sub-accessory number. Sub-accessories are in the order of the settings.
- A - Format: “N” N being the accessory number. All heaters of the accessory are set.
- P - IO module/Port heater format ("N-M"). Where
Nis the IO module number andMis the port number (0-7) where the heater is connected. Example: P1-2
Use either T, A, or P parameter
# M106: Turn fan On
Sets the speed of the fan(s) to the specified percentage.
Parameters:
- S - Fan speed (0 to 255; also accepts 0.0 to 1.0))
- P - Format: “N-M” N being the number of the IO module where the fan is connected. M being the port number (0-7) where the fan is connected. Example: P1-2
- P - Format: “N” N being the number of the tool. Same as parameter T.
- T - The number of the tool with which the fan is associated
Use either P or T parameter
# M107: Turn fan off
Turns off the fan(s).
Parameters:
- P - Format: “N-M” N being the number of the IO module where the fan is connected. M being the port number (0-7) where the fan is connected. Example: P1-2
- P - Format: “N” N being the number of the tool. Same as parameter T.
- T - The number of the tool with which the fan is associated
Use either P or T parameter
# M109: Set Extruder Temperature and Wait
Sets target temperature for an extruder heater and wait.
Parameters: Same as M104
Omit parameters to wait until the last temperature set by M104 is reached.
# M120: Push context
Push the state of the machine onto a stack.
- Default speeds
- Absolute/Relative position/extrusion
# M121: Pop context
Pop the state of the machine from a stack.
- Default speeds
- Absolute/Relative position/extrusion
# M140: Set Bed Temperature
Sets target temperature for the bed without waiting.
Parameters:
- S - Target temperature
# M141: Set Chamber Temperature
Sets target temperature for the chamber without waiting.
Parameters:
- S - Target temperature
# M150: Set LED Color
Sets color for LED strips.
Parameters:
- P - Accessory moduleId and port format P{moduleId}-{port}
- R - Red color [0-255]
- U - Green color [0-255]
- B - Blue color [0-255]
# M190: Set Bed Temperature and Wait
Sets target temperature for the bed and wait.
Parameters: Same as M140
Omit parameters to wait until the last temperature set by M140 is reached.
# M191: Set Chamber Temperature and Wait
Sets target temperature for the chamber and wait.
Parameters: Same as M141
Omit parameters to wait until the last temperature set by M141 is reached.
# M201: Set Max Acceleration
Sets maximum acceleration for axes and extruders in mm/s².
Parameters:
- X - Max acceleration for X axis (mm/s²)
- Y - Max acceleration for Y axis (mm/s²)
- Z - Max acceleration for Z axis (mm/s²)
- A - Max acceleration for A axis (mm/s²)
- B - Max acceleration for B axis (mm/s²)
- C - Max acceleration for C axis (mm/s²)
- U - Max acceleration for U axis (mm/s²)
- V - Max acceleration for V axis (mm/s²)
- W - Max acceleration for W axis (mm/s²)
- E - Max acceleration for extruders (mm/s²)
# M203: Set Max Speed
Sets maximum speed for axes and extruders in mm/min.
Parameters:
- X - Max speed for X axis (mm/min)
- Y - Max speed for Y axis (mm/min)
- Z - Max speed for Z axis (mm/min)
- A - Max speed for A axis (mm/min)
- B - Max speed for B axis (mm/min)
- C - Max speed for C axis (mm/min)
- U - Max speed for U axis (mm/min)
- V - Max speed for V axis (mm/min)
- W - Max speed for W axis (mm/min)
- E - Max speed for extruders (mm/min)
# M204: Set Printing and Travel Acceleration
Sets print and travel accelerations in mm/s².
Parameters:
- P - Max acceleration for print moves (mm/s²)
- T - Max acceleration for travel moves (mm/s²)
# M213: Set max peak acceleration
Sets maximum peak acceleration for specified axes in mm/s².
Parameters:
- X - Max peak acceleration for X axis (mm/s²)
- Y - Max peak acceleration for Y axis (mm/s²)
- Z - Max peak acceleration for Z axis (mm/s²)
- A - Max peak acceleration for A axis (mm/s²)
- B - Max peak acceleration for B axis (mm/s²)
- C - Max peak acceleration for C axis (mm/s²)
- U - Max peak acceleration for U axis (mm/s²)
- V - Max peak acceleration for V axis (mm/s²)
- W - Max peak acceleration for W axis (mm/s²)
- E - Max peak acceleration for extruders (mm/s²)
# M220: Set Speed factor
Sets execution speed factor.
Parameters:
- S - Factor [1-200]
# M221: Set Extrude factor
Sets extrusion factor percentage.
Parameters:
- D - ExtruderId [Default: 0]
- S - Factor [1-200]
# M226: Wait until print is stopped
Wait until the print is manually stopped. Fails after 24h.
# M240: Take webcam screenshot
Takes a webcam screenshot.
Parameters: None.
# M280: Set Servo Position
Sets position angle for a micro servo.
Parameters:
- P - Accessory moduleId and port P{moduleId}-{port}
- A - Accessory number
- S - Angle
# M290: Baby Step Move
Move the Z axis without changing the current coordinates.
Parameters:
- Z - Relative distance to move
# M303: PID Autotune
Starts a temperature PID autotune. Requires an E or T parameter.
Parameters:
- S - Temperature [°C]
- P - Power limit [%, optional, Default: 100]
- E - Heater port format:
- - T - Tool sub heater format:
-
# M400: Wait for moves to finish
Wait for movement to finish before processing subsequent commands. Also pause/prevents the rendering of macros, so variables in the macro's context will be up to date with the context after the M400 is executed.
# M572: Set Extruder Pressure Compensation
Sets extruder pressure compensation factor.
Parameters:
- S - Pressure compensation value [0-1] (0 to disable)
If multiple extruders are configured, they can each be controlled by their tool number.
Example: M572 S
# M593: Configure Input Shaping
Sets input shaping parameters.
Parameters:
- P - Shaping type ("NONE", "ZVD", "ZVDD", "ZVDDD", "MZV", "EI2", "EI3")
- F - Frequency
- S - Damping factor [Optional, default: 0.1]
# M600: Pause Print
Pauses the current print.
Parameters:
- T - Reason for the pause, displayed in UI (use quotes for spaces)
# M769: Update Job Status Progress
Controls print job progress status displays.
Parameters:
- B - Badge to display [string]
- L - Sticky badge. Will keep the badge after print is finished until the printer changes state again.
- G - Indicates that the progression will be controlled by the job G-code and not be according to the Job evaluated duration time.
- G<total_stage> - Indicates the total number of stages the job will have.
- S - Current stage index [0 to G]
- P - Percentage of current stage (if G was set) or job (if G w/o total_stage)
# M771: Lock door
Locks enclosure door.
Parameters: None.
# M772: Unlock door
Unlocks enclosure door.
Parameters: None.
# M780: Start laser scan
Starts laser scan (requires laser bed probe).
Parameters:
- B - Expected layer height [optional]. Indicates that the scan type is first layer adjustments with the given layer height. In this mode, the laser will detect the real layer height. It uses the expected layer height to help distinguish between the bed and the real layer.
- E - Empty threshold distance [optional, default: 0.5mm]. Indicates that the scan type is bed empty with the given threshold. In this mode, the laser will detect if the difference between the min value and the max value is greater than the threshold value. If so, the status of the laser will be set to “NOT_EMPTY”. This status will be kept until the laser is stopped.
In the default mode, the laser will report the min, max and current height every 0.5 seconds.
# M781: Stop laser scan
Stops laser scan.
Parameters: None.
# M922: Set Z Motors Offsets
Sets Z offsets for each Z motor.
Should be used with the results of the calculateBedCalibration function. See Bed Tilt Calibration Function for more details.
Parameters:
- Z - Motor offset list (Format: Z
: , : ,...)
# M956: Collect accelerometer data
Collects accelerometer data. Follow with 'G4 S1' to ensure completion.
Parameters:
- B - Begin data collection
- T - Format: “N-M” N being the tool number. M being the sub-tool number. Sub-tools go from top (0) to bottom.
- F - Format: "F
" - Finish data collection and save to filename [optional] - F - Format: "F" - Finish data collection and save to default filename [optional]
Always include a G4 S1 command after each M956 to ensure the accelerometer has started or the file has finished saving before the next G-code command is executed.
# T<number>: Tool Change
Switch active tool.
Syntax:
- T<tool_number> - Switch to the specified tool number. Calling tool changing macros
T<number> BandT<number> Aautomatically.