Pitch Circle Calculator


Online calculator now available

In MEW (Model Engineers Workshop) issue 100 Harold Hall described the formulas for calculating Pitch Circle Diameters. He then went into some detail on describing how to set it up in a spreadsheet which I thought was useful to many but too complicated for most. I decided to write a program to encapsulate the calculations in an easy to use manner and the result is produced here. (Bear in mind that I have no direct use for this as I have no mill, this was purely an exercise in 'feel like it')

This program is written entirely in Delphi (Object Pascal) and is a native Windows 32 bit program. It should run on any platform from Windows 95 to Windows 7. It does not use any fancy libraries etc.

So, begin by downloading (916.153kb) the install set. This is a self extracting set of files that will do the install. Save it wherever you like, then run it to install.

(You may need to upgrade your computers MSI installer to version 2 for this to install. I could have included the MSI update in the setup.exe, but it makes it 4+ MEGAbytes to download and not everyone will need the MSI upgrade anyway)

Now, let us see what it looks like....


The PCD program icon on the desktop.

Last edited February 20 2013 09:53:54.

Initial display. You need to select a mode at top left (in red) before you can do anything else.

Last edited February 20 2013 09:53:55.

After choosing 'I want to make a ring of holes' you will see this display. You can now select the number of holes you want, the radius or diameter (set diameter mode) of your hole (the calculation is unitless, whatever you supply, will be output, so a radius if '1' as above can be 1 meter, 1 inch, or 1 centimeter, the output is in the same units). At the bottom right side you can set the drill diameter. This figure will be used to draw the desired holes to the correct scale relative to the PCD chosen. Note however, that the printed drawing is not to any particular scale and is only for reference. IT IS NOT A CUTTING TEMPLATE!

The 'Save to File' button will prompt you for a filename and save the text in the box at left to a plain text file. You can then import that into your favourite wordprocessor for fancy printing or just store it along with other project files for easy reference.

The 'Print' button will print the text information along with the drawing for reference so you can see where the holes go out in the workshop. I have tested this on a range of printers (HP 815C color inkjet, HP4000 Laserjet, Epson FX80+ dotmatrix) and it works on all of them, though each printer will interpret the colors used in its own way.

Last edited February 20 2013 09:53:56.

After choosing 'I want to make a BIG hole' you will see this display.
This mode will produce co-ordinates for cutting out a circular chunk of the selected size. Again, select your number of holes and radius of the desired hole. The size of drill bit will be calculated and the drawing shows it to scale against the desired hole. You can adjust the hole count up or down to get a suitable drill bit size. Even numbers of holes will produce symmetrical hole positions which may make positioning faster.

A note about colors.
In the drawings,

  • solid blue is used to denote the desired hole.
  • a dotted line is used to denote the pitch circle
Last edited February 20 2013 09:53:56.

The sharp eyed among you will notice a new feature has been added as of October 25 2006. This is the 'Start Angle' setting at lower right. By setting this figure, the first hole will be offset by that many degrees from the X axis in an anticlockwise direction. By using this you can line up any hole with either axis, or simply offset a 2 hole pair as in the image above.

Last edited February 20 2013 09:53:56.

New feature added 12/03/2010. While changing the code so it can do up to 365 holes (previous limit was 200) I decided to experiment with Gcode output.

This is only available in 'Circle Center' mode as pictured at left.

  1. Choose units for the output code. Note that normally PCD is unit free, and you can regard the numbers you use to be any unit you desire. G- Code needs a unit system though, so here you have to choose what you are using.

  2. Set the drilling depth. This is a negative number in the chosen units. PCD conforms to the *right hand rule* which means that negative Z values drive the tool into the work.

  3. Retract height. This is a positive number representing the height to which the tool is retracted above the surface when moving between the holes. Make sure the tool will clear any fixtures!

  4. Feed Rate. The rate at which to drill, in the selected units. The default is WAY TOO FAST unless you are cutting polystyrene foam.

  5. Use G81 drill cycle. Not all controllers support G81 so the default is to use simple linear moves for the drill operation, drilling into the work at the given feed rate and retracting using G00. By checking this box the G81 drill cycle will be used instead.

The code output by this program operates in 'incremental mode'. This means it can drill the pattern anywhere without knowing where it is. The only requirement is that you position the drill tip at the circle center and very near the surface. It can even lightly touch the surface as it will be retracted to the retract height before any movement takes place. Once all the holes are drilled the tool will be returned to the start position. The tool path is counter-clockwise starting on the right, as per the image and hole numbering in the program.

The code produced by the parameters at left is displayed later in this page. NOTE: I don't have a mill to test this on, but I have run it in EMC2 using the 'Axis mm' simulator setup. It works there, but on your mill, I don't know, so you will have to test and retest, preferably with no workpiece nor tool, to be certain that you will get what you want.

Last edited February 20 2013 09:53:59.

I hope this program is useful to you. It is free for any use anywhere, but you may not sell it for profit nor charge for distribution.

The code produced by the parameters in the last image above is as follows:

( This gcode is untested on an actual machine, but runs in EMC2 in simulate mode)
( Position the drill at the center of the PCD)
( with the point at the surface, this is the 0,0,0 point for the PCD)
( this code will then drill the PCD relative to that position and return)

( Drill depth is -2.000mm)
( Retract height is 1.000mm)

( Pitch Circle for ring of holes)
(  Diameter  = 2.000   Radius = 1.000)
(    Number of Holes = 6)
(    Angle Between Holes = 60.000 degrees)
(    Start Angle         = 0.000 degrees)
(    0,0 is at CIRCLE CENTER)

G91   ; relative mode
G61   ; close position mode
G21  ;metric
G00 Z1.000 F1000.000
G00 X1.000 Y0.000
 G01 Z-3.000
 G00 Z3.000
G00 X-0.500 Y0.866
 G01 Z-3.000
 G00 Z3.000
G00 X-1.000 Y0.000
 G01 Z-3.000
 G00 Z3.000
G00 X-0.500 Y-0.866
 G01 Z-3.000
 G00 Z3.000
G00 X0.500 Y-0.866
 G01 Z-3.000
 G00 Z3.000
G00 X1.000 Y0.000
 G01 Z-3.000
 G00 Z3.000
G00 X-0.500 Y0.866
G00 Z-1.000
G90   ; absolute mode
This code does not use G81 drill cycles.

talk to me
My God shall supply all your need according to His riches in glory
Philipians 4:19
Many people cannot afford their own Bible, please help them now
This is the 7393rd access
Last modified: February 20 2013 07:52:45.