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

    Conditional Gcode docs

    Scheduled Pinned Locked Moved
    Gcode meta commands
    2
    7
    294
    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.
    • lyndonundefined
      lyndon
      last edited by

      Hi All are there any docs available for conditional gcode. Object models etc.
      At the moment I'm playing with simple IF statement and it's not working as expected. I have

      if !move.axes[2].homed
      G28 Z
      G1 Z8 F3000
      

      Expecting when Z axis is homed the G1 move would operate.
      if Z not homed then home the Z axis.

      Cheers

      1 Reply Last reply Reply Quote 0
      • ChrisPundefined
        ChrisP
        last edited by

        The code you've posted there has no indentation, so if that's exactly the code you're using, then that's not gonna help. See here: Conditional construct

        1 Reply Last reply Reply Quote 0
        • lyndonundefined
          lyndon
          last edited by lyndon

          Perfect Thank you.

          if !move.axes[2].homed
            G28 Z
          else
          G1 Z8 F3000
          

          Worked

          1 Reply Last reply Reply Quote 0
          • ChrisPundefined
            ChrisP
            last edited by

            FWIW, for that particular example you can omit the else too

            1 Reply Last reply Reply Quote 0
            • lyndonundefined
              lyndon
              last edited by

              Cheers Chris I have yes.
              Thanks to your pointer I have progressed to

              if heat.heaters[1].current < 190
              	abort "Extruder is cold"
              if heat.heaters[0].current < 48
              	abort "Heat bed is cold"
              if !move.axes[2].homed
              	G28 Z
              

              It's part of a simple manual bed leveling macro.
              All I need now is a message box with OK..Next..Cancel which would become Repeat... Call next macro.. Cancel. But I think that's for RRF3.02 fingers crossed.

              1 Reply Last reply Reply Quote 0
              • ChrisPundefined
                ChrisP
                last edited by

                Cool.
                I'm curious as to what you're trying to achieve with that. Is it just out of interest & experimenting? Otherwise, is there a reason not to use M116 to wait for the heaters?

                1 Reply Last reply Reply Quote 0
                • lyndonundefined
                  lyndon
                  last edited by

                  It's a simple manual bed leveling macro.
                  So far I have 3 macros level test1 to 3.
                  first 1 homes Z then G30 S-1 at that X Y location then moves X Y to right side of bed and does G30 S-1 prompts for OK or Cancel. If result of G30 S-1 matched the result of probe position 1 then I cancel else I adjust the bed screw at that point then hit OK, which repeats G30 S-1 in the same X Y position.

                  2nd Macro doesn't probe position 1 since I now know the result from previous probing., it moves X Y to the 3rd probe position and then G30 S-1.
                  I repeat the above as needed calling macro's 1 through 3.
                  Based on the outcome of a G32 bed level test, I could run 1 or more of the macros again.
                  The X Y locations match the outer 4 points that G32 probes.

                  If that makes sence..

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