This commit adds the ability to shift the involute profile inside or
outside. Profile shift is implemented as coefficient, i.e. normalized by
the module, so that it the whole profile scales with the module without
chaning shape.
To verify the profile, the tests implement an "over pins measurement"
using formulae found in literature.
Backward compatibility with FreeCAD-v0.20 is garanteed by already
existing tests, not touched by this commit.
This addresses issue #5618.
There has been lots of duplicated code between those two, and the recent
changed introduced even more copy/paste code. This commit consolidates
both implementations. The two "public" entry points, `CreateExternalGear`
and `CreateInternalGear` have been kept and now call a shared helper.
While gears without a root fillet may have limited real-live use cases,
during number-input it happens regulary to have a zero fillet radius as
intermediate state. With this commit such a situation is now handled
gracefully.
The arcs on the tip (around the addendum) and the root (between the
fillets) used to have their bulge in the wrong direction for the internal
gear profile: their center points has been on the outside.
Since this error existed since the very first introcution of the internal
gear I assume this was done by accident: Instead of only the fillets, all
arcs have been inverted when the external profile was copied.
This commit now inverts the tip and root arcs again, to be concentric
with the pitch circle -- same as for the external profile.
Previously, the fillet started at a fixed value, tailored at 20° pressure
angle, a fillet radius of 0.375 and a dedendum of 1.25. With PR #8184
those values became user-adjustable and thus the assumptions of the
original code are not fullfilled any more. This resulted in significant
artefacts, especially for higher pressure angles or smaller dedendums as
commonly found in splines.
This commit actually calculates the junction between fillet and involute
so that the tangents of the both curves match.
The mathematical approach is described in source code comments.
The change in the fillet calculation also affects compatibility with
files generated by earlier versions of FreeCAD. Those changes are way
below 0.1% per tooth, however the earlier test required absolute equality
down to the micron. This was relaxed and also changed to a relative, per
tooth, tolerance.
There is one particular case where the new algorithm performs slightly
worse, though. That is when the fillet radius is too large to the
dedendum, i.e. resulting in a single arc instead of two fillets, and
effectively cannibalizes some of the clearance. This happens with internal
gears having less than 25 teeth. At about 15 teeth it becomes visible
that the fillet is not 100% tanget any more. However, as such a low
number of teeth is highly unusual for internal gears and the effect,
although noticeable, is minor, the overall benefits of the new algorithm
outweighs the drawbacks. And now with the fillet radius being adjustable
it is easy to fix, too.
The technical reason is that the tangency is calculated correctly, but
the fillet circle is displaced aferwards to avoid an overlap of the two
fillets. For the new fillet position, the tangents do not align any more.
The original implementation always took 150% of the addendum/dedendum
difference as fillet radius. For a standard full-depth system this
results in a normalized value 0f 0.375, which is pretty close to the 0.38
definded by the basic ISO rack. However, when using much shorter teeth as
e.g. required for a splined shaft, the fillet becomes way too large.
In addition, I don't understand the approximation to calculate the
distance between the gear's center and the top of the fillet yet. It was
only refactored to allow the custom fillet radii, but it retuns the same
values as the original implementation.
However, with high pressure angles, up to 45° used for splines, this
approximation comes to its limits.
Exposing the addednum and dedendum coefficients as properties allows to
change the tooth length above and below the pitch circle. This makes it
possible to use the profile beyond standard full-depth systems, e.g. for
stub tooths and most importantly: involute splined shafts and hubs.
Gear objets created with earlier versions automatically get the
additional properties on document restore. Its values match the hard-
coded values used in earlier versions.
There is a change when creating *new* internal gear profiles, though:
Previously, an addendum coefficient of 0.6 was used, presumably to reduce
the tip length beyond the base circle in order to avoid a non-involute
edge. This method is one proposal from the "Handbook of Gear Design" by
Gitin M. Maitra, as referenced in the original source code comments.
However, Maitra also states that this reduction of the anual gear's tip
in turn requires an enlagement of the mating gear of 1.25 instead of the
ordinary 1.0. And it is only required for a low numer of teeth and/or the
mating gear being quite large (less than 10 teeth in difference, to avoid
interferences).
Because those additional requirements and conditions have not been
implemented, the previously used values have been incomplete anyway. Thus
I decided to not implemented this special case and use the standard
values of 1.0/1.25 for newly created external and internal gears alike.
Internal gears need special care for other kind of interference anyway
and the newly exposed properties now allow to do so.
There is no entry in the task panel for those advanced properties yet.
This is in preparation for new features, to ensure we don't break
existing documents created with FreeCAD-0.20.
The fixtures have been created with the official mac build of
FreeCAD-0.20.1 using mostly default parametrization -- only the number
of teeth has been reduced in order to keep the file size low.
There are some basic tests to cover the gear profile and its parameters
and some integration tests for the interaction with PD Pad and Pocket.
I followed the same pattern as the other PartDesign tests, e.g. not using
PEP8 style method names. Eventually some helper methods could be
extracted and moved to the common base framework in Mod/Test, but that's
another step.