End GCode routines
End GCode is appended to the end of a print job to perform useful functions such as cooling the hot-end and bed, "presenting" the completed part, and shutting down the motor/heater power supply (where supported by hardware/firmware).
Home X Axis
G28 X0 ; home X axis to get head out of the way.
Cooldown the hot-end and bed ready for next print
M104 S120; Set Hot-end to 120C M140 S40; Set bed to 40C
Shutdown the hot-end and bed completely
M104 S0; Set Hot-end to 0C (off) M140 S0; Set bed to 0C (off)
Presenting the part
G1 X0 Y180 F9000; Feed the bed forward making removal easy.
Stopping the motors
Cut the steppers so you can manually move X/Y around to make part removal easier, remember to have a G28 in your [Start GCode Routine] for a good home before the next print.
M84; Stop the Stepper Motors
Shutdown power supply
M80; Power down main power supply
Custom End GCode
Here's my End GCode with comments for Marlin 1.0.2:
M104 S0 ;extruder heater off M140 S0 ;heated bed heater off (if you have it) G91 ;relative positioning G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way G1 Y150 F5000 ;move completed part out M84 ;steppers off G90 ;absolute positioning