An Example G-Code program (Drill four holes)

In G-Code by Micah HoffmannLeave a Comment

G90 G20 G40 G80
G91 G28 X0.0 Y0.0 Z0.0
G92 X-10.0 Y5.0 Z0.0
T1 M6
G0 G90 X.5 Y-.375 Z0.0 S1600 M3
G43 Z.1 H1
M8
G83 X.5 Y-.375 Z-.45 R.1 Q.1 F5.0
X4.5
Y-1.625
X.5
G80
G0 G90 Z4.0 M5
M9
G28 X0.0 Y0.0 Z0.0
M30

G-Code Meaning
O01334 Program Number
(X0Y0 IS THE UPPER LEFT HAND CORNER, WHEN LOOKING AT THE MACHINE/PART)

(X0Y0 IS THE UPPER LEFT HAND CORNER, WHEN LOOKING AT THE MACHINE/PART)

(Z0 IS THE TOP OF THE PART)(TOOL1: 1/4 DRILL)

Detailed Comments should ALWAYS be added to the top of your program, and throughout.
G90 G20 G40 G80 (Reset Line) Absolute, inch, cancel cutter compensation, and cancel fixed cycles.
G91 G28 X0.0 Y0.0 Z0.0 Return to reference point. (1)
G92 X-10.0 Y5.0 Z0.0 Drive to XY preset refernece point.
T1 M6 Change to tool 1.
(Tool 1: Drill (4) .25 Dia Holes Thru) Comment. Communication is key. You will see sloppy, poorly writtent, non-sensical notes. Those people will never make it.
G0 G90 X.5 Y-.375 Z0.0 S1600 M3 Rapid move to Position (2). Start spindle, clockwise, at 1600 RPM.
G43 Z.1 H1 Rapid Tool 1 .1 above part.
M8 Coolant on.
G83 X-.5 Y.375 Z-.85 R.1 Q.1 F5.0 G83 Peck / Deep Drill cycle. Run first time at position (2). Final drill depth .85. .1 depth of each peck. Return to .1 above part. Feed/Cut Rate at 5.
X4.5 Move to position (3). Because G83 is a modular fixed cycle, after it completes, we only need to tell the MCU where the next hole is. Warning: this is a good opportunity to break tools if not careful…
Y-1.625 Move to position (4).
X.5 Move to position (5).
G80 Cancel any previous fixed cycles (G83).
G0 G90 Z4.0 M5 Rapid to 4inches above part. Turn Spindle off.
M9 Coolant off.
G28 X0.0 Y0.0 Z0.0 Rapid move back to Machine Home. (6)
M30 Program End. Memory reset.

I highly suggest sublime text as a program text editor.  I have no affiliation.  There are many options out there.  

Leave a Comment