What does a G81 code do?
G81 calls a standard drilling canned cycle.
It is a modal function that allows the machine (lathe or mill) to perform a one-pass drilling operation and retraction.
The machine will drill the hole in one straight shot and then retract out of the hole. There is no dwell or movement of the cutter away from the surface of the hole.
Just like other modal functions, you will need to deactivate it by calling another G code of the same type (canned cycle) or by using the G80 canned cycle cancel command to stop drilling.
Ready to master CNC programming?
Try the free 30 minute intro course to see how simple and easy G code can be. Take the shortcut to becoming a G Code Master today!
When to use a G81 code?
The G81 command is useful when you want to drill holes that are not too deep and can be drilled in just one step.
G81 is the most common drilling canned cycle used.
G81 can be used for spot drilling, counterboring, reaming, boring, center drilling and other drilling operations. It is a very simple drilling cycle.
The G81 canned cycle does not include any retract steps (pecks) when drilling.
For this reason, if you want to drill a deep hole, the best option would be to use the G83 peck drilling deep hole canned cycle.
Peck drilling will help clear chips.
Other codes used with the G81 code
- G98 – Return to initial plane
- G99 – Return to R plane
- X – Hole location in X-Axis
- Y – Hole location in Y-Axis
- Z – Z axis location of the bottom of drilling motion
- R – Position of the retract plane (for movement clearance)
- F – Feed rate for drilling
G81 code format
The format for using a G81 command is shown below:
G98 (or G99) G81 X2.0 Y3.0 R1.0 Z-5.0 F25.0
It would be easy to assume that the Z location is the location of the start of the hole. In reality, it is the Z location for the bottom of the hole drilling movement.
Keep in mind that the X and Y coordinates of the hole are not usually in the same line as the G81 command.
In most programs you will see the G81 code in this format:
X2.0 Y3.0
G98 G81 R1.0 Z-5.0 F25.0
The program first identifies the coordinates of the hole and then starts the drilling process.
What to think about when using a G81 code?
Retract planes
The retract plane is the location that the machine will return to after each canned cycle.
There are two codes that affect retract planes.
The G98 code will cause the machine to return to the Z location at the start of the canned cycle. The G99 code will tell it to return to the R plane.
Selecting a retract plane that is above any potential obstacles in the machine such as fixtures, clamps, or the part itself will allow the machine to safely move between each hole drilling location.
If the R plane is too low it could cause damage on the workpiece and lead to disaster. However, if an R plane is too high above the workpiece’s surface, it could increase machining time, due to the extra time needed to go all the way up to the R value after each drilling.
Positioning mode
When using the G81 drilling cycle, you will need to be aware of the positioning mode that is currently active.
If G90 is active, the machine will read all locations as relative to a single zero location.
If G91 is active, the machine will read all locations as relative to its current position.
Pay careful attention to your current positioning mode because using the wrong one can easily result in a machine crash.
How to cancel a G81 code?
The G80 command is used to cancel a G81 code as well as all other canned cycles.
If the G81 command is not canceled, then the machine will continue to drill holes in every location given in the program.
G81 vs similar canned cycles
The G81 command is the simplest drilling canned cycle.
Besides G81 there are a few other G-codes for drilling holes with slight variations in the drilling process which make them better to use in certain circumstances.
Code | Name | Function |
Drill simple, shallow holes and center drilling | ||
Standard drilling cycle with a dwell at the bottom of the hole | ||
Drill into the part in steps (pecks) and after each peck, fully retract from the hole | ||
Similar to G83, but instead of retracting completely out of the hole, the machine will pull back a specified amount and then resume drilling |
Ready to master CNC programming?
Try the free 30 minute intro course to see how simple and easy G code can be. Take the shortcut to becoming a G Code Master today!