CNC Viewer

Prepared from parser behavior, machining-file examples and visual checks performed in CNC Viewer. Always confirm the result against the CAM setup and machine documentation before production.

G-code drilling

G81, G82 and G83 drilling cycles explained

Canned drilling cycles compress several machine movements into a short block. A viewer must expand that block carefully or one programmed hole can become a stack of false operations, an incorrect depth or a missing bore.

What the three cycles have in common

G81, G82 and G83 normally use the current X and Y position as the hole center, a Z value as the final drilling level and an R value as the approach or retract plane. The active distance mode, work offset, units and return mode still apply. A parser therefore cannot interpret the drilling line in isolation; it must carry the modal state from the blocks before it.

The cycle often remains active for later X or Y blocks until G80 cancels it. Those later blocks are additional hole locations, not incomplete commands. Conversely, a line that only changes feed or spindle state should not create another hole. This distinction prevents inflated operation statistics.

  • Confirm G20 or G21 units
  • Locate the active Z origin
  • Find the matching G80 cancellation

G81 is the basic drilling cycle

G81 moves rapidly to the R plane, feeds directly to the programmed Z depth and retracts. For a top-zero 18 mm panel, Z-12 describes a 12 mm blind hole, while a value below the bottom face can indicate a through-hole. The visible solid should remove a cylinder with the selected drill diameter, not merely draw a dark circle on the surface.

A common preview error is treating the R plane as material removal. R is usually an approach level and does not increase hole depth. Another is applying the drill radius twice; a 6 mm tool creates a 6 mm diameter hole, with 3 mm on either side of the center.

G82 adds dwell and G83 adds pecking

G82 follows the same basic geometry as G81 but pauses at the bottom. The dwell changes machining time and finish, not the final hole diameter or depth. Depending on the controller, the dwell can be written with P or another controller-specific parameter, so machine documentation remains authoritative.

G83 reaches the final depth through repeated pecks, commonly controlled by Q. Those intermediate plunges are phases of one hole operation. A technical drawing should list one hole at that coordinate, while an animated machine simulation may show every peck. Counting each peck as a separate hole makes statistics slow and misleading without adding useful geometry.

A worked interpretation

Consider G90 G21 followed by G98 G81 X50 Y30 Z-14 R2 F600. The program uses absolute millimetres, drills at X50 Y30, approaches from Z2 and reaches 14 mm below a top-face zero. G98 returns to the initial level after drilling; G99 would normally return to the R plane. If the next block is X90, the active cycle creates a second hole at X90 Y30 using the same Z, R and feed values.

Before accepting the preview, compare the hole depth with stock thickness, verify the assigned tool diameter and check whether the return movement is being shown as a cutting path. Only the feed portion inside the stock should remove material.

  • One statistic per physical hole
  • No material removal above the stock
  • Pecks share one center and final depth