Re: Irregular bolt circle calculator from simple distance measurements
- From: enginemaker@xxxxxxxxxxx
- Date: Sun, 11 Nov 2007 10:31:14 -0800
On Nov 7, 3:18 pm, Richard J Kinch <ki...@xxxxxxxxxxx> wrote:
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
spread***.
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<=0||b<=0||c<=0) {
printf "3 input lengths must all be positive!\n"
exit 1
}
if ((a>=(b+c))||(b>(c+a))||(c>=(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
}
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
http://www.myvirtualnetwork.com/mklotz
.
- Follow-Ups:
- Re: Irregular bolt circle calculator from simple distance measurements
- From: Richard J Kinch
- Re: Irregular bolt circle calculator from simple distance measurements
- References:
- Irregular bolt circle calculator from simple distance measurements
- From: Richard J Kinch
- Irregular bolt circle calculator from simple distance measurements
- Prev by Date: Re: Union Millwrights
- Next by Date: Re: Unions
- Previous by thread: Re: Irregular bolt circle calculator from simple distance measurements
- Next by thread: Re: Irregular bolt circle calculator from simple distance measurements
- Index(es):
Loading