Example
This example combines various control structures with each other, and also uses nesting:
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
0 BEGIN PGM EXAMPLE MM | |||
1 * - ... | ; The purpose of this program is to finish the milling of hardened workpieces | ||
2 Q1400 = +19.995 | ; Lower tolerance | ||
3 Q1401 = +20 | ; Nominal dimension | ||
4 Q1402 = +20.005 | ; Upper tolerance | ||
5 BLK FORM 0.1 Z X-50 Y-50 Z-20 | |||
6 BLK FORM 0.2 X+50 Y+50 Z+0 | |||
7 CALL LBL "measure" | ; Measure circular pocket | ||
8 IF Q966 < Q1400 | ; Check whether circular pocket is smaller than the lower tolerance | ||
9 WHILE Q966 < Q1400 | ; Program loop for reworking the circular pocket | ||
10 CALL LBL "rework" | ; Mill the circular pocket | ||
11 CALL LBL "measure" | ; Measure circular pocket | ||
12 END WHILE | ; End of the program loop | ||
13 ELSE | ; If the condition in NC block 8 is not fulfilled, the circular pocket is larger than the lower tolerance | ||
14 IF Q966 <= Q1402 | ; Check whether circular pocket is larger than the upper tolerance | ||
15 FN 16: F-PRINT pass.a / SCREEN: | ; Output on screen: Circular pocket is OK | ||
16 ELSE | ; If the condition in NC block 14 is not fulfilled, the circular pocket is larger than the upper tolerance | ||
17 FN 16: F-PRINT scrap.a / SCREEN: | ; Output on screen: Circular pocket is too large | ||
18 END IF | |||
19 END IF | |||
20 L Z+100 R0 FMAX | |||
21 M30 | |||
22 LBL "measure" | |||
23 TOOL CALL 600 Z | ; Call touch probe | ||
24 L Z+100 R0 FMAX | |||
25 TCH PROBE 1401 CIRCLE PROBING ~ | |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
26 * - ... | ; The control stores the diameter in Q966 | ||
27 LBL 0 | |||
28 LBL "rework" | |||
29 Q1500 = ( Q1401 - Q966 ) / +2 | ; Calculate tool compensation from the nominal dimension and the measured diameter | ||
30 TOOL CALL 5 Z S2000 F200 DR-Q1500 | ; Call milling tool | ||
31 L Z+100 R0 FMAX M3 | |||
32 CYCL DEF 252 CIRCULAR POCKET ~ | |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
| |||
33 L X+0 Y+0 R0 FMAX M99 | |||
34 LBL 0 | |||
35 END PGM EXAMPLE MM |