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.



  • 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



  • @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.



  • 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.



  • This post is deleted!

  • administrators

    @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.



  • 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.


Log in to reply