Skip to content

Instantly share code, notes, and snippets.

@faparicior
Created April 28, 2020 16:03
Show Gist options
  • Star 43 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save faparicior/98f7a28c80ac7b6b20ffa771af103c56 to your computer and use it in GitHub Desktop.
Save faparicior/98f7a28c80ac7b6b20ffa771af103c56 to your computer and use it in GitHub Desktop.
Start and End G-code for Ender 3 on Cura
; Ender 3 Custom End G-code
G4 ; Wait
M220 S100 ; Reset Speed factor override percentage to default (100%)
M221 S100 ; Reset Extrude factor override percentage to default (100%)
G91 ; Set coordinates to relative
G1 F1800 E-3 ; Retract filament 3 mm to prevent oozing
G1 F3000 Z20 ; Move Z Axis up 20 mm to allow filament ooze freely
G90 ; Set coordinates to absolute
G1 X0 Y{machine_depth} F1000 ; Move Heat Bed to the front for easy print removal
M106 S0 ; Turn off cooling fan
M104 S0 ; Turn off extruder
M140 S0 ; Turn off bed
M107 ; Turn off Fan
M84 ; Disable stepper motors
M117 That's All Folks!
; End of custom end GCode
; Ender 3 Custom Start G-code
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
G28 ; Home all axes
M117 Purge extruder
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X0.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X0.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X0.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
M117 By your command!
; End of custom start GCode
@mcf60660
Copy link

mcf60660 commented Mar 2, 2021

THANK YOU!
Looked all over for this.
the "print_temperature_layer_0" part was missing on all the other sites.

@mzsomborn
Copy link

Thank you !

@Mark7888
Copy link

Mark7888 commented Oct 7, 2022

Thank you!

@philiphendry
Copy link

Really appreciated... thank you. I've extended this slightly given I have the CL Touch bed leveller so after the G28 which resets bed levelling I run M501 to load the bed-levelling settings previously saved to EEPROM followed by M420 S1 Z10 V to enable bed levelling.

@rgxxx
Copy link

rgxxx commented Mar 13, 2023

"M106 S0 ; Turn off cooling fan"
"M107 ; Turn off Fan"
Hmmm...
M106 S[0-255] sets the speed of fan, so sending "M106 S0" will turn of cooling fan.
M107 only turns of all of the fans, ofc if index was not given.
Sooo... I think one of these strings can be removed, or...?

@dolofanu2
Copy link

Really appreciated... thank you. I've extended this slightly given I have the CL Touch bed leveller so after the G28 which resets bed levelling I run M501 to load the bed-levelling settings previously saved to EEPROM followed by M420 S1 Z10 V to enable bed levelling.

CAN you be more specific ?

@echak
Copy link

echak commented Mar 17, 2023

Really appreciated... thank you. I've extended this slightly given I have the CL Touch bed leveller so after the G28 which resets bed levelling I run M501 to load the bed-levelling settings previously saved to EEPROM followed by M420 S1 Z10 V to enable bed levelling.

CAN you be more specific ?

I think what he's doing is something like this in between G28 and M117:

M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
G28 ; Home all axes
M501 ; Restore EEPROM settings
M420 S1 Z10 V ; set bed leveling state
M117 Purge extruder
G92 E0 ; Reset Extruder

I haven't tried running it yet but so you might have to test for yourself too.

@RadoBGMTB
Copy link

RadoBGMTB commented Mar 24, 2023

Can anyone fix the code so it don´'t run 5 min bed leveling and instead just load what is saved in EEROM. I don't want to mes up something.
And can anyone pls optimize the code becaus it first preheat the bed then level then heat the nozel. Can't we heat the bed and nozzel at the same time. Isent it gona be bether if we moove the m190 and m109 to the end of the start gcode before the m117

@pseudobamboo
Copy link

i iknow, thats too old, but i put this code on prusa slicer for my ender 3 and the error screem show,

16128.gcode failed due to invalid custom G-code sections:
end_gcode
Parsing error at line 9: Not a variable name
G1 X0 Y{machine_depth} F1000 ; Move Heat Bed to the front for easy print removal
^
16128.gcode.tmp for error messages enclosed between
!!!!! Failed to process the custom G-code template ...
and
!!!!! End of an error report for the custom G-code template ...
for all macro processing errors.

i need a gcode when finish my print, before the heat low, i need to retrat the filament for i remove

@RadoBGMTB
Copy link

RadoBGMTB commented Nov 22, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment