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

Conditional Gcode docs

Scheduled Pinned Locked Moved
Gcode meta commands
2
7
293
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
    lyndon
    last edited by 4 May 2020, 10:18

    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
    • undefined
      ChrisP
      last edited by 4 May 2020, 10:26

      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
      • undefined
        lyndon
        last edited by lyndon 5 Apr 2020, 10:34 4 May 2020, 10:34

        Perfect Thank you.

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

        Worked

        1 Reply Last reply Reply Quote 0
        • undefined
          ChrisP
          last edited by 4 May 2020, 10:48

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

          1 Reply Last reply Reply Quote 0
          • undefined
            lyndon
            last edited by 4 May 2020, 10:57

            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
            • undefined
              ChrisP
              last edited by 4 May 2020, 11:17

              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
              • undefined
                lyndon
                last edited by 4 May 2020, 13:41

                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
                7 out of 7
                • First post
                  7/7
                  Last post
                Unless otherwise noted, all forum content is licensed under CC-BY-SA