Gcode after print completes

  • I thought I saw someone mention this but wasn't able to find it...
    The nozzle doesn't move away after each print completes and is leaving large blobs. Can I put the Gcode to move the hotend to g28 x after each print? I have been putting this code in a few places, last one being stop.g (but I think this is only for cancelled prints) and its not working.
    Where do I put this code?
    If I have to add it to ending scripts in S3d, that easy to do, but would prefer to do this on the Duet.


  • Not your preferred choice, but I do it in S3D. My normal end script:

    M104 S0 ; turn off extruder
    M140 S0 ; turn off bed
    M106 S0 ; turn off part fans
    G28 ; home axes
    M84 ; disable motors

  • Moderator

    @bluedust What I did is that I created print_start.g and print_end.g in Duet's sys folder that contain my start and end Gcodes. In my slicer I simply use

    M98 P/sys/print_start.g

    as start code (and if course respectively fit the end code). This way I can even still modify my start code after a print has started and while the printer is still heating up. Needed it rarely but comes in handy once you do need it.

    Of course the same goes for end code to be modifiable even after print started.

  • @PlasticMetal @wilriker
    Thanks guys! all very helpful!

  • There is already stop.g that will be run at the end of the print if the sliced gcode sends an M0. I prefer to just put "M0" at the end script so I will keep the gcode at only one place, since stop.g will also be called in other circunstancies.

  • @token47
    Also very helpful! I will be combining all 3 of your suggestions in the near future.


Log in to reply