Tool Change - Purge Sequence & M116

  • Hi All,

    I am struggling to get S3D to wait (M116 P1/P2) during my purge sequence. Could someone take a look over the following command and suggests some solutions?

    I currently have this in my S3D tool change script:

    ;BigBox Oozeless Tool Change Script Begin
    {IF NEWTOOL=1}T0
    {IF NEWTOOL=1}G1 X110 Y200 F3000
    {IF NEWTOOL=1}G1 X110 Y222 F3000
    {IF NEWTOOL=0}T1
    {IF NEWTOOL=0}G1 X81 Y200 F3000
    {IF NEWTOOL=0}G1 X81 Y240 F3000
    {IF OLDTOOL=1}T1
    {IF OLDTOOL=1}G1 E27 F400
    {IF OLDTOOL=1}G1 E-14  F4000
    {IF OLDTOOL=0}T0
    {IF OLDTOOL=0}G1 E27 F400
    {IF OLDTOOL=0}G1 E-14  F4000
    ;extruder steps per mm
    ;{IF NEWTOOL=0}M92 E423 ;adjust steps per mm for your filament in extruder 0 (L) 
    ;{IF NEWTOOL=1}M92 E423 ;adjust steps per mm for your filament in extruder 1 (R)
    ;prime new extruder
    {IF NEWTOOL=0}T0
    {IF NEWTOOL=1}T1
    G1 F200
    G1 E15 F200
    G1 F50
    G1 E5 F50
    G1 E-1.5 F3000
    {IF NEWTOOL=0}T0
    {IF NEWTOOL=0}G1 X110 Y222 F3000
    {IF NEWTOOL=0}G1 X110 Y200 F3000
    {IF NEWTOOL=1}T1
    {IF NEWTOOL=1}G1 X81 Y240 F3000
    {IF NEWTOOL=1}G1 X81 Y220 F3000
    ;BigBox Oozeless Tool Change Script End

    I also have this in my tpost1.g:

    ; File: tpost1.g
    ; Code to implement after tool selection
    M116 P1 ; Wait for temperature to reach target.
    ; End

    … and the same for tpost2.g replacing the P1 for P2.

    It seems to go to the dump bucket and just try and purge and prime not matter what the temps are and does not wait. Any ideas? Could I work the purge sequence into the Duet tool change macros?


  • administrators

    Have a look at the generated Gcode from S3d, and see where the dump and purge code is inserted relative to the Tool Change. You may find that the wait (which is currently in TPostN) happens after the s3d code is inserted.

    I assume you have seen this wiki page:

    I personally have all my tool change information in my Tpre and Tpost files rather than in the slicer because I use more than 1 slicer and don't want to have to keep them current across slicers.

  • Could I put the purge code in the tpre, tpost etc?

    Do I need to reference the macro anywhere in my slicer code?

  • administrators

    Tfree, Tpre,Tpost etc are called by the firmware when a tool change occurs so nothing needed in the gcode other than the normal tool change (T0, T1 etc).

    There is a summary of what each of the tools change macros do here:

    What I do is
    TfreeN.g -> sort out the old tool (lift, park)
    Tpost.N.g -> sort out the new tool (wait for temps, purge, wipe)
    I do need to use Tpre because there is nothing to do inbetween the tools however if you had a mechanical tool swapping sytem you would have things in there.

  • Thanks T3P3Tony, that has broken it down a bit more clearly. I read the page you linked to yesterday but was not sure where to put the purge.

    Tfree1.g: Park - Purge
    Tpost2 (or should it be 1??).g: Wait - Prime - Wipe

    Continue with print.
    Does that seem righ

  • administrators

    Do you purge at the end or the beginning of each tools actions? if you purge at the end then what you have is right, but I wonder why you are purging and then priming?

    The numbering references the tool that is being referred to to TFree1 happens when tool 1 is freed up. Tpost2 happens after tool 2 is selected.

  • When Tool 1 comes back it needs to be purged, then tool 2 select heated and primed.

  • So now I have this…. correct?

    ; File: tfree1.g
    ; Retract
    ; Dock
    G1 X110 Y200
    G1 X110 Y222
    ; Pre-Prime Extruder
    ; Purge
    G1 E27 F400
    G1 E-14 F4000
    ; End
    ; File: tpost1.g
    ; Wait For Print Temperature
    M116 P1				; Will wait for Hotend to reach print temp
    ; Prime
    G1 F200
    G1 E15 F200
    G1 F50
    G1 E5 F50
    G1 E-1.5 F3000
    ; Wipe
    G1 X110 Y200

    Is the P1 correct in the M116 P1 line should it be P2 in the tpost1?

    Probably should add:
    G1 Z5 F1000
    in the tfree1.g

    These are obviously the same (but different for #2)

    tpre#.g is blank in both cases.

  • administrators

    Looks about there (will be cool to see a video of the printer doing all this :D)

    The tool you are waiting for in Tpost1.g is P1, P2 should be in Tpost2.g

    You are starting from T1, rather than T0 so make sure that where you are referring to tools (for example in the slicing gcode) you have a T1 and T2 rather than a T0 and T1.

    If you use G91 then its a good idea to match it with a G90 once the relative move is done or else you will have a crash.

    also if you elevate the head/drop the bed then remember to put it back where it was one the move is complete.

  • Should I have it as tpost0.g and 1 then? I got the 1/2 combo from dc42 example. I currently have it set as T0 and T1 in the config.

    Yes I will remember to put tthem back and use a G90 otherwise that could yield some strange results!!

  • administrators

    Yes, I use Txxx0.g and Txxx1.g

  • So thanks for the help I now have it working pretty well. It purges and primes perfectly. Now my only issue is currently I have the G10 P# S200 R160 code for both heads in my slicer startup. So it heats head one then tool changes (Inc the purge sequence) and heats head two. Then tool changes back to head one again to print. Is there a way of eliminating this extra change sequence?

  • administrators

    I think that's down to your slicer, it's trying to make sure that both nozzles are heated and purged before printing.

  • Yes it definitely pre-heats without my say so. I will have to research S3D. Can both nozzles be heated together through the Duet code?

  • administrators

    You can heat both nozzles together, assuming your PSU can handle it. Here is an example:

    1. Send G10 P1 S0 Rxxx (the R value should be the standby temperature you want), and G1 P0 Sxxx Rxxx with the correct active and standby temperatures.

    2. Send T1 to select tool 1. Because the active temperature is 0, it won't wait to heat up even if you have M116 H1 in your tpost1.g file.

    3. Send T0 to select tool 0. This will cause it to heat tool 0 to active temperature at the same time as heating tool 1 to standby temperature.

    4. Send G10 P1 Sxxx to select the correct active temperature for tool 1.

  • Apparently putting this line:

    M104 S[extruder#_temperature] T#

    In your startup script causes S3D to ignore its normal heat up process and follow your script for heating at startup. Setting the # to your respective tool numbers.

    Thanks for all the help dc42 and T3P3Tony! I am almost there with the dual printing now.

    I have to try and stop myself from buying another duetwifi board for the printer I'm building next!!

  • administrators

    don't try too hard ;D

  • Syko, I have a 3 extruder printer with a Duet WiFi. I am using S3D. Until now I have been using the "start script" in S3D but I can't get it to move to the purge bin during a tool change. It works fine if I'm only using 1 extruder to print. I think I need to use tfree & tpost instead of S3D for tool changes. Can you share your code for the tfree & tpost and the changes you made to S3D?
    Ultimately when I start multi Ex print, I want Ex0 (T0) to move from home to the purge bin , heat up and then purge 10mm then start the print. When Ex0 is done I want Ex1 (T1) to move to the purge bin, heat and purge, and continue print.
    Thanks for your help

  • I prefer to keep my slicer configuration as standard as possible and do parking, heating and unparking in free#.g and post#.g so it's easier to use different slicers.

Log in to reply