PDA

View Full Version : Looping a file



Keith Larrett
08-09-2015, 07:04 PM
I would like to learn how to loop or repeat a file.

I purchased JointCam and have my jig set up, the software configured and am a happy camper cutting dovetails. The software and documentation behind it is very impressive!

The following file is an example of cutting the tail boards. I would like to have it repeat. I'd like for the machine to move to 0,0 and for the spindle to not turn off. Then I'd like a comment box to pop up asking "change the tail board" and when I click ok, after switching the tail board in the jig, the file would run again, and again, and again etc

Any help on what I need to add to the file to achieve this would be much appreciated!

'( Code created by JointCAM )
G40
SA
'( Left Tails )
'( Stock Width = 2.95 )
'( Side Thickness = 0.51 )
'( Tool #12 - 8 Degree Dovetail Bit )
'( Diameter = 0.375 )
'( Length = 0.5 )
JZ, 1.0000
TR 12000
SO, 1,1
PAUSE 3
MS, 0.7, 0.7
J2, 0.0525, 17.0500
JZ, -0.3319
M2, 0.0525, 20.6000
J2, -0.0913, 17.1063
M2, 0.9250, 17.1063
M2, 0.9250, 17.2750
M2, 0.3775, 17.2750
CG, , 0.0552, 17.5973, 0.0000, 0.3223, T, 1
CG, , 0.3775, 17.9196, 0.3223, 0.0000, T, 1
M2, 0.7938, 17.9196
M2, 0.3775, 17.9196
CG, , 0.0552, 18.2419, 0.0000, 0.3223, T, 1
M2, 0.0552, 18.3669
CG, , 0.3775, 18.6892, 0.3223, 0.0000, T, 1
M2, 0.7938, 18.6892
M2, 0.7938, 18.8108
M2, 0.3775, 18.8108
CG, , 0.0552, 19.1331, 0.0000, 0.3223, T, 1
M2, 0.0552, 19.2581
CG, , 0.3775, 19.5804, 0.3223, 0.0000, T, 1
M2, 0.7938, 19.5804
M2, 0.3775, 19.5804
CG, , 0.0552, 19.9027, 0.0000, 0.3223, T, 1
CG, , 0.3775, 20.2250, 0.3223, 0.0000, T, 1
M2, 0.9250, 20.2250
J2, -0.1850, 20.2250
JZ, 0.1250
SO, 1,0
M5
JZ, 2.7500
J2, 0.0000, 0.0000
END

srwtlc
08-09-2015, 07:41 PM
Keith, if you're using SB 3.8.XX, take a look at the PAUSE UNTIL command in the programming handbook, found in the ShopBot directory. If you need more help, come back for more.

If desired, you can set it up with a momentary button also. I use this method extensively.

knight_toolworks
08-09-2015, 08:01 PM
put begin: where you want it to start again. and before the jog home and stop put pause and a time if yo want a time if not enter gets it going then goto begin. you can have the spindle stop and start again if you put the being before the tr command and the pause after the spindle stop.

srwtlc
08-09-2015, 08:40 PM
Oh yeah, Steve's right, I should have mentioned that you need to use a label and a GOTO along with the PAUSE UNTIL.

Here's a quick sample.....

REPEAT:

Body of code

PAUSE UNTIL
GOTO REPEAT

Or if you use a button,

PAUSE UNTIL 1,1 (or whatever switch # used)
GOTO REPEAT

Keith Larrett
08-09-2015, 09:04 PM
Ok. Thanks to both of you. I think I have it figured out. I found the following thread as well.

Cycle Start Button (http://www.talkshopbot.com/forum/showthread.php?19683-Cycle-Start-button-with-Shopbot)

The first thing I did with the file was to move the SO, 1,0 to the second last line of the file.

Then I added Begin: towards the beginning of the file.

Then I added

' Did you reload the jig? .... (Hit OK or ENTER when Ready to Continue)
PAUSE
GOTO Begin

just after it had made the move back to the home position.

So, will the following achieve what I need?

'( Code created by JointCAM )
G40
SA
'( Left Tails )
'( Stock Width = 2.95 )
'( Side Thickness = 0.51 )
'( Tool #12 - 8 Degree Dovetail Bit )
'( Diameter = 0.375 )
'( Length = 0.5 )
JZ, 1.0000
TR 12000
SO, 1,1
PAUSE 3
Begin:
MS, 0.7, 0.7
J2, 0.0525, 17.0500
JZ, -0.3319
M2, 0.0525, 20.6000
J2, -0.0913, 17.1063
M2, 0.9250, 17.1063
M2, 0.9250, 17.2750
M2, 0.3775, 17.2750
CG, , 0.0552, 17.5973, 0.0000, 0.3223, T, 1
CG, , 0.3775, 17.9196, 0.3223, 0.0000, T, 1
M2, 0.7938, 17.9196
M2, 0.3775, 17.9196
CG, , 0.0552, 18.2419, 0.0000, 0.3223, T, 1
M2, 0.0552, 18.3669
CG, , 0.3775, 18.6892, 0.3223, 0.0000, T, 1
M2, 0.7938, 18.6892
M2, 0.7938, 18.8108
M2, 0.3775, 18.8108
CG, , 0.0552, 19.1331, 0.0000, 0.3223, T, 1
M2, 0.0552, 19.2581
CG, , 0.3775, 19.5804, 0.3223, 0.0000, T, 1
M2, 0.7938, 19.5804
M2, 0.3775, 19.5804
CG, , 0.0552, 19.9027, 0.0000, 0.3223, T, 1
CG, , 0.3775, 20.2250, 0.3223, 0.0000, T, 1
M2, 0.9250, 20.2250
J2, -0.1850, 20.2250
JZ, 0.1250
M5
JZ, 2.7500
J2, 0.0000, 0.0000
' Did you reload the jig? .... (Hit OK or ENTER when Ready to Continue)
PAUSE
GOTO Begin
SO, 1,0
END

srwtlc
08-09-2015, 11:10 PM
Should work fine, run it and see if it behaves the way you want it to. You can delete the last two lines or comment them out with ('). There are a few ways to do looping, if it works to your liking, your good to go. I have a small momentary button on the gantry that I push to repeat (using PAUSE UNTIL 1,1) and when finished, either hit the spacebar or enter to stop the loop and close the file.

Keith Larrett
08-10-2015, 07:14 AM
It works perfectly! Thanks again to both of you for your help! Knowing how to do this will help, not just with running this file, but in many other applications.


I have a small momentary button on the gantry that I push to repeat (using PAUSE UNTIL 1,1) and when finished, either hit the spacebar or enter to stop the loop and close the file.

Is this a switch that is hard wired into the control board that activates one of your input switches? Where did you get it?

srwtlc
08-10-2015, 10:48 AM
Yes, just a little momentary switch that is wired to one of the inputs on the board. Mine is just wired in to the same input as the zzero plate (#1), but you can use any open input #. I got it at Radio Shack years ago. This one at Jameco (http://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_315651_-1) is similar if not the same one.

feinddj
08-10-2015, 10:04 PM
You can also add conditional statements, repeat or change settings. just make sure that it works before you put your material down and turn it on!

David