PDA

View Full Version : help with loop



butch
06-16-2010, 10:48 AM
I realize this is very basic, but I have not been successful doing this to this point. Either the spindle stops or the loop goes to end.
Thanks for any help.

I am trying to make a loop that ends with a typed N or reruns the file with a Y and does not stop the spindle in between.
I need to [Start program (normal)]
[Run program]
at end of file
[move spindle to x=20,y=20,z=1.5]
[leave spindle running]
[ask if want to run another cut]
[Y=start program]
[N=stop spindle go to x=6,y=30, z=3]

Below is one of the files I would like to run like this so I can do repeated cuts with out starting and stoping the spindle each time.

'9.5xMS,2.0,0.5
SO,1,1
'Dovetail Back Pocket 10.5wx9.5 Oval board / Zero top Y&X=0 / 1-2 Dovetail'
PAUSE
MS,2.0,0.5
JZ,1.500
J2,5.25000,9.85000
J3,5.25000,9.85,1.5000
M3,5.25000,9.85,-0.4000
M3,6.22,9.85,-0.4000
M3,6.22,7.1,-0.4000
M3,6.22,7.4,-0.4000
M3,5.85,7.4,-0.400
M3,5.85,9.85,-0.40
M3,5.450,9.85,-0.40
M3,5.450,7.4,-0.40
M3,5.050,7.4,-0.40
M3,5.050,9.85,-0.40
M3,4.65,9.85,-0.40
M3,4.65,7.4,-0.40
M3,4.28,7.4,-0.4000
M3,4.28,7.1,-0.4000
M3,4.28,9.85,-0.4000
M3,4.35,7.339,-0.40
M3,6.1,7.339,-0.40
M3,5.25,9.85,-0.4000
J3,5.25,9.85,1.5000
SO,1,0
JZ,3.000
J2,6.000000,30.000000

srwtlc
06-16-2010, 04:11 PM
Butch,

Either one of these should do what you want. The MSGBOX one won't work with SB3 versions 3.4.27PRT and older. You can place the REPEAT where desired. Remove the ' marks for the one you want to try.



'9.5xMS,2.0,0.5
SO,1,1
'Dovetail Back Pocket 10.5wx9.5 Oval board / Zero top Y&X=0 / 1-2 Dovetail'
PAUSE

REPEAT:

MS,2.0,0.5
JZ,1.500
J2,5.25000,9.85000
J3,5.25000,9.85,1.5000
M3,5.25000,9.85,-0.4000
M3,6.22,9.85,-0.4000
M3,6.22,7.1,-0.4000
M3,6.22,7.4,-0.4000
M3,5.85,7.4,-0.400
M3,5.85,9.85,-0.40
M3,5.450,9.85,-0.40
M3,5.450,7.4,-0.40
M3,5.050,7.4,-0.40
M3,5.050,9.85,-0.40
M3,4.65,9.85,-0.40
M3,4.65,7.4,-0.40
M3,4.28,7.4,-0.4000
M3,4.28,7.1,-0.4000
M3,4.28,9.85,-0.4000
M3,4.35,7.339,-0.40
M3,6.1,7.339,-0.40
M3,5.25,9.85,-0.4000
J3,5.25,9.85,1.5000
SO,1,0
JZ,3.000
J2,6.000000,30.000000

J2,20.00,20.00,1.50


'Use this one with SB3 Versions newer than 3.4.27PRT
'MSGBOX(Would you like to run another?,3,Repeat)
'If &msganswer = YES Then GOTO REPEAT
'If &msganswer = NO Then END

'This one will work with all SB3 versions
'INPUT "Would you like to run another?" &answer
'If &answer = Y Then GOTO REPEAT
'If &answer = N Then END

ken_rychlik
06-16-2010, 04:54 PM
You can do a pause with either continue or cancel.

Take out the SO,1,0 and it will leave the spindle running.

If you hit cancel the spindle will shut down with the file anyway, so you don't really need it in there.

Kenneth

butch
06-17-2010, 01:13 PM
Thanks for the help.
The trick was the MSGBOX. I forgot it saved to msganswer, and wasn't getting the right answer saved.
This is how I fixed it.
Again, thanks for the help, as usual all it takes is couple of suggestions to let you know what you are doing wrong.
It now runs the file for the first cut, goes to 20,20 and sits until I can change the board out, then I hit Y and it makes another cut. When done, I hit N and it shuts off the spindle and goes to the bit change location and shuts down.

'9.5xMS,2.0,0.5
SO,1,1
'Dovetail Back Pocket 10.5wx9.5 Oval board / Zero top Y&X=0 / 1-2 Dovetail'
PAUSE

REPEAT:

MS,2.0,0.5
JZ,1.500
J2,5.25000,9.85000
J3,5.25000,9.85,1.5000
M3,5.25000,9.85,-0.4000
M3,6.22,9.85,-0.4000
M3,6.22,7.1,-0.4000
M3,6.22,7.4,-0.4000
M3,5.85,7.4,-0.400
M3,5.85,9.85,-0.40
M3,5.450,9.85,-0.40
M3,5.450,7.4,-0.40
M3,5.050,7.4,-0.40
M3,5.050,9.85,-0.40
M3,4.65,9.85,-0.40
M3,4.65,7.4,-0.40
M3,4.28,7.4,-0.4000
M3,4.28,7.1,-0.4000
M3,4.28,9.85,-0.4000
M3,4.35,7.339,-0.40
M3,6.1,7.339,-0.40
M3,5.25,9.85,-0.4000
J3,5.25,9.85,1.5000
MS,5.0,.05
MSGBOX(Run another cutout?,3,REPEAT)
If &msganswer = YES then GOTO REPEAT
If &msganswer = NO Then GOTO FINISH
FINISH:
SO,1,0
JZ,3.0
J2,6.000000,30.000000
'
'Turning router OFF