Irregular bolt circle calculator from simple distance measurements

When reverse engineering parts, I often come across bolt circles with
irregular spacing. That is, the holes all fall around the same circle,
but at random angles, rather than evenly spaced around the circle. The
diameter and angles were always a challenge to deduce using only
calipers.
Today I looked up some geometry and with some head-scratching came up
with the following formulas to calculate the bolt circle diameter given
the distances between any three holes. Also calculated are the relative
angles to the second and third holes from the first.
In practice, when presented with a mystery bolt-circle part, all you
have to supply are the 3 distances between the three hole centers. I do
this with calipers by reading the inside and outside measurements and
averaging. Then the code will deduce and report the diameter and
angles. No more guessing or eyeballing with protractors or graph paper.
No doubt this has been solved before, but I've never been able to find
the software to do it, so here is my attempt. I wrote this in awk, but
the formulae should be clear if anyone cares to rewrite this as, say, a
spreadsheet.
Being that evenly-spaced bolt circles are a special case, this works for
them as well.
#
# Calculate bolt circle diameter from the separation distances of
# any three holes on the bolt circle. Also calculates angles of
# the second and third holes relative to the first
#
# Kinch, November 2007
# After _Graphics Gems_, "Useful Trigonometry", p 12,
# and "Triangles", pp 20-22.
#
# Input arguments: three distance values in CCW:
#
# |AB| |BC| |AC|
#
# Outputs the apparent diameter of the bolt circle, and angles
# to the second and third relative to the first
#
BEGIN {
c = ARGV[1]+0 ; a = ARGV[2]+0 ; b = ARGV[3]+0
printf "Given lengths: %.3f %.3f %.3f\n", c, a, b
if (a=(a+b))) {
printf "Inputs fail triangle inequality!\n"
exit 1
}
cosA = (a*a - b*b - c*c) / (-2*b*c) # Law of cosines
d = b*cosA
e = sqrt(b*
b-d*d)
d1 = c*
d
d2 = c*c - c*d
d3 = d*d - c*d + e*e
c1 = d2*
d3
c2 = d3*d1
c3 = d1*
d2
diameter = sqrt((d1+d2)*(d2+d3)*(d3+d1)/(c1+c2+c3))
r = diameter / 2.0
printf "diameter = %.3f\n", diameter
cosa2 = ((r*r-0.5*c*c)/(r*r))
sina2 = sqrt(1.0-cosa2*
cosa2)
if (cosa2!=0.0) a2 = atan2(sina2,cosa2)*180.0/3.1415926 ; else a2 = 90
a1 = 0
a3 = 360.0 - a1 - a2
printf "angles %.1f %.1f %.1f\n", a1, a2, a3
exit 0
}
Reply to
Richard J Kinch
Loading thread data ...
The Fagor DRO on my mill will do this sort of thing too, however I've only used it half a dozen times.
Reply to
Dom
(snip)
Good on ya, Richard. Probably only UNIX users would have/use awk, but (as you say) your program clearly shows how to apply the law of cosines here.
I'm a bit surprised that Marv Klotz doesn't have a program for this on his site. He might be interested in adding it.
formatting link
About any CAD drawing package (turbocad, autocad, etc etc) can make a circle described by 3 points and thence tell you the radius and center. I regard some sort of CAD program as a very useful shop tool because they can solve a LOT of geometry problems effortlessly.
Once one has the radius and angle to each hole, a CAD package can then ordinate (X-Y) dimension their locations so one can go right to the mill, dial in the locations, and drill the holes -- no need to set up and center a rotary table. I've found this to actually be more accurate than a rotary table because with a rotary there are the cumulative errors of centering table on mill, centering workpiece on table, and runout of an inexpensive RT. YMMV.
Reply to
Don Foreman
Richard's program is essentially written in "C". For a "C" programmer, it would be a trivial job to edit and compile this for DOS or Windows.
I *used* to be able to do this. But, alas, haven't done "C" for 15 years now.
This would indeed be a nice addition to Marv Klotz's collection.
Is there a nice volunteer out there?
Karl
Reply to
Karl Townsend
The program CIRC3 has been on my page for a long time. It computes the diameter of the bolt circle from three chord measurements but doesn't compute the angles as Richard's does. (Computing the angles is trivial once the diameter is done.)
My program is unnecessarily complicated because I wrote it as a test case to proof a number of geometry subroutines I had written for another application.
Richard's program is also unnecessarily complicated. Once you've used the law of cosines to solve for cosA as he has done:
cosA = (a*a - b*b - c*c) / (-2*b*c) # Law of cosines
the bolt circle diameter is given simply by:
D = a/sin(acos(cosA));
Regards, Marv
Home Shop Freeware - Tools for People Who Build Things
formatting link

Reply to
enginemaker
I looked at your list, but was hunting for "distance" or "chords" or some such magnitude keyword, not "points" (implies coordinates to me) on a circle.
Imagine that, D = a/sinA. Not sure why that lengthy solution is in Graphics Gems. Since angle A (and thus acos(cosA)) must be < 180 deg, sin (A) must be non-negative, namely (by identity) sqrt(1-cosA*cosA). So:
D = a/sqrt(1-cosA*cosA)
which altogether avoids the trigonometric functions (and thus works on that cheap calculator!), and solves the diameter in two steps.
Reply to
Richard J Kinch

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.