G-Code:
EXAMPLE G-CODECNC Code% - the beginning of the program
N10 O02215 – the code label number
N20 (Haas MiniMill Demonstration) – The Machine doesn’t use anything in
parenthesis.
N30 (G54 is X Y Part Zero) – The offset number 1 is X Y part zero. The G-Code defines what type of operation machine executes.
N40 (X Y Part Zero is the CENTER of the part) – The center of the piece is located at
G54.
N50 (Material is 4" long by 2 1/2" wide by 1/2" thk. aluminum) – This holds the information on the material.
N60 (Part will be profile milled to 2.200 wide by 3.700) – This shows the dimensions of the object.
N70 (Set Z tool offsets T1 T2 T3 on the top of the part) – This demonstrates it’s to set the Z axis for the 3 tools, T1, T2, and T3 to the top of the object.
N80 (D01 is Cutter Comp for T1 .250) – This is the Diameter for tool 1.
N90 (T1 1/2" 4 flute End Mill) – This represents the tool 1 is ½ inch end mill.
N100 (T2 1/2" Spot Drill) – This represents the tool 2 is ½ inch spot drill.
N110 (T3 #3 Drill .213 Dia.) – This represents the tool 3 is a 0.213 diameter drill.
N120 (Press Option Stop for M1) – This momentarily stops a program.
N130 G17 G40 G80 G98 (circ motion xy plane, cutter comp cancel, can cycle cancel, R plane return) – Selection of XY plane.
N140 G28 G91 Z0 Y0 (machine home, incremental programming) – Returns it to the reference point and restores X and Y to zero.
M01 (optional stop) – Conditional stop.
N150 (T1 1/2" End Mill) – Prompts the user that tool 1 is ½ inch end mill.
N160 T1 M06 (tool change to T1) – Line number 10.
N170 S2200 M03 (Spindle start, 2200 RPM) – The Spindle rotates clockwise at a speed of 2200 rpm.
N180 G00 G90 G54 X-2.350 Y1.700 (rapid move, absolute programming, work offset) – G00 is the rapid transverse, G90 is the absolute dimensions, G54 moves it to point 2.350, 1.700.
N190 G43 H01 Z1. M08 (tool length offset, move, coolant on) – G43 is the tool length compensation; M08 moves Z aaxis up 1 unit and turns the coolant on.
N200 G01 Z-.150 F50. (linear move @ 50 IPM) – G01 is the Linear interpolation, Z-.150 is Z moving downward at a speed of 50 rpm.
N210 (Begin to Mill Profile) – This begins the milling process.
N220 (Activate Cutter Compensation) – This initiates the cutter compensation.
N230 G42 X-1.850 D01 F50. (tool offset right, move @ 50 IPM) – G42 is the cutter compensation moved to the right; X-1.85 moves the X downward 1.85”, and D01 is the diameter of 1”.
N240 G01 Y-.600 F10. (move 10 IPM) – G01 is the linear interpolation, Y-6.00 is Y moving downward, F10 the speed rate being fed.
N250 G03 X-1.350 Y-1.100 R.5 (circular interpolation ccw, cut ½ radius) – This is the circular interpolation spinning counter clockwise’ G03 is being done at X 1.35” and Y is 1.1”. R0.05 is the radius compensation is 0.5”.
N260 G01 X1.600 (linear move) - This is the circular interpolation spinning counter clockwise’ G03 is being done at X 1.35” and Y is 1.1”. R0.05 is the radius compensation is 0.5”.
N270 G03 X1.850 Y-.850 R.25 (circular interpolation ccw, cut ¼ radius) – The circular interpolation is counter clockwise at (1.85”, 0.85”) with a radius of 0.25.
N280 G01 Y.430 (linear move) – This is the linear interpolation on axis X.
N290 G01 X1.5375 Y1.100 (linear move , cut angle) – This is the linear interpolation on axis X, and Y axis.
N300 G01 X-2.350 (linear move) - This is the linear interpolation on axis X.
N310 (Deactivate Cutter Compensation) – Represents the next operation.
N320 G40 G01 X-2.550 F25. (cutter comp cancel, move 25 IPM) – This is positioning the
axis in rapid X and Y.
N330 G01 Z.100 F50. (linear move 50 IPM) - This is the linear interpolation on axis Z with a feed rate.
N340 (Mill 1.000 X .750 Pocket) - Represents the next operation.
N350 G00 X.675 Y.125 (rapid move) - This is positioning the axis in rapid X and Y.
N360 G01 Z-.150 F8. (linear move 8 IPM) - This is the linear interpolation on axis Z.
N370 G01 X1.175 (linear move) - This is the linear interpolation on axis X.
N380 G01 Y-.125 (linear move) - This is the linear interpolation on axis Y.
N390 G01 X.675 (linear move) - This is the linear interpolation on axis X.
N400 G01 Y.125 (linear move) - This is the linear interpolation on axis Y.
N410 G01 Z.100 F50. (linear move, 50 IPM) - This is positioning the axis Z in rapid.
N420 G00 Z1. M09 (rapid move, coolant off) – Represents the coolant is off.
N430 G28 G91 Z0. Y0. M05 (machine home, incremental, spindle stop) – Returns to the reference point, G91 sets the incremental positioning, Y0 and X0 sets the axis to 0. And the Spindle stops.
M01 (optional stop) – The operator has the option to stop the program.
N440 (T2 1/2" Spot Drill) – Stops the drill
N450 (Spot Drill 4 places) – Drills in 4 spots.
N460 T2 M06 (tool change) – Tool change to tool 2.
N470 S2000 M03 (spindle start 2000RPM) – Spindle spins in clockwise rotation at 2000 rpm.
N480 G90 G54 G00 X-.500 Y.500 (incremental programming, rapid to 1st hole location)
– G90 changes the absolute positioning from zero offset 1, positioning the axis at -0.5 and axis 0.5.
N490 G43 H02 Z1. M08 (tool height offset, move, coolant on) – The tool height offset, and the offset in a negative 2 axis Z for 1”; and M08 is the coolant.
N500 G01 Z0.1 F50. (linear move 50 IPM) - This is the linear interpolation on axis Z with a feed rate of 50.
N510 G83 G99 Z-0.110 Q0.020 R0.1 F6. (canned drill peck cycle, depth of peck, return plane) – G83 is the deep hole drilling cycle with return to retract (rapid) plane. G99 is the R level. Axis Z-0.11” and Q is the peck increment which is 0.02” with a radius compensation of 0.1” at a feed rate of 6.
N520 X-1.500 Y.500 (move to 2nd hole) – Drill at (-1.500, 0.500).
N530 X-1.500 Y-.500 (move to 3rd hole) - Drill at (-1.500, -0.500).
N540 X-.500 Y-.500 (move to 4th hole) - Drill at (-0.500, -0.500).
N550 G80 G00 Z1. M09 (canned cycle cancel, rapid move, coolant off) – cancels canned cycle and positions in rapid. From zero offset 1, axis Z 1”;M09 is coolant off.
N560 G28 G91 Z0. Y0. M05 (machine home, incremental programming, spindle stop) - Returns the reference point (machine zero); G91 sets incremental positioning. Z0 and Y0 set axis Z and axis Y to 0 and Spindle stop.
M01 (optional stop) – Operator has the choice to stop the program.
N570 (T3 Drill #3 holes) – Tool 3 is a Drill # 3 holes.
N580 (Drill 4 places) – User comment for drill action.
N590 T3 M06 (tool change) – Tool change to Tool 3
N600 S2200 M03 (spindle start 2200 RPM) – Spindle spinning clockwise at a speed of 2200.
N610 G90 G54 G00 X-.500 Y.500 (incremental programming, rapid to 1st hole location) – G90 is the Absolute dimensions, G54 is zero offset #1, G00 is rapid traverse to (-0.500 to 0.500)
N620 G43 H03 Z1. M08 (tool height offset, move, coolant on) – G43 is the tool length compensation, Tool height offset Axis Z for 1”; M08 is the coolant.
N630 G01 Z0.1 F50. (linear move 50 IPM) – Linear interpolation on Z axis for 0.1” with a federate of 50.
N640 G83 G99 Z-0.600 Q0.075 R0.1 F8. (canned drill pec cycle, depth of peck, plane return) – G83 is the fixed cycle, G99 is the axis offset on Z axis for -0.600 and a peck increment of 0.0750” with a radius of 0.1” at a feed rate of 6.
N650 X-1.500 Y.500 (move 2nd hole) – Drill at (-1.500, 0.500)
N660 X-1.500 Y-.500 (move 3rd hole) – Drill at (-1.500, -0.500)
N670 X-.500 Y-.500 (move 4th hole) – Drill at (0.500, -0.500)
N680 G00 G90 Z1. M09 (rapid move, absolute programming, coolant off) – Rapid Traverse in absolute dimensions on Z axis 1”, coolant off.
N690 G28 G91 Z0. Y0. M05 (machine home, incremental programming, spindle stop) – G28 Returns it to the reference point, incremental dimensions of Z axis and Y axis spindle off.
M30 (end of program) – This is when the Program stops, and resets to start.
% - The end of the Program
EXAMPLE G-CODECNC Code% - the beginning of the program
N10 O02215 – the code label number
N20 (Haas MiniMill Demonstration) – The Machine doesn’t use anything in
parenthesis.
N30 (G54 is X Y Part Zero) – The offset number 1 is X Y part zero. The G-Code defines what type of operation machine executes.
N40 (X Y Part Zero is the CENTER of the part) – The center of the piece is located at
G54.
N50 (Material is 4" long by 2 1/2" wide by 1/2" thk. aluminum) – This holds the information on the material.
N60 (Part will be profile milled to 2.200 wide by 3.700) – This shows the dimensions of the object.
N70 (Set Z tool offsets T1 T2 T3 on the top of the part) – This demonstrates it’s to set the Z axis for the 3 tools, T1, T2, and T3 to the top of the object.
N80 (D01 is Cutter Comp for T1 .250) – This is the Diameter for tool 1.
N90 (T1 1/2" 4 flute End Mill) – This represents the tool 1 is ½ inch end mill.
N100 (T2 1/2" Spot Drill) – This represents the tool 2 is ½ inch spot drill.
N110 (T3 #3 Drill .213 Dia.) – This represents the tool 3 is a 0.213 diameter drill.
N120 (Press Option Stop for M1) – This momentarily stops a program.
N130 G17 G40 G80 G98 (circ motion xy plane, cutter comp cancel, can cycle cancel, R plane return) – Selection of XY plane.
N140 G28 G91 Z0 Y0 (machine home, incremental programming) – Returns it to the reference point and restores X and Y to zero.
M01 (optional stop) – Conditional stop.
N150 (T1 1/2" End Mill) – Prompts the user that tool 1 is ½ inch end mill.
N160 T1 M06 (tool change to T1) – Line number 10.
N170 S2200 M03 (Spindle start, 2200 RPM) – The Spindle rotates clockwise at a speed of 2200 rpm.
N180 G00 G90 G54 X-2.350 Y1.700 (rapid move, absolute programming, work offset) – G00 is the rapid transverse, G90 is the absolute dimensions, G54 moves it to point 2.350, 1.700.
N190 G43 H01 Z1. M08 (tool length offset, move, coolant on) – G43 is the tool length compensation; M08 moves Z aaxis up 1 unit and turns the coolant on.
N200 G01 Z-.150 F50. (linear move @ 50 IPM) – G01 is the Linear interpolation, Z-.150 is Z moving downward at a speed of 50 rpm.
N210 (Begin to Mill Profile) – This begins the milling process.
N220 (Activate Cutter Compensation) – This initiates the cutter compensation.
N230 G42 X-1.850 D01 F50. (tool offset right, move @ 50 IPM) – G42 is the cutter compensation moved to the right; X-1.85 moves the X downward 1.85”, and D01 is the diameter of 1”.
N240 G01 Y-.600 F10. (move 10 IPM) – G01 is the linear interpolation, Y-6.00 is Y moving downward, F10 the speed rate being fed.
N250 G03 X-1.350 Y-1.100 R.5 (circular interpolation ccw, cut ½ radius) – This is the circular interpolation spinning counter clockwise’ G03 is being done at X 1.35” and Y is 1.1”. R0.05 is the radius compensation is 0.5”.
N260 G01 X1.600 (linear move) - This is the circular interpolation spinning counter clockwise’ G03 is being done at X 1.35” and Y is 1.1”. R0.05 is the radius compensation is 0.5”.
N270 G03 X1.850 Y-.850 R.25 (circular interpolation ccw, cut ¼ radius) – The circular interpolation is counter clockwise at (1.85”, 0.85”) with a radius of 0.25.
N280 G01 Y.430 (linear move) – This is the linear interpolation on axis X.
N290 G01 X1.5375 Y1.100 (linear move , cut angle) – This is the linear interpolation on axis X, and Y axis.
N300 G01 X-2.350 (linear move) - This is the linear interpolation on axis X.
N310 (Deactivate Cutter Compensation) – Represents the next operation.
N320 G40 G01 X-2.550 F25. (cutter comp cancel, move 25 IPM) – This is positioning the
axis in rapid X and Y.
N330 G01 Z.100 F50. (linear move 50 IPM) - This is the linear interpolation on axis Z with a feed rate.
N340 (Mill 1.000 X .750 Pocket) - Represents the next operation.
N350 G00 X.675 Y.125 (rapid move) - This is positioning the axis in rapid X and Y.
N360 G01 Z-.150 F8. (linear move 8 IPM) - This is the linear interpolation on axis Z.
N370 G01 X1.175 (linear move) - This is the linear interpolation on axis X.
N380 G01 Y-.125 (linear move) - This is the linear interpolation on axis Y.
N390 G01 X.675 (linear move) - This is the linear interpolation on axis X.
N400 G01 Y.125 (linear move) - This is the linear interpolation on axis Y.
N410 G01 Z.100 F50. (linear move, 50 IPM) - This is positioning the axis Z in rapid.
N420 G00 Z1. M09 (rapid move, coolant off) – Represents the coolant is off.
N430 G28 G91 Z0. Y0. M05 (machine home, incremental, spindle stop) – Returns to the reference point, G91 sets the incremental positioning, Y0 and X0 sets the axis to 0. And the Spindle stops.
M01 (optional stop) – The operator has the option to stop the program.
N440 (T2 1/2" Spot Drill) – Stops the drill
N450 (Spot Drill 4 places) – Drills in 4 spots.
N460 T2 M06 (tool change) – Tool change to tool 2.
N470 S2000 M03 (spindle start 2000RPM) – Spindle spins in clockwise rotation at 2000 rpm.
N480 G90 G54 G00 X-.500 Y.500 (incremental programming, rapid to 1st hole location)
– G90 changes the absolute positioning from zero offset 1, positioning the axis at -0.5 and axis 0.5.
N490 G43 H02 Z1. M08 (tool height offset, move, coolant on) – The tool height offset, and the offset in a negative 2 axis Z for 1”; and M08 is the coolant.
N500 G01 Z0.1 F50. (linear move 50 IPM) - This is the linear interpolation on axis Z with a feed rate of 50.
N510 G83 G99 Z-0.110 Q0.020 R0.1 F6. (canned drill peck cycle, depth of peck, return plane) – G83 is the deep hole drilling cycle with return to retract (rapid) plane. G99 is the R level. Axis Z-0.11” and Q is the peck increment which is 0.02” with a radius compensation of 0.1” at a feed rate of 6.
N520 X-1.500 Y.500 (move to 2nd hole) – Drill at (-1.500, 0.500).
N530 X-1.500 Y-.500 (move to 3rd hole) - Drill at (-1.500, -0.500).
N540 X-.500 Y-.500 (move to 4th hole) - Drill at (-0.500, -0.500).
N550 G80 G00 Z1. M09 (canned cycle cancel, rapid move, coolant off) – cancels canned cycle and positions in rapid. From zero offset 1, axis Z 1”;M09 is coolant off.
N560 G28 G91 Z0. Y0. M05 (machine home, incremental programming, spindle stop) - Returns the reference point (machine zero); G91 sets incremental positioning. Z0 and Y0 set axis Z and axis Y to 0 and Spindle stop.
M01 (optional stop) – Operator has the choice to stop the program.
N570 (T3 Drill #3 holes) – Tool 3 is a Drill # 3 holes.
N580 (Drill 4 places) – User comment for drill action.
N590 T3 M06 (tool change) – Tool change to Tool 3
N600 S2200 M03 (spindle start 2200 RPM) – Spindle spinning clockwise at a speed of 2200.
N610 G90 G54 G00 X-.500 Y.500 (incremental programming, rapid to 1st hole location) – G90 is the Absolute dimensions, G54 is zero offset #1, G00 is rapid traverse to (-0.500 to 0.500)
N620 G43 H03 Z1. M08 (tool height offset, move, coolant on) – G43 is the tool length compensation, Tool height offset Axis Z for 1”; M08 is the coolant.
N630 G01 Z0.1 F50. (linear move 50 IPM) – Linear interpolation on Z axis for 0.1” with a federate of 50.
N640 G83 G99 Z-0.600 Q0.075 R0.1 F8. (canned drill pec cycle, depth of peck, plane return) – G83 is the fixed cycle, G99 is the axis offset on Z axis for -0.600 and a peck increment of 0.0750” with a radius of 0.1” at a feed rate of 6.
N650 X-1.500 Y.500 (move 2nd hole) – Drill at (-1.500, 0.500)
N660 X-1.500 Y-.500 (move 3rd hole) – Drill at (-1.500, -0.500)
N670 X-.500 Y-.500 (move 4th hole) – Drill at (0.500, -0.500)
N680 G00 G90 Z1. M09 (rapid move, absolute programming, coolant off) – Rapid Traverse in absolute dimensions on Z axis 1”, coolant off.
N690 G28 G91 Z0. Y0. M05 (machine home, incremental programming, spindle stop) – G28 Returns it to the reference point, incremental dimensions of Z axis and Y axis spindle off.
M30 (end of program) – This is when the Program stops, and resets to start.
% - The end of the Program