A flange, hub or coupling with a ring of holes is one of the most common jobs on a vertical mill. The drawing gives you a pitch circle diameter (PCD), a hole count and maybe a start angle. The machine needs X and Y for every hole. The PCD Coordinate & G-Code Generator in the Shader7 CNC Machinist hub does that conversion, previews the pattern, suggests a spindle speed and feed for the drill, and writes a ready-to-review Fanuc program.
What the app does
You enter the pattern and drill details on the left. The app then gives you:
- A live pattern preview with the origin at G54 X0 Y0, +X to the right and +Y up.
- A coordinate table listing every hole position to four decimals, with Copy Code for quick pasting.
- A Fanuc G-code program using a G81 drilling cycle, also with Copy Code.
- RPM and Feed Rate for the drill, based on the tool and work material you pick.
- Export PDF, a printable sheet of the coordinates and program for the setup folder.
The circle centre is the program origin, so set G54 on the centre of the bolt circle (or shift your work offset to it) before running the program.
Step by step
1. Describe the hole pattern
- Full Circle (checked by default): holes are spaced evenly around 360°. Enter the Start Angle of the first hole; the Last Angle is ignored.
- Partial arc: untick Full Circle and enter both Start Angle and Last Angle. The first hole sits on the start angle, the last hole on the last angle, and the rest are spaced evenly between them.
- Pitch Circle Diameter (PCD) in mm and Number of Holes.
Angles are measured from the 3 o'clock position (+X axis), counter-clockwise. A start angle of 90° puts the first hole at 12 o'clock.
2. Fill in the G-code parameters
- Program Number (the O-number).
- Drill Diameter, used for the RPM and feed calculation.
- Retract Plane (R), the R level the drill rapids to between holes.
- Drill Depth (Z), a negative value for a hole below the top face.
- Tool Material (HSS, Cobalt HSS-Co or Carbide) and Work Material (Mild Steel, Alloy Steel, Stainless or Aluminium).
- Axis for Coordinates: G17 (X, Y) for a normal vertical mill, or G18 (X, Z) and G19 (Y, Z) for patterns on other faces.
3. Review the results
Check the preview first: the number of holes, where the first hole is and which way the pattern runs. Then check the coordinates against one hole you can work out by hand (the hole at 0° should be at X = PCD ÷ 2, Y = 0).
How the coordinates are calculated
Each hole is a point on a circle of radius r = PCD ÷ 2:
X = r × cos(θ)
Y = r × sin(θ)
For a full circle, the angle step is 360° ÷ number of holes. For a partial arc, it is (last angle − start angle) ÷ (number of holes − 1), so both end angles get a hole.
Worked example: PCD 100 mm, 6 holes, start angle 0°. The radius is 50 mm and the step is 60°.
| Hole | Angle | X | Y |
|---|---|---|---|
| 1 | 0° | 50.0000 | 0.0000 |
| 2 | 60° | 25.0000 | 43.3013 |
| 3 | 120° | −25.0000 | 43.3013 |
| 4 | 180° | −50.0000 | 0.0000 |
| 5 | 240° | −25.0000 | −43.3013 |
| 6 | 300° | 25.0000 | −43.3013 |
The straight-line distance between neighbouring holes (the chord) is PCD × sin(180° ÷ n). Here that is 100 × sin(30°) = 50 mm, which is easy to check with calipers on the finished part.
The program the app writes
The generated program follows a simple, readable structure:
O1001 (PCD DRILLING - DIA: 6MM)
(TOOL: HSS, WORK: MILD)
(SPEED: ... RPM, FEED: ... MM/MIN)
G21 G90 G17 G54 G40 G80
(ADD TOOL CHANGE HERE, e.g., T01 M06)
S... M03
G00 X50.0000 Y0.0000
G43 Z50.0 H01
G81 Z-10.000 R5.000 F...
X25.0000 Y43.3013
...
G80
G49
G00 Z100.0 M05
M30
A few things to check before running it:
- Add your tool change. The program leaves a comment where your T and M06 go.
- Tool length offset. The program calls H01. Change it to match your tool number.
- Clearance heights. Z50 on approach and Z100 at the end are safe defaults; adjust them for your vise, clamps and fixtures.
- Cycle type. G81 drills each hole in one pass. For holes deeper than about three times the drill diameter, change G81 to G83 and add a peck depth (Q), or use the Drill Feed & RPM Calculator, which can write G83 and G73 peck cycles.
Tips from the shop floor
- Spot first. Spot or centre-drill every position before drilling, especially on a large PCD where the drill could walk.
- Watch clamp positions. Holes near 0°, 90°, 180° and 270° often land close to vise jaws. Rotate the start angle if the drawing allows it.
- Check the mating part. If the bolt pattern must line up with another component, measure the chord on both parts, not just the diameter.
- Use the PDF. A printed coordinate sheet next to the machine makes it easy to jog to each hole and check positions during first-article inspection.
When the circle centre is not at X0 Y0
The generator puts the bolt-circle centre at the program origin. If your part origin is somewhere else, for example the corner of a plate, you have two easy options:
- Shift the work offset. Touch off the part corner as usual, then add the centre's distance to G54 (or use a second offset such as G55) so that X0 Y0 lands on the circle centre.
- Shift the coordinates. Add the centre's X and Y to every coordinate in the table. For a circle centred at X60 Y40, the hole at (25.0000, 43.3013) becomes (85.0000, 83.3013).
Many controls also support a local coordinate shift with G52 (for example G52 X60. Y40. before the holes and G52 X0 Y0 after), which keeps the generated coordinates unchanged.
Unevenly spaced patterns
Some flanges have holes that are not evenly spaced, such as two groups of three. Generate each group as a partial arc with Full Circle unticked, using its own start and last angle, then combine the coordinate lists in one program under the same G81 cycle.
Common mistakes
- Wrong start angle reference. Angles start at 3 o'clock (+X) and run counter-clockwise. Drawings that measure from 12 o'clock need 90° added.
- Clockwise drawings. If the print numbers holes clockwise, the positions are the same but the order is reversed. That is fine for drilling; it only matters if hole numbering is checked during inspection.
- Forgetting the minus sign on depth. Drill Depth (Z) should be negative for a hole below the top face.
- Retract plane below a clamp. The R level is where the drill travels between holes. Make sure it clears every clamp and step on the part, or switch to G98 so the tool returns to the initial level.
Inspection tip
After drilling, measure across two opposite holes on an even-numbered pattern: the distance between their centres should equal the PCD. On an odd-numbered pattern, measure the chord between neighbouring holes and compare it with PCD × sin(180° ÷ n).
Frequently asked questions
Where is X0 Y0 in the generated program?
At the centre of the bolt circle. Set your G54 work offset on that centre, or shift the offset to it, before you run the program.
How do I program holes on only part of a circle?
Untick Full Circle and enter a Start Angle and a Last Angle. The app puts a hole on both angles and spaces the others evenly between them.
Where does the RPM and feed come from?
The app uses typical cutting speeds for the tool material and work material you choose, together with the drill diameter. Treat them as starting values and use your tool maker's data when you have it.
Can I use it for a lathe with live tooling or a horizontal mill?
Yes. Change Axis for Coordinates to G18 (X, Z) or G19 (Y, Z) so the program uses the right pair of axes.
Does the app need an internet connection or an account?
No account is needed. Everything is calculated in your browser.
Generate your bolt circle
Enter the PCD, hole count and angles to get X/Y coordinates, a live pattern preview, a Fanuc G81 program and a PDF you can print for the machine.