Resuming after a stop in a WHILE loop

More
22 Jan 2012 21:50 #17026 by Robo-Dan
Hi guys,

I am producing a large array of parts using while loops and it takes several hours to complete the array of parts. As is always the case, there can be something that goes wrong half way through machining and I have to stop the program. I would like to be able to resume the program where it left off within the while loops, but it always starts back up at the beginning. You can imagine how frustrating that would be.

The rows and columns of my array are written to parameters #21 and #22 and those parameters are used for incrementing my WHILE loops.
After a stop, I've tried manually writing the values of the current part in the array into the MDI (ie. #21 = 2 , #22 =4) and also manually input the offset where the tool should be for the current part. Then selected 'run from here' on the current line inside the while loop. However, the program still just starts over at the beginning of the while loop. Anybody have any ideas as to how I can fix this?

Thanks,

Dan

Please Log in or Create an account to join the conversation.

More
23 Jan 2012 11:39 #17040 by BigJohnT
When run from line was written I don't think loops were part of the code so it does not function well with loops.

Is there a way to restructure your g code so your not restarting inside of the while loop?

John

Please Log in or Create an account to join the conversation.

More
23 Jan 2012 23:43 #17071 by andypugh
Robo-Dan wrote:

Anybody have any ideas as to how I can fix this?


I have just experimented with the following, and can't make any sense of it.

(debug, #1)
o100 while [#1 LT 4]
o101 while [#2 LT 4]
(debug, #1 #2)
g0 x0
#2 = [#2 + 1]
o101 endwhile
#1 = [#1 + 1]
o100 endwhile
m2

Though one solution might be to write the code like this:

#100 = 2
#101 = 2

#1 = #101
o100 while [#1 LT 4]
#2 = 1
o103 IF [#101 NE 1]
#2 = #101
#101 = 1
o103 endif
o101 while [#2 LT 4]
(debug, #1 #2)
g0 x0
#2 = [#2 + 1]
o101 endwhile
#1 = [#1 + 1]
o100 endwhile
m2

Then you can edit the #100 and #101 variables in the code and run from the start.
The "IF" is so that it starts the next Y row from the beginning even if it starts from the middle of this row.

Please Log in or Create an account to join the conversation.

Time to create page: 0.312 seconds
Powered by Kunena Forum