%
O0069
(T1 = 3/4" 2-FLUTE FLATE END MILL)
(T2 = 2" 5-FLUTE END MILL)
G90 (G90 G Code Absolute Programming)
G17 (Select XY Plane)
G20 (inch)
G53 G0 Z0 (Rapid move to Z0 based on Machine Coordinate system)
M6 T1 (Change tool to Tool #1)
M3 S5000 (Turn spindle clockwise at 5000 rpm)
G54 (Select 1st work offset)
M8
G4 P5. (Pause 5 millisecond)
G1 X1.25 Y.875 F5 (Linear move to XY coordinate at feed rate 5 in/m)
G43 Z-.02 H1 (Set tool offset using value of H1)
X-6.5 (Move X to -6.5)
M5 (Stop spindle)
M9 (Coolant off)
G53 G0 Z0 (Rapid move to Z0 based on Machine Coordinate system)
M6 T2 (Change tool to #2)
M3 S5000 (Turn spindle clockwise at 5000 rpm)
M8 (Turn the main spindle coolant on)
G0 X.05 Y.05 (Rapid move to X.05 Y.05)
G1 Z1.0 F25. (Linear move up Z 1.0 and fead rate at 25 in/m)
G43 Z-.250 H2 (Set tool offset using value of H1)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
G1 Z1.0 F25. (Linear move to Z 1 and feedrate at 25 in/m)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
Z-.5 (Move Z to 1.)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
Z1. (Move Z to 1.)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
G1 Z-.750 F25. (Linear move to Z -.75 and feedrate at 25 in/m)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
Z1. (Move Z to 1.)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
G1 Z-.750 F25. (Linear move to Z -.75 and feedrate at 25 in/m)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
Z1. (Move Z to -.5)
G53 G0 Z0 (Rapid move to Z 0 based on Machine Coordinate system)
M5 (Stop spindle)
M9 (Coolant off)
M30 (code ends the program and tells it to go back to the start of the program)
%
After annalized the code, I saw some extra commands and wrong values for the command.
Line 26: G0 X.05 Y.05
. . .
Line 29: G41 D2 X.05 Y.05
We can remove Line 26 or remove G41 commands and the result still the same.
Line 53: G1 Z-.750 F25. Z
Z value should be "-1." because line 44 already did the run at Z -.750
After each outer perimeter cut, Line 36 moves the tool down by 0.5. However, after the last two cuts, the tool moves up by 1 inch and then goes back down. This doesn't seem logical, so I believe Lines 42 and 50 should be updated to G1 Z-.750 and G1 Z-.1
Line 36: G1 Z-.5
Line 42, 50: G1 Z1.
After tool change to T2, the following codes are used to cut the outer perimeter. There are four groups of code with the same function, so it would be beneficial to separate them into a macro. Four groups of code are only different the Z in G1 command
(Run toolpath to cut the rectangle 4 in x 1.425 in)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
G1 Z-.250 F25. (Linear move to Z 1 and feedrate at 25 in/m)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
Z-.5 (Move Z -.5 inch)
(End toolpath)
(Run toolpath to cut the rectangle 4 in x 1.425 in)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
G1 Z-.50 F25. (Linear move to Z 1 and feedrate at 25 in/m)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
Z1. (Move Z 1 inch)
(End toolpath)
(Run toolpath to cut the rectangle 4 in x 1.425 in)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
G1 Z-.750 F25. (Linear move to Z -.75 and feedrate at 25 in/m)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
Z1. (Move Z 1 inch)
(End toolpath)
(Run toolpath to cut the rectangle 4 in x 1.425 in)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
G1 Z-1. F25. (Linear move to Z -.75 and feedrate at 25 in/m)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
Z1. (Move Z 1 inch)
(End toolpath)
Creating a macro accepting the parameter Z (= variable #26)
%
O8001
(Expect parameter Z)
(Run toolpath to cut the rectangle 4 in x 1.425 in)
Z#26 (Move Z to #26)
G0 X.05 Y.05 (Rapit move to X .05 Y.05)
G1 Z#26 F25. (Linear move to Z #26 and feedrate at 25 in/m)
G41 D2 X.05 Y.05 (Shift the cutting tool to the left)
X-4. (Move X -4 inches)
Y1.425 (Move Z 1.425 inches)
X-.05 (Move X -.05 inches)
G40 Y-.05 (Canceling cutter compensation move Y -.05)
(End toolpath)
M99
%
%
O0069
(T1 = 3/4" 2-FLUTE FLATE END MILL)
(T2 = 2" 5-FLUTE END MILL)
G90 (G90 G Code Absolute Programming)
G17 (Select XY Plane)
G20 (inch)
G53 G0 Z0 (Rapid move to Z0 based on Machine Coordinate system)
M6 T1 (Change tool to Tool #1)
M3 S5000 (Turn spindle clockwise at 5000 rpm)
G54 (Select 1st work offset)
M8 (Turn the main spindle coolant on)
G4 P5. (Pause 5 millisecond)
G1 X1.25 Y.875 F5 (Linear move to XY coordinate at feedrate 5 in/m)
G43 Z-.02 H1 (Set tool offset using value of H1 and move Z -.02 at zero location)
X-6.5 (Move X to -6.5)
M5 (Stop spindle)
M9 (Coolant off)
G53 G0 Z0 (Rapid move to Z0 based on Machine Coordinate system)
M6 T2 (Change tool to #2)
M3 S5000 (Turn spindle clockwise at 5000 rpm)
M8 (Turn the main spindle coolant on)
G0 X.05 Y.05 (Rapid move to Z.05 Y.05)
G1 Z1.0 F25. (Linear move up Z 1.0 and fead rate at 25 in/m)
G43 Z-.250 H2 (Set tool offset using value of H1 and move Z -.250 at zero location)
G65 P8001 Z-.250 (Cut outside perimeter at Z -.250)
G65 P8001 Z-.50 (Cut outside perimeter at Z -.50)
G65 P8001 Z-.750 (Cut outside perimeter at Z -.750)
G65 P8001 Z-1. (Cut outside perimeter at Z -1.)
G53 G0 Z0 (Rapid move to Z 0 based on Machine Coordinate system)
M5 (Stop spindle)
M9 (Coolant off)
M30 (code ends the program and tells it to go back to the start of the program)
%