584,830 active members*
5,831 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > PlanetCNC > while/endwhile constructs do longer work
Results 1 to 13 of 13
  1. #1
    Join Date
    Aug 2021
    Posts
    4

    while/endwhile constructs do longer work

    I have over 100 hand coded gcode files that ran perfectly on a Mk1 controller with 2.10.1412.1501 on WindowsNT. I recently updated to 2.10.1807.2601. After the update all my existing files that had while/endwhile constructs stopped execution (actual and simulated) after the first encountered endwhile statement. All existing files that did not have while/endwhile constructs continued to run perfectly after the update.

    Any suggestions?
    Is a download of 2.10.1412.1501 available to revert my update?

  2. #2
    Join Date
    Jun 2015
    Posts
    4131

    Re: while/endwhile constructs do longer work

    hy what about replacing all your loops with linear code ? maybe i can help you

  3. #3
    Join Date
    Mar 2017
    Posts
    1295

    Re: while/endwhile constructs do longer work

    Send me this g-code and I'll check what is wrong.

  4. #4
    Join Date
    Aug 2021
    Posts
    4

    Re: while/endwhile constructs do longer work

    Here's an example of the g-code. Before the software update to 2.10.1807.2601 this gcode drew two concentric five point stars (it's a test pattern). After the update it only draws the smaller star and stops execution after line 30. I've attached a screen shot. It shows only the single star.

    Thanks. Your help is greatly appreciated!

    %
    (Star test pattern - little first)
    (For 450nm laser)
    (Laser uses output 1)
    (Use M3 to turn laser on)
    (Use M5 to turn laser off)

    (X, Y = 0 is the center of the star)
    (Z = 0 is laser focal point)

    G17 G21 G40 G80 G90
    G92.1

    F[1000]

    #1 = [15] (little R)
    #2 = [#1 * [1.5 - [sqrt[5] / 2]]]
    #3 = [0] (rotation angle)

    G0 x[0] y[#1] (starting point)

    M7 (turn mist/air on)
    M3 (turn laser on)

    o100 while [#3 LE 288]
    G1 x[#2 * sin[36 + #3]] y[#2 * cos[36 + #3]]
    G1 x[#1 * sin[72 + #3]] y[#1 * cos[72 + #3]]
    #3 = [#3 + 72]
    o100 endwhile

    M5 (turn laser off)

    #1 = [25] (big R)
    #2 = [#1 * [1.5 - [sqrt[5] / 2]]]
    #3 = [0] (rotation angle)

    G0 x[0] y[#1]

    M3 (turn laser on)

    o200 while [#3 LE 288]
    G1 x[#2 * sin[36 + #3]] y[#2 * cos[36 + #3]]
    G1 x[#1 * sin[72 + #3]] y[#1 * cos[72 + #3]]
    #3 = [#3 + 72]
    o200 endwhile

    M5 (turn laser off)
    M9 (turn mist/air off)

    M2
    %

  5. #5
    Join Date
    Mar 2017
    Posts
    1295

    Re: while/endwhile constructs do longer work

    I can confirm this is a bug.

  6. #6
    Join Date
    Aug 2021
    Posts
    4

    Re: while/endwhile constructs do longer work

    Thanks. Do you know where I can find a download of 2.10.1412.1501? That was the version I was using before the update that worked.

    I checked the planet-cnc.com web site but there didn't appear to be any place to download older versions.

  7. #7
    Join Date
    Mar 2017
    Posts
    1295

    Re: while/endwhile constructs do longer work

    Contact our support

  8. #8
    Join Date
    Aug 2021
    Posts
    4

    Re: while/endwhile constructs do longer work

    Thanks! I'll contact support now.

  9. #9
    Join Date
    May 2014
    Posts
    11

    Re: while/endwhile constructs do longer work

    Is there any fix for this bug?

  10. #10
    Join Date
    Mar 2017
    Posts
    1295

    Re: while/endwhile constructs do longer work

    Both stars are visible and g-code runs as it should.

    Attached Thumbnails Attached Thumbnails PlanetCNC32d_Vz1R9E3BeQ.png  

  11. #11
    Join Date
    May 2014
    Posts
    11

    Re: while/endwhile constructs do longer work

    Hello,
    yesterday I was playing with nested while and it seems that only one cycle of the outside loop is executed.
    I've also tried to use a simple counter in the outside loop instead of the derided behaviour to exlude any programming error

    %
    G21G54G90G17

    #1=12 (diameter)
    #2=30 (x side)
    #3=22 (y side)
    #4=0.4 (stepover)
    #5=0 (z)
    #9=300 (vertical feedrate)
    #<_DEPTH>=-10
    #<_ZSTEP>=-1
    #<_HFEED>=2000
    #<_STEPOV>=[#1*#4]

    #<_RADIUS>=[#<_STEPOV>/2]

    #<_ENDY>=[#3+#1]


    (start outside)
    #10=[0 - #1*2]
    #11=[0 - #1*[1-#4]]

    G0 X#10 Y#11

    G0Z0.1


    #10=[#2+#1]

    #<_CURRZ>=#<_ZSTEP>

    (cycle Z)

    #100=0

    (O100 WHILE [#<_CURRZ> GT #<_DEPTH>])

    O100 WHILE [#100 LT 10]
    (G1 Z#<_CURRZ> F#9)
    G1 Z#100 F#9

    (cycle XY)
    O110 WHILE [#11 LT #<_ENDY>]

    G1 X#10 F#<_HFEED>

    #11=[#11+#<_STEPOV>]

    G3 Y#11 R#<_RADIUS>
    G1 X[0-#1]

    #11=[#11+#<_STEPOV>]
    G2 Y#11 R#<_RADIUS>
    O110 ENDWHILE


    #<_CURRZ>=[#<_CURRZ> + #<_ZSTEP>]
    #100=[#100+1]
    O100 ENDWHILE
    G0Z10
    G28


    %





    P.S. I have version 2.10.1807.2601 like the user at the beginning of the thread

  12. #12
    Join Date
    Mar 2017
    Posts
    1295

    Re: while/endwhile constructs do longer work

    CNC USB software is obsolete for 10 years and not supported any more.
    You should update to latest TNG software.

  13. #13
    Join Date
    May 2014
    Posts
    11

    Re: while/endwhile constructs do longer work

    Problem is: I have a MK2/4 board. I suppose it is not supported by TNG. Am I wrong?
    Unluckly, I bought the MK2/4 board many years ago but I have completed my cnc project only this year!

Similar Threads

  1. Z levels no longer work after update
    By justCNCit in forum MadCAM
    Replies: 2
    Last Post: 07-31-2017, 04:34 AM
  2. CNC Router Work Station
    By StgIIIWi in forum For Sale Only
    Replies: 0
    Last Post: 06-09-2015, 07:06 PM
  3. O codes and WHILE/ENDWHILE loops
    By greybeard in forum G-Code Programing
    Replies: 1
    Last Post: 04-05-2010, 09:53 AM
  4. WHILE, ENDWHILE, Case, switch
    By haecker1 in forum SIEMENS -> Sinumerik 802D/808D/810D/828D/840D
    Replies: 2
    Last Post: 08-30-2008, 08:35 AM
  5. No longer Looking for work around Arlington, TX
    By Rick57 in forum Employment Opportunity
    Replies: 0
    Last Post: 04-22-2006, 04:23 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •