CNC hole patterns: rows, grids and bolt circles

Updated on October 22, 2026

CNC hole patterns such as rows, grids and bolt circles are easier to program than they sound. When you hang pictures on a wall, you do not set up the tape measure and pencil again after every nail. You set the distance once and then drive one nail after another. Holes work similarly: you fix the drilling values once, after that you only name the positions.

A drilling cycle such as G81 is modal. That means: it keeps applying until you end it with G80. Every further block that contains a position drills another hole with the same values for Z, R and F.

An axis you do not name keeps its last value. So for a row of holes along X, one word per hole is enough.

G90 G21 G17T2 M6S1000 M3G81 X15 Y20 Z-6 R2 F100   (first hole, the cycle starts)X35                       (second hole at X35 Y20)X55                       (third hole at X55 Y20)G80M5M30

Grid of holes

A grid of holes consists of several rows. You drill one row, change the Y position and drill the next one. In the example the second row runs backwards: after the first row the drill is already at X60, so the second row starts there. This saves travel; more on that in the article on cutting values and short paths.

G90 G21 G17T2 M6S1000 M3G81 X20 Y10 Z-5 R2 F100X40X60Y30                       (next row, X stays at 60)X40X20G80M5M30

Bolt circle: calculating coordinates

For holes on a circle the machine has no command. You calculate the positions yourself. The circle has the centre (cx, cy) and the radius r. A hole at the angle α, measured from the X axis counter-clockwise, lies at:

  • x = cx + r · cos(α)
  • y = cy + r · sin(α)

With n holes they are 360° / n apart. Round to three decimals: this is more accurate than any drill.

(bolt circle: centre X40 Y30, radius 10, 4 holes)(x = 40 + 10 * cos a, y = 30 + 10 * sin a)G90 G21 G17T2 M6S1000 M3G81 X50 Y30 Z-6 R2 F100   (a = 0 degrees)X40 Y40                   (a = 90 degrees)X30 Y30                   (a = 180 degrees)X40 Y20                   (a = 270 degrees)G80M5M30

At the round angles 0°, 90°, 180° and 270°, cos and sin only have the values 0, 1 and −1. For 45° and 60° you need a calculator.

Why not incremental?

For a grid with equal spacing it would be convenient to name the step (X15 = "15 mm further"). You would need incremental dimensions with G91 for this. But drilling cycles only run with G90, otherwise the machine raises an alarm. So you calculate every absolute position yourself: 10, 25, 40 and so on.

Common mistakes

  • G91 in a cycle

    No drilling cycle is allowed with G91. Set G90 before the cycle and name absolute positions.

  • Circle spread wrongly

    Divide 360° by the number of holes, not by the number of gaps. With six holes that is 60°, not 72°. A look at the top view shows you at once whether the holes lie evenly.

  • Writing Z, R or F again and changing it

    If you write a different Z, R or F in a later block, the new value applies to all following holes from there on. This is a popular way to drill a hole too shallow by accident.

  • Comma instead of point

    The machine only reads the point: Y47.321. A comma as in Y47,321 is an error.

Tasks on this topic

Practise what you learned right in your browser. Tests check your solution instantly.