start-and-end-gcode

Starting & Ending GCode

In your slicer you will have a section for GCode commands that are run at the very start and end of every print. In Cura/JGCreat, these are found in the machine settings.

There are several good videos on this topic that are linked at the bottom of this article. These will give you a great introduction into what is possible to achieve with starting and ending gcode commands.


Starting GCode

Typically this contains several functions:

  • Home and reference all axis
  • Set position to zero
  • Prime the extruder
  • Wipe the nozzle on the bed (not enabled by default - you need to add your own commands)
  • Enable auto-bed or mesh-bed levelling (if configured)

Default Start Script

  • G28 ; Home all axis
  • G1 Z15.0 F6000 ; Move up 15mm at 6000mm/min (note: more than the max speed set in the printer firmware)
  • G92 E0 ; Reset extruder length to zero
  • G1 F200 E10 ; Extrude 10mm at 200mm/min
  • G92 E0 ; Reset extruder length to zero

The lift up and extrude is the β€œpurge and prime” to ensure that filament is flowing correctly. If the filament is left at home position for too long while the nozzle is hot, the filament can ooze out. Then the nozzle will not be ready for printing. The purge and prime gets the filament flowing again ready for printing.

You can add a β€œwipe” step to the starting gcode after the β€œpurge”. Replace the start gcode listed above with the lines below - or watch the videos below.

Start Script With Wipe

  • G28 ; Home all axis
  • G1 Z15.0 F6000 ; Move up 15mm at 6000mm/min (note: more than the max speed set in the printer firmware)
  • G92 E0 ; Reset extruder length to zero
  • G1 X0.0 Y0.0 F1000.0 ; go to edge of print area
  • G1 Z0.200 F1000.0 ; Go to Start Z position
  • G1 X60.0 E9.0 F1000.0 ; intro line
  • G1 X100.0 E21.5 F1000.0 ; intro line
  • G92 E0.0 ; reset extruder distance position

Thanks to DaHai for the wipe script.


Ending GCode

  • G91; Set relative positioning mode
  • G1 E-5 F600; retract filament slightly
  • M140 S0; Turn off the bed heater
  • M104 S0; Turn off the nozzle heater
  • G28 X; Home the X axis
  • G0 Y280 F600; Bring the bed to the front for easy print removal
  • M84; Turn off the motors

As the home positions on the A5 has the bed towards the back of the printer, one useful command to add to the end GCode, is a command to bring the Y-axis forward to the front once the print is finished. e.g. β€œG0 Y280 F600”

Thanks to Rich Haubert for the suggestion to insert a small filament retraction.


Videos

start-and-end-gcode.txt Β· Last modified: 2019/03/23 04:32 by samuelpinches