Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Conditional code for layer height

    Gcode meta commands
    5
    7
    209
    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.
    • tapirath
      tapirath last edited by

      I'm trying to convert this PrusaSlicer code to a RRF macro. Is there a way to achieve it? where can I find the documentation for all the possible variables I can use?

      ; 0.2mm layer, 8 bands 5mm each, total height 40mm
      {if layer_num== 1}M572 D0 S0.0
      {elsif layer_num== 25}M572 D0 S0.05
      {elsif layer_num== 50}M572 D0 S0.10
      {elsif layer_num== 75}M572 D0 S0.15
      {elsif layer_num== 100}M572 D0 S0.20
      {elsif layer_num== 125}M572 D0 S0.25
      {elsif layer_num== 150}M572 D0 S0.30
      {elsif layer_num== 175}M572 D0 S0.35
      {endif}
      
      dc42 1 Reply Last reply Reply Quote 0
      • dc42
        dc42 administrators @tapirath last edited by

        @tapirath something like this (not tested!):

        if exists(job.layer)
          if job.layer = 1
            M572 D0 S0.0
          elif job.layer = 25
            M572 D0 S0.05
        

        and so on. Object model job.layer will only be present and correct if the GCode includes recognised layer number comments.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        1 Reply Last reply Reply Quote 1
        • Phaedrux
          Phaedrux Moderator last edited by

          Maybe take a look here: https://forum.duet3d.com/topic/26272/incremental-pressure-advance-m572-tuning-macros

          Z-Bot CoreXY Build | Thingiverse Profile

          1 Reply Last reply Reply Quote 0
          • tapirath
            tapirath last edited by

            Perfect thank you both

            1 Reply Last reply Reply Quote 0
            • mikeabuilder
              mikeabuilder last edited by

              If you do write this macro in RRF, you'll still need to insert a custom bit of gcode in your slicer that is called on every layer change. And that custom gcode is an M98 P"<your macro name>". This will call the macro every time a layer is changed. After doing precisely this myself, I found that I preferred to do that work with slicer code.

              tapirath 1 Reply Last reply Reply Quote 1
              • tapirath
                tapirath @mikeabuilder last edited by

                @mikeabuilder

                I prefer the macro because
                1- Cura doesn't have conditional gcode
                2- I can use the macro with any Slicer without changing it

                1 Reply Last reply Reply Quote 0
                • ELAD
                  ELAD last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA