% O1234 (MAIN PROGRAM - FANUC CNC MILL BROACH KEYWAY) (Use a work offset for the broach tool by itself) (Adjust location in X or Y depending on keyway position) (Code is written from the center of the hole) (This example cuts a keyway at 12 o’clock) (This program calls a subprogram for broaching) G91 G28 Z0 T__ M06 (Enter your broach tool # here) G00 G90 G59 X0 Y0 M05 M19 G43 H__ Z1.0 (Enter height offset number here) Z0.5 M08 (*** CALCULATE TOTAL DEPTH ÷ DEPTH OF CUT ***) (Example: If keyway depth = .130 and DOC = .001 → 130 passes) (.130 ÷ .001 = 130) (Number of passes = total depth ÷ DOC) M98 P***7777 (Enter number of passes here, no spaces or decimals) (Example: M98 P1307777 for 130 passes) G00 G90 Z1.0 M09 G91 G28 Z0 G28 Y0 M30 % % O7777 (BROACH SUBPROGRAM FANUC MILL) G00 G91 Y.001 (Initial move. Change to X if broach is along X-axis) G01 G90 Z____ F____ (End point Z-depth of broach & feedrate IPM) G00 G91 Y-.300 (Retract move, same axis as initial move, opposite sign) (Value must exceed total depth of keyway) G00 Z0.5 G91 Y.300 (Return to start, opposite sign to initial move, same axis) (Value must match previous move, opposite sign) M99 %