Using M600 to swap filament

  • If I am using M600 to swap filament, is there a way to turn off heating to the printhead, and have it heat back up to the previous temperature on resume? My thought was something like what is below for the filament-change.g file:

    Lift print head
    Move print head to side of the bed
    Retract 3mm
    Set tool to 0 for temp
    Wait with prompt for me to click ok
    Heat print head
    unretract 3mm
    resume printing

  • If you've set up your Tool's standby temperature as 0 with G10 then deselecting the tool should switch it to standby.

    So wouldn't this work?

    ; somewhere earlier
    G10 P<tool num> R0 ; set standby temp for tool to 0

    ; during job
    M25 ; Pause if printing over USB
    ; OR
    M226 ; Pause from inside gcode file
    ; (Note: pause stores position G60 S1)

    G91 ; relative mode
    M83 ; relative extrusion
    G1 Z10 E-3 ; raise head, retract 3mm
    G92 ; absolute mode
    G1 <coordinates of side of bed>
    T-1 ; deselect tool. temp to standby (?)
    M291 P"Waiting to proceed" S2 ; wait with prompt
    T<tool num> ; select tool
    M116 P<tool num> ; wait for temp
    G1 E3 ; unretract 3mm
    M82 ; absolute extrusion (if required)
    G1 R1 X0 Y0 Z0 ; move back to pause coordinates
    M24 ; Resume File

  • If we look at the Gcode for Duets (, this can easily be implemented:

    Comments are after the ";" and can be removed, they are explaining what is expected to happen at this line. Gcode are simple plain text and human readable instructions.
    Lines with square brackets [] means you should figure out what you need there.

    G60 S1 ; Save the current print head coordinates into slot 1 (same one used during standard pausing; alternatively use slot 0 or 2).
    G1 E-1 F1200 ; G1 is a move command, here used to retract 1mm of filament at the a feedrate of 1200mm/min
    G91 ; G91 simple sets the Duet into Relative Positioning, since you want to lift the head, absolute coordinates are not useful at all (unless you have a park position for the head).
    G0 Z5 F900 ; G0 is a move command where we lift the head, in this case by 5mm (at a speed [or Feedrate] of 900mm/min or 15mm/s - you can change this to your liking).
    G90 ; G90 undo the G91 by setting X, Y and Z into Absolute Positioning (now a X, Y, Z parameter of G1 or G0 will move to that position).
    G0 X0 Y0 F2000 ; Here we move the head towards the front left (on a typical Cartesian coordinate system)
    G1 E-2 F1200 ; Retract the other 2mm of your total 3mm retraction
    M144 S0 ; bed to standby temperatures
    [use the first part of the gcode from your preferred method below here]
    M291 R"Title" P"Message" S2 X1 Y1 Z1 ; The command displays a prompt/message with an OK button, S3 also gives a Cancel button; S2 and S3 are blocking and will wait until OK; this also gives movement buttons for X Y and Z.
    [use the second part from your preferred method here]
    M116 P1; wait for the tool to reach it target temperature
    M144 S1 ; set bed to active temperature (we dont currently have to wait for it, since we are loading filament).
    [typically here you would handle full unloading and loading of filament as well as priming the nozzle, also might be a good idea to Home X and Y at this time, ensures coordinates are perfect]
    G1 E-3 ; since we have the nozzle primed, we retract it again to not ooze it out again.
    M116 ; Allows the bed to fully heat to its temperature (optional)
    G90 ; ensure we are at absolute coordinates
    G0 R1 X0 Y0 Z5 F2000 ; move to 5mm above the saved position
    G91 ; once again to relative mode, to lower the head
    G1 Y-5 F900 ; slowly lower the head to the print, coming from above ensures we do not accidentally crash into the print, knocking it over
    G1 E3 ; unretract the 3mm - nozzle should now be primed and ready
    G90 ; final absolute coordinates; after this line, the M600 is over and the print will simply continue

    Here I break the code into 2 options:
    1] manually set the temperatures that will always be used (tool remains active, so movements are allowed).
    2] set the current tool to Idle temperatures (tool is idle and thus cant be moved, but we keep our previously set temperatures).

    Option 1:

    [first part]
    G10 P1 S0 R0 ; set the active and standby temperatures for Tool 1 (typically first extruder) to 0; initiating a cooldown
    [last part]
    G10 P1 S210 R0 ; set the active temperature for Tool 1 to 210C and keep the standby on 0 - modify as needed.

    Option 2:

    [first part]
    T-1 ; deselect current tool; will automatically cooldown to Standby temperature. Note no movement is allowed.
    [last part]
    T1 ; select the first tool; automatically start heating to its Active temperature

    Note that by the time you might see the message, the printer might be cooled completely, so moving the extruder at that time is not safe (and if it is below its threshold simply will not move).
    The M144 commands are optional, is simple lets the bed cool (some coatings might release the print if the bed cools too far).

    While this may look like a lot of code, learning Gcode by doing something like this is effective. Understanding Gcode (or at least having slight background and searching) with a Duet printer will unleash its power - the ability to make it do anything you want (within the realms of 3D manufacturing).

Log in to reply