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

    How to: G1 F<expression>

    Scheduled Pinned Locked Moved Unsolved
    Gcode meta commands
    7
    12
    616
    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.
    • fcwiltundefined
      fcwilt
      last edited by

      Hi,

      The documentation says this:

      iterations int The number of completed iterations of the innermost loop

      So how are we to interpret that when used it in nested whiles?

      Did you try removing the inner while to see if it made a difference?

      Frederick

      Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

      1 Reply Last reply Reply Quote 0
      • OwenDundefined
        OwenD @schpongo
        last edited by OwenD

        @schpongo
        What is "not working"?
        I.e what was your intent vs what is happening?
        The way you've written it, it would (I think) complete five loops of the second level for each of the first.
        If you're intent is to only do the second half on the first five iterations of the first, then use an IF statement.

        1 Reply Last reply Reply Quote 0
        • schpongoundefined
          schpongo
          last edited by

          Sorry for being no specific enough. Line 4 is not working. Thus the feedrate always stays at F6000 from the command in line 3. I've tried echoing the calculation inn line 4 and it works. But the combination with the G1 command does not seem to work.

          whosrdaddyundefined 1 Reply Last reply Reply Quote 0
          • whosrdaddyundefined
            whosrdaddy @schpongo
            last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • dc42undefined
              dc42 administrators @schpongo
              last edited by dc42

              @schpongo said in How to: G1 F<expression>:

              Hey, I have a quick question.
              I'm trying to write a loop were in each loop iteration the set feedrate increases.
              My current approach is the following, but this isn't working. Does anyone have any pointers?

              while iterations < 10
              	G28 U
              	G1 U180 F6000
              	G1 F{6000+iterations*2000}
              	while iterations <5
              		G1 U56
              		G1 U304
              		
              

              I've tried replacing the {} with () or [] but did not have any success.

              I've just tried that on my delta, with a few changes to suit the geometry:

              while iterations < 10
              	G28
              	G1 X0 Y0 Z50 F6000
              	G1 F{6000+iterations*2000}
              	while iterations <5
              		G1 X-150
              		G1 X150
              

              It works for me as expected. For each iteration of the outer loop, the speed of the moves in the inner loop increases. I'm using RRF 3.2beta1.

              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 0
              • schpongoundefined
                schpongo
                last edited by

                Hey, sorry for the late reply.

                I tried your code again and changed the axes but it still does not work.

                G28V
                while iterations < 10
                	G1 X0 Y0 Z50 F6000
                	G1 F{6000+iterations*2000}
                	while iterations <5
                		G1 V-150
                		G1 V150
                

                The result in the console is:
                Failed to execute G1 in test: [ArgumentException] Cannot convert F parameter to float (value {6000+0*2000})

                The problem is no longer relevant to me but there may still be a bug here which needs fixing.

                1 Reply Last reply Reply Quote 0
                • garethkyundefined
                  garethky
                  last edited by

                  I just ran into this with a simple expression like:

                  G1 E1 F{600.0 + 1.0}
                  

                  which gives the error:

                  Error: Operation failed (Reason: ArgumentException in SimpleCode: Cannot convert F parameter to float (value {600.0 + 1.0}))

                  I'm still on 3.1.1 so maybe this is fixed in 3.2+ (just a wild guess that @dc42 is running the latest firmware on that Delta)

                  dc42undefined 1 Reply Last reply Reply Quote 0
                  • dc42undefined
                    dc42 administrators @garethky
                    last edited by

                    @garethky said in How to: G1 F<expression>:

                    I just ran into this with a simple expression like:

                    G1 E1 F{600.0 + 1.0}
                    

                    which gives the error:

                    Error: Operation failed (Reason: ArgumentException in SimpleCode: Cannot convert F parameter to float (value {600.0 + 1.0}))

                    I'm still on 3.1.1 so maybe this is fixed in 3.2+ (just a wild guess that @dc42 is running the latest firmware on that Delta)

                    The "Argument exception" indicates that you are running a Duet+SBC and it is DSF that failed to do the maths. It's likely been fixed in 3.2.x.

                    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 0
                    • garethkyundefined
                      garethky
                      last edited by

                      Fixed for me in 3.2_RC2! 😊

                      1 Reply Last reply Reply Quote 0
                      • garethkyundefined
                        garethky
                        last edited by

                        Sorry no, its not totally fixed. It was broken for other parameter and that is fixed in 3.2. the F parameter still returns the same error.

                        1 Reply Last reply Reply Quote 0
                        • chrishammundefined
                          chrishamm administrators
                          last edited by

                          Thanks for reporting this problem, I'll fix it in the next version.

                          Duet software engineer

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