How would one parametrically create a LEGO-compatible gear? If a gear was intended to smoothly mesh with standard LEGO gears, how should it be defined?
While I know that the mean diameter (average of inner and outer diameters) of a LEGO gear should be 1mm/tooth, but are there any specifications anywhere that describe the profile of a tooth so that I can get its shape correct when designing a gear intended to mesh with LEGO?
I know that others have asked about the module of a LEGO gear and I've seen the web page that describes how to make one with Solidworks, but I am not using Solidworks to create my gears, and I do not have the benefit of a gear wizard that can compute the shape of the gear from the teeth count and module.  I therefore need to know how to actually define the profile of the gear using either primitive shapes or splines, and for that I will need to know dimensions, such as the length of the tooth from base to outer edge, the widths of a tooth at its base and its outer edge, as well as particulars for any splines or circles that may be needed to help construct the shape so that the gears will mesh smoothly.
I have 3D printed gears that mesh well with Lego Technic gears. I had the same issue as you that although the module(m) = 1, the root and tip diameters are not specified anywhere.
I used digital calipers to measure the tip diameter as accurately as I could and got the following results:




Gear teeth (z)
Measured Tip Diameter




8
9.80mm


12
13.30mm


16
17.37mm


20
21.36mm


24
25.75mm


28
29.50mm


36
37.31mm


40
41.63mm


56
57.80mm


60
61.35mm




Doing a linear regression on this table yielded: TipDiameter = mz + 1.494
I used these parameters in Sketchup with the &quot;Rack &amp; Pinion&quot; plugin to draw the involute gear profile. If you are a developer you can view the code of this plugin to see exactly how it calculates point coordinates and then uses these to create a curve entity for each part of each tooth. I can't imagine you want to do that by hand though!
Of course if you're printing standard technic sizes, you can always just convert the ldraw DAT file for the part you're interested in into STL and print that? It works surprisingly well (3D print on the left)