nat_wheatley
01-21-2012, 07:08 AM
I created the program below to drill pull holes, and pilot holes, in the backside of drawer fronts. Program works fine, but after every 3 or 4 fronts I get an error message to the effect of 'Too many Gosubs...' I believe I get the message right after I've answerered the 3 questions at the beginning of the file. Anyone know how I can restructure things to avoid this? Thanks.
'Drill Drawer Front - Pull
C#,90
&Border=4.675 'X and Y Fence Offset
'Table Fences Extended?
Pause
Gosub Get_Data
GOSUB Drill_Holes
End
Get_Data:
Input "Pull Width (mm)" &CC
Input "Drawer Front Width (Inches)" &DFW
Input "Drawer Front Height (Inches)" &DFH
Gosub Drill_Holes
Drill_Holes:
JZ,76
'Drill Hole A - Right Pilot
J2,&DFW*25.4 - 54.13+&Border+&my_XmmDrilloffset_T32, &DFH*25.4-77+&Border+&my_YmmDrilloffset_T32
JZ,26+&my_ZmmDrilloffset_T32
SO,8,1
Pause .5
SO,6,1
MZ, 17+&my_ZmmDrilloffset_T32
SO,6,0
JZ, 25+&my_ZmmDrilloffset_T32
'Drill Hole B - Right Pull Hole
J2,((&DFW*25.4-&CC)/2)+&CC+&Border+&my_XmmDrilloffset_T32, (&DFH*25.4)/2 +&Border+&my_YmmDrilloffset_T32
SO,6,1
MZ, 3+&my_ZmmDrilloffset_T32
JZ, 25+&my_ZmmDrilloffset_T32
SO,6,0
'Drill Hole C - Left Pull Hole
J2,((&DFW*25.4-&CC)/2)+&Border+&my_XmmDrilloffset_T32, (&DFH*25.4)/2+&Border +&my_YmmDrilloffset_T32
SO,6,1
MZ, 3+&my_ZmmDrilloffset_T32
JZ, 25+&my_ZmmDrilloffset_T32
SO,6,0
'Drill Hole D - Bottom Reference
J2,(&DFW*25.4)/2+&Border+&my_XmmDrilloffset_T32,&DFH*25.4-20+&Border+&my_YmmDrilloffset_T3
SO,6,1
MZ, 17+&my_ZmmDrilloffset_T32
SO,6,0
JZ, 25+&my_ZmmDrilloffset_T32
'Drill Hole A - Left Pilot
J2,54.13+&Border+&my_XmmDrilloffset_T32, &DFH*25.4-77 +&Border+&my_YmmDrilloffset_T32
SO,6,1
MZ, 17+&my_ZmmDrilloffset_T32
SO,6,0
JZ, 25+&my_ZmmDrilloffset_T32
SO,8,0
JY,304
Gosub Message
Return
Message:
MSGBOX ( Same size or different?, YesNoCancel, Next Front)
IF &MSGANSWER = Yes then GOSUB Drill_Holes
IF &MSGANSWER = No then GOSUB Get_Data
CN,99
End
'Drill Drawer Front - Pull
C#,90
&Border=4.675 'X and Y Fence Offset
'Table Fences Extended?
Pause
Gosub Get_Data
GOSUB Drill_Holes
End
Get_Data:
Input "Pull Width (mm)" &CC
Input "Drawer Front Width (Inches)" &DFW
Input "Drawer Front Height (Inches)" &DFH
Gosub Drill_Holes
Drill_Holes:
JZ,76
'Drill Hole A - Right Pilot
J2,&DFW*25.4 - 54.13+&Border+&my_XmmDrilloffset_T32, &DFH*25.4-77+&Border+&my_YmmDrilloffset_T32
JZ,26+&my_ZmmDrilloffset_T32
SO,8,1
Pause .5
SO,6,1
MZ, 17+&my_ZmmDrilloffset_T32
SO,6,0
JZ, 25+&my_ZmmDrilloffset_T32
'Drill Hole B - Right Pull Hole
J2,((&DFW*25.4-&CC)/2)+&CC+&Border+&my_XmmDrilloffset_T32, (&DFH*25.4)/2 +&Border+&my_YmmDrilloffset_T32
SO,6,1
MZ, 3+&my_ZmmDrilloffset_T32
JZ, 25+&my_ZmmDrilloffset_T32
SO,6,0
'Drill Hole C - Left Pull Hole
J2,((&DFW*25.4-&CC)/2)+&Border+&my_XmmDrilloffset_T32, (&DFH*25.4)/2+&Border +&my_YmmDrilloffset_T32
SO,6,1
MZ, 3+&my_ZmmDrilloffset_T32
JZ, 25+&my_ZmmDrilloffset_T32
SO,6,0
'Drill Hole D - Bottom Reference
J2,(&DFW*25.4)/2+&Border+&my_XmmDrilloffset_T32,&DFH*25.4-20+&Border+&my_YmmDrilloffset_T3
SO,6,1
MZ, 17+&my_ZmmDrilloffset_T32
SO,6,0
JZ, 25+&my_ZmmDrilloffset_T32
'Drill Hole A - Left Pilot
J2,54.13+&Border+&my_XmmDrilloffset_T32, &DFH*25.4-77 +&Border+&my_YmmDrilloffset_T32
SO,6,1
MZ, 17+&my_ZmmDrilloffset_T32
SO,6,0
JZ, 25+&my_ZmmDrilloffset_T32
SO,8,0
JY,304
Gosub Message
Return
Message:
MSGBOX ( Same size or different?, YesNoCancel, Next Front)
IF &MSGANSWER = Yes then GOSUB Drill_Holes
IF &MSGANSWER = No then GOSUB Get_Data
CN,99
End