Command on layer change

  • Hey guys,

    I am really new to this forum and I hope I haven't missed a similar topic. I want to build a delta printer with a duetwifi.
    Is it possible to detect a layer change and move another stepper (other than the 3 for the Delta Movement) xx-Steps (according to the layer hight --> 0.1mm 0.2mm 0.3mm ....) possible application for my big printer and a camera that is moving up as the layers are.

    Thanks guys for the help

    Best Regards

  • @taconite I am not a 100% certain but I think you could define another stepper driver as being part of the Z-axis. This way it should go up together when all other motors perform a Z movement. But I have no experience with deltas, so better wait for someone to confirm.

  • this should be possible by using the layer change gcode functionality provided by, e.g. slic3r. Just add your stepper, define it as an additional, non extruder axis (UVWABC) and move the axis in your layer change code.

    If your slicer does not support this you may be able to insert the move commands by searching for the comments inserted by your slicer (e.g. ";layer 3") and adding the move commands there.

  • @ampex_fhm thanks for your reply: Do you know if this feature is available in cura (I am currently using 2.6.2). the best thing would be an "automatic" feature that I don't have to add manually. is the duet sending a "change layer" command or something?

    EDIT: found this --> it's a solution for "Custom G Code inserted at layer change" - it's a Postprocessing Plugin for cura; anyhow it would be awesome if there would be "automatic" solution that I don't have to add manually

  • administrators

    There is already another firmware request to support a modified delta kinematics that moves in line with the Z height, and I expect to implement this soon (perhaps in firmware 2.02). You need to consider how you will home this extra axis - presumable with its own homing switch. Meanwhile you can create an additional U axis using the M564 command and use a post-processing command to add G1 U commands at layer changes. This may be the best approach anyway, to avoid the camera hopping with each Z-hop.

  • awesome thanks @dc42 . Yes you are absolutly right - I planned to home it with an extra homing switch. Again - Thank you for the help!

  • @taconite the layer change post processing feature in Cura 3.4 is quite good actually. Just FYI.

  • @phaedrux okay, and how do I use it? Search and replace?
    " Ghostkeeper commented on 16 Jan 2016 (on github) (

    At every layer change, a comment is inserted that says: ;LAYER: <layer number>. This can be used to accurately detect layer changes, as long as CuraEngine is used as slicer.

    So at the postprocessing:
    search: ;LAYER:
    replace: G1 U10 ;LAYER:

    Seems like its working:
    G1 U50;LAYER:0
    G0 F30000 X86.763 Y87.334 Z0.1
    G0 X87.138 Y86.962

    Do I need a return so that it looks like?
    G1 U50

  • @taconite I don't think the return will matter at all since it's behind a comment ( ; ) anyway.

  • I'm using this to insert a few command on each layer change:

  • I also just published a full tool to take snapshot pictures on every layer change, see

  • @resam very nice! A total stupid question but how do I add your script to the cura post-rocessing plugin?

  • @taconite you put the file into the scripts folder of you current Cura version:

    ~/Library/Application Support/cura/3.4/scripts on macOS,
    C:\Users\<username>\AppData\Roaming\cura\3.4\scripts on Windows,
    /home/<username>/.local/share/cura/3.4/scripts on Linux.

    Then restart Cura, and it should be available to be added in the PostProcessing GUI.

  • hugh thanks to all of you!!!

Log in to reply