• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

script on layer change

Scheduled Pinned Locked Moved
Firmware wishlist
2
3
324
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    too
    last edited by 31 Jan 2022, 15:45

    Hello Guys,

    I want to have the duet execute a script on every new layer without having to add that in the slicer, similar to the "start.g" or "end.g" files.
    Is there any tricks to do that already?
    I guess as long as there are some kind of layer indicators in the gcode that could be doable?

    Cartesian Duet3+Raspberry pi 4 with 5x 1XD using servo drives printing mortars and concrete

    undefined 1 Reply Last reply 31 Jan 2022, 16:53 Reply Quote 0
    • undefined
      CNCModeller @too
      last edited by 31 Jan 2022, 16:53

      @too you could put M98 P"LayerChange.g" in your slicer layer change settings, and create a LayerChange.g macro to define the behaviour locally.

      At least that would mean you could change that behaviour globally without having to re-slice your code.

      Polar Duet3 Mini + 1HCL
      https://youtube.com/playlist?list=PLWjZVEdMv1BY82izahK45qKh-hp3NFkix
      Wanhao D4S: Duet2
      https://forum.duet3d.com/post/296755
      K40 Laser, Duet2
      https://forum.duet3d.com/post/312082
      Wanhao D5S
      https://www.youtube.com/CNCModellerUK

      undefined 1 Reply Last reply 31 Jan 2022, 20:21 Reply Quote 3
      • undefined
        too @CNCModeller
        last edited by 31 Jan 2022, 20:21

        @cncmodeller That's a good tip, I have actually resorted to something similar!
        I created a "M2001.g" file in the sys folder and added a M2001 command on each layer change...

        The issue is that I am using a custom slicer that I can't easily change myself and that doesn't have this capability (that at least adds ";LAYER: ##" markers at the beginning of a new layer). I was hoping to not have to manually change the gcode file, but thank god for the "change all occurrences" function in VSCode 🙂

        Cartesian Duet3+Raspberry pi 4 with 5x 1XD using servo drives printing mortars and concrete

        1 Reply Last reply Reply Quote 0
        2 out of 3
        • First post
          2/3
          Last post
        Unless otherwise noted, all forum content is licensed under CC-BY-SA