Although OpenSCAD’s MCAD library includes a gear generator, I don’t profess to understand the relations between reality and its myriad parameters, plus I vaguely recall it has a peculiar definition for Diametral Pitch (or some such). Rather than fiddle with all that, I start with an SVG outline from Inkscape’s Gears extension and go all 3D on it.
So, the “gear blank” looks like this after extruding the SVG:
Producing this is a lot easier in OpenSCAD than in real life:
OpenSCAD centers the blank’s bounding box at XY=0, which won’t be exactly on the bore centerline for gears with an odd number of teeth. One tooth sits at 0° and two teeth bracket 180°, so the bounding box will be a little short on one side
A reference for gear nomenclature & calculations will come in handy.
For a 21 tooth module 1 gear, which should be pretty close to the worst case in terms of offset:
- Pitch dia = d = 21 × 1 = 21 mm
- Tip dia = da = d + 2m = 23 mm
- Tip radius = da/2 = 11.5 mm
- Tooth-to-tooth angle = 360/21 = 17.143°
- Radius to tangent across adjacent teeth = 11.5 × cos 17.143°/2 = 11.372 mm
An actual metal 21 tooth gear measures 22.87 mm across a diameter, dead on what those numbers predict: 11.5 + 11.372 = 22.872 mm.
So the bounding box will be 11.5 mm toward the tooth at 0° and 11.372 mm toward the gap at 180°. The offset will be half that, with the tooth at 0° sitting 0.063 mm too close to the origin. Gears with more teeth will have smaller errors.
Given that we’re dealing with a gear “machined” from plastic goo, that’s definitely close enough:
That’s an earlier version with the debossed legend.
The code can also generate stacked gears for the BC shaft in the middle:
In principle, the key locking the gears together isn’t needed and the bore could fit the inner shaft, rather than the keyed bushing, but then you’d (well, I’d) be at risk of losing the bushing + key in one easy operation.
So it’s better to go with the bushing:
Now, to cut some threads!
The OpenSCAD source code as a GitHub Gist: