View Full Version : Gosub or count routine???

11-29-2008, 06:14 PM
I know this has been posted, but can't seem to sort it out. Have not be able to grasp gosubs and variables.
I understand what its supposed to do, but get lost in the language.
Could anyone point me where on the forum that I can learn how to uses these features?
I'd like to see the whole files not just snippets.

Do I create a main file then put the gosub routine?
And where do I put the counter (I'm assuming with a variable)

I have a file where the part is located at x10 y30
After its finished I'd like for it to move to x30 y30 and pause for x seconds and run the same file again.
I have 100 plus peices of the same file.
Any direction?

Gary Campbell
11-29-2008, 08:22 PM
Try modifying this to meet your needs:

'Don's repeatable file runner
'ShopBot Parts file in inches
'Determine whether we are in Preview mode or Move/Cut mode
&modenow = %(22)
IF &modenow = 1 THEN GOSUB Changemode

'Load the custom variables file from Custom Cut 90
'=========initialize variables=============
&answer = 0
&part_location_X = 10
&part_location_Y = 30
&park_X = 30
&park_Y 30
&xy_move_speed = **fill in**
&z_move_speed = **fill in**
'+++++++++++++++++Program Lines++++++++++

Gary Campbell
11-29-2008, 08:27 PM
I forgot to mention that I didnt put in the pause for X seconds. What if it takes X+2 seconds to change out the parts? Better off with a keystroke.

11-30-2008, 09:06 AM
Hi Don,

Don't know if this will help, but there's an introduction to using variables in a "Bill's Corner" article.



11-30-2008, 09:37 AM
Thanks for the quick response.
I was able to run your file through VisEdit.
I had to comment out a few lines to make it work like I wanted it to.
The true test will be this afternoon.
I guess I need force myself to learn to create code like that, I can see how powerful it is.

Thanks for the link I'll make sure thats the first place I'll start my schooling.

Again thanks to both of you and everyone else that contributes to the forum

12-01-2008, 11:51 PM
Thanks again for that link, I was finally able to find time to sit down with no distractions and get a lot of good out of your corner.

Gary, I do appreciate the time and effort you took to put that code together.

This was the second time that I ran this project. (looks as if it'll be a repeat project every other month)
The project is a 12" x 3.75" red oak trim peice that covers the hinges for a handle on the ends of solid oak caskets)
By tweaking the cut file, lowering the safe Z height, tuning the feedrate, and adding Your code that allowed me to loop my cutfile.
I was able to cut the total project time literally in half.

Thank you Gary, That was very rewarding, as it cut my time in half and doubled my hourly rate.
I need to find away to hang out here a little more and hope some more of this coding will sink in. Again Thanks.