Hi,
I need to teach a lot of holes to cut with a spindle. I've solved my need with a small helper program that takes the hole diameter as parameter. When called it makes a user frame for itself from the current tool position, and cuts a hole with the given D on the tool's X and Y axis. Thus when teaching I now only need to move the tool to the center point and point the tool so that it's perpendicular from the part's surface.
Here's the code. It may not be the prettiest code, but it's mine
Some comments since they're missing from the program:
Lines 1-7 save whatever is in UF1 to PR98, set UF1 to current position
Lines 9-11 calculate the circle radius (taking into account the offset from a 4mm cutter)
Then we set into PR the points we want to travel through, and finally travel through them
Lines 62- set back whatever there was in UF1 before we started
1: ;
2: UFRAME_NUM=0 ;
3: $PR_CARTREP=1 ;
4: PR[98]=UFRAME[1] ;
5: PR[99]=LPOS ;
6: UFRAME[1]=PR[99] ;
7: UFRAME_NUM=1 ;
8: ;
9: R[11]=AR[1]-4 ;
10: R[11]=R[11]/2 ;
11: R[12]=0-R[11] ;
12: ;
13: PR[1,1]=R[12] ;
14: PR[1,2]=0 ;
15: PR[1,3]=0 ;
16: PR[1,4]=0 ;
17: PR[1,5]=0 ;
18: PR[1,6]=0 ;
19: ;
20: PR[2,1]=R[11] ;
21: PR[2,2]=R[11] ;
22: PR[2,3]=0 ;
23: PR[2,4]=0 ;
24: PR[2,5]=0 ;
25: PR[2,6]=0 ;
26: ;
27: PR[3,1]=R[11]*2 ;
28: PR[3,2]=0 ;
29: PR[3,3]=0 ;
30: PR[3,4]=0 ;
31: PR[3,5]=0 ;
32: PR[3,6]=0 ;
33: ;
34: PR[4,1]=R[12] ;
35: PR[4,2]=R[12] ;
36: PR[4,3]=0 ;
37: PR[4,4]=0 ;
38: PR[4,5]=0 ;
39: PR[4,6]=0 ;
40: ;
41: PR[5,1]=R[12]*2 ;
42: PR[5,2]=0 ;
43: PR[5,3]=0 ;
44: PR[5,4]=0 ;
45: PR[5,5]=0 ;
46: PR[5,6]=0 ;
47: ;
48: PR[6,1]=R[11]*1 ;
49: PR[6,2]=0 ;
50: PR[6,3]=(-8) ;
51: PR[6,4]=0 ;
52: PR[6,5]=0 ;
53: PR[6,6]=0 ;
54: ;
55:L P[1] R[1]mm/sec CNT100 INC ;
56: ;
57:L PR[1] 100mm/sec FINE INC ;
58:L P[6] R[1]mm/sec FINE INC ;
59:C PR[2]
: PR[3] R[1]mm/sec CNT100 INC ;
60:C PR[4]
: PR[5] R[1]mm/sec FINE INC ;
61:L PR[6] 100mm/sec FINE INC ;
62: ;
63: UFRAME[1]=PR[98] ;
64: $PR_CARTREP=1 ;
65: ;
Display More