Using expressions instead of filling these values in the `execute` method
has the advantage that the values can be used in other expressions on the
same object. First, the expressions are evaluated, then the feature is
"executed". Previously, the changed values are only available after the
execution and thus had no effect if e.g. used in calculating the
placement of the very same gear (until another recompute happens).
This fixes some unit mismatch, as the backlash is specified as length,
but the involute tooth generation code used to interpret it as angular
value in radians (no idea why it was additionaly diveded by four; we need
the half on each side of the tooth).
Now half of the value specified as "backlash" can be directly measured at
the pitch circle when comparing each tooth flank of a gear with and
without backlash.
Head and cleance values have been applied only once, but as we're dealing
with a diameter, not a radius, they are needed twice. (The involute gear
does not suffer from this bug)
The cycloid gear is created with a default number of teeth of 15 and an
`inner_diameter` of 7.5. That is half the number of teeth and results in
an hypocycloid going orthogonal from the pitch circle right to the center.
This change now replaces the hard coded value "7.5" with the expression
"teeth / 2" so that this straight hypocycloid is kept, even if the number
of teeth is adapted. This allows easy reduction of the number of teeth
(down to two, in fact) without the recomputation to fail.
It turned out that the "moving up" of the gear shape was responsible for
the majority of processing time: it took 10x longer then the pipe
creation and 100x longer then the mirroring.
Now the moving is done of the helix and base face so that the other faces
are generated directly where they should be, thus preventing a movement
of all of them.
In addition, as we don't have to transform the final shape, we don't have
to use transformGeometry, but just change the placement via translate --
again much faster.
The now only helicalextrusion is the one working on a face, not a wire,
and allows extrusions of "faces with holes". This is required for the
internal gears but also allows e.g. center holes for ordinary gears as
well (not in this commit).
The original, now replaced, way had the benefit of reusing the existing
helicalextrusion method, but the following boolean cut operation was a)
slow and b) suffered from co-planar issues. The new way extrudes the
face directly which does not have these shortcommings.
Unfortunaly, we had to use a different API: the original one is simple
and straight forward, gives no easy way to access the end of the sweep.
Collecting the wires manually, filtering on the position of all vertexes,
unvailed tolerances heigher then 0.1, so that a face created from it was
not planar and prevented ceating a valid solid.
The now used API requires more manual work in the initial setup, but the
end wires for construction the top face are directly accesible and the
tolerances are below 0.001 so we can create a planar face and valid solid.
This new way also much faster (1.6 sec vs. 5.0 sec on my machine
using default gear parameters on a double helix, naively measured via
`time.perf_counter()`).
Currently, the new helical extusion method is only used for the internal
gear. Migrating the other usages will be done as a separate commit.
This reuses the same (external) tooth profile from pygear but swap some
parameters to make the resulting gear internal.
This prototype is mostly a copy of the external involute gear. Eventually
we should refactor this to share more code but this has to be coordinated
with the megagrant endevour. Otherwise merging becomes a nightmere.
Note that in contrast to the involute rack I choose to base the
"thickness" on the pitch diameter, not the root diameter. This has the
benefit of keeping the outside diameter stable when e.g. adjusting the
clearance. And setting the outside diameter directly could result in an
invalid shape when chaning the numnber of teeth.
The default head value of "-0.4" is choosen to match the invernal gear
profile from the PartDewign WB.