@albie0803
I've already read though quite a bit of the info on the tec-science web site - all good stuff and certainly gave me a head start on some of the math.
There are quite a few factors I yet need to take care of: over/undersize, undercutting and clearance probably the most important.
At present, I'm concentrating on getting the profile geometrically correct as in your mention of placeholders but with the aim of adding in factors for printable gears.
My usual code development process is:
1 Get working code
2 Get it working reliably
3 Optimise
4 Go back to 1
At present, I think I'm on the verge if 1...
I found a good tutorial on Youtube where some of the math is discussed.
(search for Modeling an Equation Driven Involute Spur Gear in Solidworks by Yang Cao)
The Youtube tutorial is aimed at developing an equation driven gear in Solidworks. Now Solidworks has a facility to generate equation driven curves. Sadly, this is not a feature of Alibre. I also looked at using the Alibre Excel features - but too many limitations. It could almost certainly be done in Alibre Script - but I dislike Python.
So a C# plugin it is.
How it works..
Using a spline for the involute is the best compromise I could find. It is not perfect but probably good enough is sufficient nodes are used.
The first node of the first curve from the base circle is easy. If the gear centre is at (0,0) the first node is at (base circle radius, 0).
Coordinates for following nodes are then calculated using an adaptation of the formulae given in the Youtube tutorial.
Each node is checked to confirm it is within the Addendum circle.
When the routine finds a node outside the Addendum circle, the routine calculates the intersection point of a straight line between the last node inside the addendum circle and the first node outside. This calculated point is then used as the last node of the spline.
The first node of the second curve (other half of tooth profile) is a little tricky but once the correct location has been established (see Youtube tutorial) the remaining nodes follow the same pattern as first curve but with modified formula.
The rest is simple arcs and lines developed from the start/end points of the splines.
Repeat for all the teeth.
As I mentioned elsewhere, I'll publish the code in due course - and will be welcoming contributions.
Here's a copy of the really nasty code I have at present for one of the curves:
C#:
private Array CalculateInvolute(int toothNum)
{
var theta = 360 / (double)properties.ToothCount * toothNum * Math.PI / 180.0;
var centre = new Point(properties.WheelCentreX, properties.WheelCentreY);
var baseRadius = properties.BaseCircleDiameter / 2;
var points = new List<Point>();
var stepSize = 90 / (double) properties.CountInvolutePoints * Math.PI / 180.0;
var step = 0.0;
// create the involute points
Point priorPoint = null;
for (var i = 0; i < properties.CountInvolutePoints; ++i)
{
var point = new Point()
{
X = baseRadius / 10 * (Math.Cos(step) + step * Math.Sin(step)),
Y = baseRadius / 10 * (Math.Sin(step) - step * Math.Cos(step))
};
point = translatePoint(point, theta);
if (i == 0) point1 = point;
if (IsInsideCircle(centre, properties.AddendumCircleDiameter / 20, point)) points.Add(point);
if (priorPoint != null &&
IsIntersecting(centre, properties.AddendumCircleDiameter / 20, priorPoint, point))
{
var Intersection = new Point();
var result = Intersect(centre, properties.AddendumCircleDiameter / 20,
priorPoint, point, ref Intersection);
if (result == 0)
{
points.Add(Intersection);
pointx = point2;
point2 = Intersection;
}
}
priorPoint = point;
step += stepSize;
}
Array interpolationPoints = new double[points.Count * 2];
var j = 0;
foreach (var point in points)
{
interpolationPoints.SetValue(point.X, j++);
interpolationPoints.SetValue(point.Y, j++);
}
return interpolationPoints;
}
David