M & G Code Sample File
M & G Code Sample File
Sample File 1
The following is a 5" square. Rapid level .5 inches above material, feed down 60 IPM, cut feed 200 IPM, rapid down to .1 above material, depth .25 inches. This is for a single head system with manual tool change (The manual tool change is highlighted in Gray below and is optional.)
Machine Code
M90 G90 G75 G97 S18000 G00 T1 G00 CE-MILL .2500 2FL.
// This file is for a non atc system A line that begins with // is a comment line.
G00 Z-0.1 G01 Z0.25 F1. G01 X5. F3.333 G01 Y5. G01 X0. G01 Y0. G00 Z-0.5 M22
G00 X6.0394 Y6.0394 M38 Lowers the drill bank into place and turns on the drill motor G00 X6.0394 Y6.0394 Z-0.5 Moves X and Y so that boring drill one is centered at X = 6.0394 Y = 6.0394 and Z is 0.5 inches above the materials surface. G98 P300 D496 Engages drills 5, 6, 7, 8, and 9. G00 Z-0.1 Slew Move in Z to .1 inches above the material G01 Z0.4 F1.333 Plunge the Z axis .4 inches into the material at 80 IPM G00 Z-0.5 Slew Move in Z to .5 inches above the material G00 X6.0394 Y8.5591 Move X and Y and continue to drill more holes with the same engaged drills G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X6.0394 Y11.0787 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X6.0394 Y12.3386 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X6.0394 Y13.5984 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X6.0394 Y14.8583 Z-0.5 G98 P300 D480 Engages drills 6, 7, 8, and 9. G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X6.0394 Y16.1181 Z-0.5 G98 P300 D448 Engages drills 7, 8, and 9. G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X6.0394 Y17.378 Z-0.5 G98 P300 D384 Engages drills 8 and 9. G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X6.0394 Y18.6378 Z-0.5 G98 P300 D256 Engages drill 9. G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X12.3386 Y12.3386 Z-0.5 G98 P300 D31 Engages drills 1, 2, 3, 4, and 5. G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X12.3386 Y6.0394 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X13.5984 Y6.0394 G00 Z-0.1 G01 Z0.4 F1.333
G00 Z-0.5 G00 X14.8583 Y6.0394 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X16.1181 Y6.0394 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X17.378 Y6.0394 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 G00 X18.6378 Y6.0394 G00 Z-0.1 G01 Z0.4 F1.333 G00 Z-0.5 M48 Retract all boring drills, Retract Drill Bank, turn off drill bank G97 S24000 G00 T3 G00 X18. Y12.875 Z-0.5 M12 G00 Z-0.1 G01 Z0.5 F1.667 G02 I18. J12. F3.333 G00 Z-0.5 M22 G00 X22. Y8.375 Z-0.5 M12 G00 Z-0.1 G01 Z0.5 F1.667 G02 I22. J7. F3.333 G00 Z-0.5 M22 G97 S18000 G00 T1 G00 X0. Y-0.25 Z-0.5 M12 G00 Z-0.1 G01 Z0.77 F1.667 G01 X25. F13.333 G03 X25.25 Y0. I25. J0. G01 Y15. G03 X25. Y15.25 I25. J15. G01 X0. G03 X-0.25 Y15. I0. J15. G01 Y0. G03 X0. Y-0.25 I0. J0. G00 Z-0.5 M22 G00 X35.0 Y0.0 M02
Note that before all Cutter Compensation, G41\G42, will work the cut MUST start with a lead in and end with a lead out. The type of compensation that is applied depends on the direction you have selected. If the cut is going clockwise in the inside of a pocket, then the machine should be compensated to the RIGHT (G42), if it is going clockwise on the outside of a contour, then it should be set to LEFT (G41), and so on. N10 M90 N20 G90 N40 G75 N50 G97 S24000 N60 G00 T1 N70 G00 Z-0.5 N80 G00 X-0.25 Y-0.25 N90 M12 N100 G00 Z-0.1 N110 G01 Z0.5 F1. N120 G42 N130 G02 X-0.125 Y-0.125 I-0.125 J-0.25 F3.333 N140 G01 X10.125 N150 G01 Y10.125 N160 G01 X-0.125 N170 G01 Y-0.125 N180 G02 X-0.25 Y-0.25 I-0.25 J-0.125 N190 G40 N200 G00 Z-0.5 N210 M22 N220 G00 X0. Y0. N230 M02 Program Start Absolute coordinate system Use absolute mode (G90 from above) for arcs Set spindle speed to 24000 RPM Select Tool #1 Rapid move to safe rapid level Rapid move Device on code rapid move feed move to final depth, feedrate 1 inch per second set cutter comp right ON lead in arc feed move feed move feed move feed move lead out arc set cutter comp OFF retract to safe rapid level device off code move to home position end of job code
N10 M90 N20 G90 N30 G75 N40 G97 S18000 N50 G00 T2 N60 G00 Z-0.5 N70 G00 X5.125 Y10.25 N80 M12 N90 G00 Z-0.1 N100 G01 Z0.5 F1.
Program Start Absolute coordinate system Use absolute mode (G90 from above) for arcs Set spindle speed to 18000 RPM Select Tool #2 Rapid move to safe Z level rapid move device on rapid move feed move to final depth, feedrate 1
inch per second N110 G42 N120 G02 X5. Y10. I5. J10.25 F3.333 N130 G03 I5. J5. N140 G02 X4.75 Y10.25 I5. J10.25 N150 G40 N160 G00 Z-0.5 N170 M22 N180 G00 X0. Y0. N190 M02 set cutter comp right ON lead in arc feed move circle lead out arc set cutter comp OFF retract to safe rapid level device off code move to home position end of job code
N10 M90 N20 G90 N30 G75 N40 G97 S24000 N50 G00 T2 N60 G00 Z-0.5 N70 G00 X5.125 Y7.75 N80 M12 N90 G00 Z-0.1 N100 G01 Z0.5 F1. N110 G41 N130 G03 I5. J5. N140 G03 X4.875 Y7.75 I5. J7.75 N150 G40 N160 G00 Z-0.5 N170 M22 N180 G97 S18000 N190 G00 T1 N200 G00 Z-0.5 N210 G00 X-0.375 Y-0.125 N220 M12 N230 G00 Z-0.1 N240 G01 Z0.5 F1. N250 G42 N260 G01 X0. F3.333
Program Start Absolute coordinate system Use absolute mode (G90 from above) for arcs Set spindle speed to 24000 RPM Select Tool #2 Rapid move to safe Z level rapid move device on rapid move feed move to final depth, feedrate 1 inch per second set cutter comp left ON feed move lead out arc set cutter comp OFF retract to safe rapid level device off code Set spindle speed to 18000 RPM select tool #1 Rapid move to safe Z level rapid move device on rapid move feed move to final depth, feedrate 1 inch per second set cutter comp right ON lead in line feedrate 200 inched per
minute N270 G01 X10. N280 G03 X10.125 Y0. I10. J0. N290 G01 Y10. N300 G03 X10. Y10.125 I10. J10. N310 G01 X0. N320 G03 X-0.125 Y10. I0. J10. N330 G01 Y0. N340 G03 X0. Y-0.125 I0. J0. N350 G02 X0.125 Y-0.25 I0. J-0.25 N360 G40 N370 G00 Z-0.5 N380 M22 N390 G00 X0. Y0. N400 M02 feed move line feed move arc feed move line feed move arc feed move line feed move arc feed move line feed move arc lead out arc set cutter comp OFF Rapid move to safe Z level device off code move to home position end of job code
N210 M22 N220 G00 X4. Y1. N230 M12 N250 G00 Z-0.5 N260 M22 N270 G00 X5. Y1. N280 M12 N300 G00 Z-0.5 N310 M22 N320 G97 S12000 N330 G00 T11 N340 G00 Z-0.5 N350 G00 X1. Y4. N360 M11 N370 M21 N380 G00 X2. Y4. N390 M11 N400 M21 N410 G00 X3. Y4. N420 M11 N430 M21 N440 G00 X4. Y4. N450 M11 N460 M21 N470 G00 X5. Y4. N480 M11 N490 M21 N500 G97 S18000 N510 G00 T2 N520 G00 Z-0.5 N530 G00 X-0.5 Y3. N540 M12 N550 G00 Z-0.1 N560 G01 Z0.375 F1. N570 G01 X0. F6.667 N580 G01 X12. N590 G01 X12.5 N600 G00 Z-0.5
device off rapid XY move device on rapid Z move device off rapid XY move device on rapid Z move device off set spindle speed to 12000 RPM select tool # 11 (a pneumatic drill) rapid Z move rapid XY move fire drill retract drill rapid XY move fire drill retract drill rapid XY move fire drill retract drill rapid XY move fire drill retract drill rapid XY move fire drill retract drill set spindle speed to 18000 RPM select tool # 2 rapid Z move rapid XY move device on rapid Z move feed Z move linear feed XY move linear feed XY move linear feed XY move rapid Z move
N610 M22 N620 G97 S24000 N630 G00 T5 N640 G00 Z-0.5 N650 G00 X-0.563 Y-0.187 N660 M12 N670 G00 Z-0.1 N680 G01 Z0.75 F1. N690 G42 N700 G01 X0. Y-0.188 F8.333 N710 G01 X12. N720 G03 X12.188 Y0. I12. J0. N730 G01 Y6. N740 G03 X12. Y6.188 I12. J6. N750 G01 X0. N760 G03 X-0.188 Y6. I0. J6. N770 G01 Y0. N780 G03 X0. Y-0.188 I0. J0. N790 G02 X0.188 Y-0.375 I0. J0.375 N800 G40 N810 G00 Z-0.5 N820 M22 N830 G00 X0. Y0. N840 M02
device off set spindle speed to 24000 RPM select tool # 5 rapid Z move rapid XY move device on rapid Z move feed down Z move turn on cutter comp right linear feed XY move linear feed XY move arc feed XY move linear feed XY move arc feed XY move linear feed XY move arc feed XY move linear feed XY move arc feed XY move lead out arc cutter comp off rapid Z move device off rapid XY move End of Job