G code list 3d printer


Most used 3D Printer G-Codes

What are the 3D Printer G CODES and why they are important ? Check this guide to learn the most useful commands, and also how to use it!
Please, keep in mind that this tutorial designed for Marlin / Repetier firmwares, it is not guaranteed to work with another firmware,

1 What is a 3D Printer G-code?

1.1 How to send 3D Printer g-codes to the printer?

1.2 What can a G-CODE do for me?

1.2.1 Using G-Code, you can set up scripts on your 3D printer, for example:

1.2.2 How we do this? using some G-codes!!!

What is a 3D Printer G-code?

G-code (a.k.a RS-274), which has many variants, is the common name for the most widely used numerical control (NC) programming language. It is used mainly in computer-aided manufacturing to control automated machine tools (like CNC’s and 3D printers). G-code is sometimes called G programming language

How to send  3D Printer g-codes to the printer?

In repetier host, you should first connect the printer, then go to Manual control and write the code on this box:

then just press SEND.

In Simplify3D, you need to open the tools > Machine control Panel. in the control panel, choose Communication

Remember!, the letters should be in in CAPITAL, example: G1 X-1 Works | g1 x-1 may not work

What can a G-CODE do for me?
Using G-Code, you can set up scripts on your 3D printer, for example:

I want that my printer, before it start printing,

my bed to 110ºC
– heat my nozzle to 180ºC
– go home
– do auto-leveling
– heat the nozzle up to 230ºC
– move nozzle to the left corner, off the bed
– extrude 10mm of plastic (to clean the nozzle)
– start printing

How we do this? using some G-codes!!!

M140 S110 // this will heat the bed to 110 degrees
M104 S180 T0 // this will heat the nozzle to 180 degrees
G28 // Go home! (if you don’t define X, Y or Z, it will go home to all of them)
G29 // do the auto-leveling feature
G28 X // it will go home on the X axis again
G91 // This is needed to move the extruder!
G1 E10 F240 // This will extrude 10mm of plastic
G90 // This is needed to move the extruder!

Wow!, too much strange commands right? well, they are worthy to know!, and this is what i’m gonna show you!

On simplify 3D you can set those scripts here:

On repetier you can set those scripts here:

 

MOST USEFUL 3D PRINTER G-CODES
(and how to use them)
G0 and G1: Move

G0 = Rapid linear Move (this means it will go FASTER)
G1 = Linear Move (normal speed)

How to use?
G0 Xnnn Ynnn Znnn Ennn Fnnn Snnn
G1 Xnnn Ynnn Znnn Ennn Fnnn Snnn

What the hell is this italo?
Well, most of the commands accept multiple moves at time, this means that if you send this:
G1 X100 Y100 Z100 E10
The nozzle will move 100mm on X, 100mm on Y, 100mm on Z, while extruding 10mm of plastic.

But you can also move only one at time!, example:
G1 X10 = X axis will move 10mm

G2 & G3: Controlled Arc Move

G2 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Clockwise Arc)
G3 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Counter-Clockwise Arc)
Parameters
Xnnn The position to move to on the X axis
Ynnn The position to move to on the Y axis
Innn The point in X space from the current X position to maintain a constant distance from
Jnnn The point in Y space from the current Y position to maintain a constant distance from
Ennn The amount to extrude between the starting point and ending point
Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied)
Examples
G2 X90.6 Y13.8 I5 J10 E22.4 (Move in a Clockwise arc from the current point to point (X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22. 4mm of material between starting and stopping)
G3 X90.6 Y13.8 I5 J10 E22.4 (Move in a Counter-Clockwise arc from the current point to point (X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)
Why use it?

Notes

1In Marlin Firmware not implemented for DELTA and SCARA printers.

G4 Dwell (a.k.a delay or pause)

G4 Pnnn
Pnnn Time to wait, in milliseconds

Example
G4 P200
In this case sit still doing nothing for 200 milliseconds. During delays the state of the machine (for example the temperatures of its extruders) will still be preserved and controlled.

G10 and G11 – Retract and Unretract

If you send G10 (the hotend must be hot, otherwise it wont do nothing) will retract the filament. and when you send G11, it will unretract, this can be useful to stop oozing. but there are more effectives methods as proper calibration or cleaning scripts.  the distance can be set on the firmware or via software if you have EEPROM enabled

G28: Move to Origin (Home)

This command can be used without any additional parameters.
X Flag to go back to the X axis origin
Y Flag to go back to the Y axis origin
Z Flag to go back to the Z axis origin
Examples
G28 (Go to origin on all axes)
G28 X Z (Go to origin only on the X and Z axis)

G29: Detailed Z-Probe – (a.k.a auto leveling)

Example: G29
Probes the bed at 3 or more points. The printer must be homed with G28 before G29.

Please notice that for using this, you need to have a configured and working system!, check more in my another tutorial here: Click here to open the AutoLeveling tutorial

G90 and G91: Set to Absolute/Relative Positioning

Example: G90
All coordinates from now on are absolute relative to the origin of the machine. (This is the default.)

Example: G91
All coordinates from now on are relative to the last position.

G92: Set Position

This command can be used without any additional parameters.
Xnnn new X axis position
Ynnn new Y axis position
Znnn new Z axis position
Ennn new extruder position

Example

G92 X10 E90
Allows programming of absolute zero point, by resetting the current position to the values specified. This would set the machine’s X coordinate to 10, and the extrude coordinate to 90. No physical motion will occur.
A G92 without coordinates will reset all axes to zero.

Note that this can be dangerous!, if you are on X200, and your X-Max is 210mm, the printer will think that the hotend is at 0, and will let it to move more 200mm (200+200 = bad idea, and probably a lot of noise).

M92: Set axis_steps_per_unit
Xnnn Steps per unit for the X drive
Ynnn Steps per unit for the Y drive
Znnn Steps per unit for the Z drive
Ennn Steps per unit for the extruder drive(s)
Examples
M92 X87. 489 Y87.489 Z87.489
M92 E420:420

Please note that you NEED to have eeprom enabled to save these values! (save sending M500)

M104: Set Extruder Temperature

Example
M104 S190
Snnn = Target temperature

M140: Set Bed Temperature (Fast)
Example
M140 S55
Snnn Target temperature
Set the temperature of the build bed to 55oC and return control to the host immediately (i.e. before that temperature has been reached by the bed). There is an optional R field that sets the bed standby temperature: M140 S65 R40. (it will wait until the temperature is 40ºc before it do anything).
NOTE: is better to use M116 commands!

M116: Wait for temperatures stabilize
M116
Wait for all temperatures and other slowly-changing variables to arrive at their set values if no parameters are specified. See also M109.

M112: Emergency Stop
Any moves in progress are immediately terminated, then RepRap shuts down. All motors and heaters are turned off. It can be started again by pressing the reset button on the master microcontroller.
You just need to send M112!
But be aware!, if you have a hardware problem is better to remove the printer from the power!

 

You can see a lot more G-code commands on the following PDF.

[CMDM-download id=1120]

Gcode | Marlin Firmware