CNC Basics · Chapter 6
Hole patterns
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.
Modal: the cycle stays active
A cycle 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)G80M5M30Grid 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.
G90 G21 G17T2 M6S1000 M3G81 X20 Y10 Z-5 R2 F100X40X60Y30 (next row, X stays at 60)X40X20G80M5M30Bolt 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)G80M5M30At 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 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. SetG90before 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,RorFin 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 inY47,321is an error.