# Parametric Helical Gear Generator

**URL:** <https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860>\
**Category:** Share your creations\
**Created:** [March 5, 2025, 5:31pm UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860 "2025-03-05T17:31:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![PEC](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@PEC](https://discourse.shapr3d.com/u/PEC)\
**Post date:** [March 5, 2025, 5:31pm UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860/1 "2025-03-05T17:31:22Z")

</div>

Hi,  
Here is a fully parametric gear generator, with variable defined helix angle, teeth number, modulus, pressure angle, backlash, teeth offset, gear form factor, number of fillet per turn for the worm, etc. 😀

[Variables defined helical gear v2.14.shapr](https://discourse.shapr3d.com/uploads/short-url/aXsIfrh3jM47ZZksiUEwnQXdkAz.shapr) (11.8 MB)

 ![Gear generator overview](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/9/5/953b4531043298dd5559ded87b5a6c261a8c5a90.jpeg)  
The generator creates left and right versions of the gears, either centered with one tooth aligned up (for 3D printing or exporting into other projects) or meshed together and “animated” with the “rot” variable to check for functional interferences.

Worm is created only when helix angle beta is not zero degree. When beta equals zero, gears are spur gears.

_Video below demonstrates most of the features._

The key thing to understand regarding helical gears is the fact that helical gears are _defined_ using _normal_ parameters but are _drawn_ using _tangential_ parameters.  
_Normal_ parameters are measured in a plane _perpendicular to a tooth_ while _tangential_ parameters are measured in a plane _parallel to the side of the gear_.

* * *

To try to visualise things, it is helpful to remind that a gear can mesh with a rack, so the gear and the rack share the same parameters (pressure angle, modulus, etc). We could manufacture a gear using a (sharp) rack as the tool:

- slide the rack to “cut” one tooth
- rotate the gear to be manufactured by 1/10 of the tooth
- translate the rack by 1/10 of the pitch
- repeat the process

![_SpurGearcutting-resize](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/a/2/a2ef410cde4870c136c6e99a26fd9c649f0f799f.gif)

For **spur gears** , _normal and tangential planes are equal_ because the teeth are perpendicular to the side of the gear.

Now, _using the same exact rack and movement,_ we just rotate the rack around the vertical axis by an angle beta : **we get an helical gear with an helix angle beta**.

![_HelicalGearcutting-resize](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/e/1/e1f784f4709a930d07d1f32e84b252abfeed50d2.gif)

Because we are _using the same rack_, _normal_ parameters measured _perpendicular_ to the rack’s teeth are exactly the same as for the spur gear, **because the rack has not changed**.

**This is the reason why helical gears are defined by normal parameters.**

But the **angle beta** by which we rotated the rack _changes_ the _tangential_ parameters measured _along the side of the gear_: as a result, we must compute the tangential parameters to be able to sketch the helical gear, and we can now do it with variables and expressions.

* * *

There were a few challenges to solve in order to create this generator.

- First challenge was to keep the history clean (error free) whatever the parameters’ value (25 parameters, 50 computed variables and about 100 history’s steps 😅).

- Second challenge was to automatically delete the worm when the helix angle Beta is null, because in theory worm cannot mesh with spur gear without backlash. Not so easy without boolean variable nor conditional step’s execution.

- Third challenge was to recreate trigonometry functions (sin, cos, tan, acos, atan) with enough accuracy using Taylor’s series, and was a good test for variables. Here is an exemple 🤯

```auto
theta1_ba = r2d * (Pi / 2 + d1_b / d1_a * (-1 + d1_b / d1_a * d1_b / d1_a * (-1 / 6 + d1_b / d1_a * d1_b / d1_a * (-3 / 40 + d1_b / d1_a * d1_b / d1_a * (-5 / 112 + d1_b / d1_a * d1_b / d1_a * (-35 / 1152 + d1_b / d1_a * d1_b / d1_a * (-63 / 2816 + d1_b / d1_a * d1_b / d1_a * (-231 / 13312 + d1_b / d1_a * d1_b / d1_a * (-143 / 10240 + d1_b / d1_a * d1_b / d1_a * (-6435 / 557056))))))))))` 

```

Some technical documentation is embedded into the .shapr’s workspace using images, as a substitute to notes.

**Parameters’ definition:**

 ![Parameters p2](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/a/6/a69d6a4561814053af14e953772822155ea0d363.jpeg)

**Equations to compute the gears:**  
There are some interesting things such as is\_beta\_null variable, which is a -crazy- way to overcome the miss of boolean variables, or the addition of 1e-6 deg to gamma variables to force revolve tool to operate as extrude tool when beta is null, because we do not have conditional execution at present.

 ![Parameters p1](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/4/0/405c4ce9b0f20cf6556f822473da43bb2c194cbc.jpeg)

**Gears’ parameters**

 ![Gears 01-04.tuto](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/e/c/ec60e93e50b6fccb83acf17a9793bfd7bdb08a3a.jpeg)  
 ![Gears 01-05.tuto](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/e/1/e13fbf04cb897acfa678b9085b4b014afd17538f.jpeg)

**Rack’s parameters**

 ![Gear 04.tuto](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/9/8/98e0e42afcd09c5ded43a3cd444247cf66cd2f23.jpeg)

**Worm’s parameters**

 ![Gear 05.tuto](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/c/a/cadfbfd7e8c547d180eed036b817a0fde235b6c2.jpeg)

**Helix angle Beta: from spur gear to helical gear**  
 ![animated gears beta loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/2/c/2c316e2ecfefb9b951dd67bad40e4487a484e21a.gif)

**Worm: impact of number of fillet per turn**  
 ![animated gears Zv loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/a/a/aa9be4cac3ef9127373d208024b1f6078a5b0972.gif)

**Meshing with 0 backlash**  
 ![animated gears meshing](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/2/9/290839e89d6b6b60caaee6be20e493a5b935d1c0.gif)

**Pressure angle impact on teeth’s shape**  
 ![animated alpha_t loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/2/2/22a92dd1028846c88df2fb2b99b56b62d009d01a.gif)

**Teeth number impact on teeth shape**  
 ![animated gears Z loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/c/8/c8973567681c5640bac63d1de6e7e2e10cfdfa5b.gif)

**Backlash variation**  
 ![animated gears backlash loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/9/c/9c199b232a5cf300e02e2f1fc462cea52aa6adbd.gif)

**Teeth’s offset impact on teeth’s shape and gears’ center distance**

- **sum of offset equals 0** : no impact on centers distance  
 ![animated gears cst distance loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/5/b/5b93b3c2a533b3eb0f025e63dad15e6217daca11.gif)

- **sum of offset not equals 0** : impact on centers distance  
 ![animated gears var distance loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/3/a/3ad51640daba135c7f4b7290f1989f94a1d21dc6.gif)

**Teeth offset can solve functional interferences when low teeth count**  
 ![animated gears interferences loop](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/f/c/fc45962081ce387585d7e75504e5542311013f12.gif)

**3 points control spline computation to approximate involute of a circle**

 ![Gear 01.tuto](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/6/f/6fcccea4b4fbb5815350d5a7b619044b6ee50360.jpeg)

---

<div class="post-metadata">

**Author:** ![Bob3DPO](https://avatars.discourse-cdn.com/v4/letter/b/7993a0/32.png) [@Bob3DPO](https://discourse.shapr3d.com/u/Bob3DPO)\
**Post date:** [March 5, 2025, 8:05pm UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860/2 "2025-03-05T20:05:21Z")

</div>

This is **amazing work,** @PEC! Thank you for sharing!

---

<div class="post-metadata">

**Author:** ![GroMark](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@GroMark](https://discourse.shapr3d.com/u/GroMark)\
**Post date:** [March 11, 2025, 6:26pm UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860/3 "2025-03-11T18:26:06Z")

</div>

Thank you sooo much, this is awesome! I‘ve been trying to create gears for years now, with only moderate success. I only have a few questions:

Are you going to create a Generator with the option for Bevel Gears?

How relevant are all the parameters like teeth size, chamfer etc. for the final result? E. G. Which parameters are useful on which settings for which use cases?

Thanks for helping us, this is really useful!

---

<div class="post-metadata">

**Author:** ![PEC](https://avatars.discourse-cdn.com/v4/letter/p/67e7ee/32.png) [@PEC](https://discourse.shapr3d.com/u/PEC)\
**Post date:** [March 14, 2025, 11:11am UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860/4 "2025-03-14T11:11:29Z")

</div>

Hi @GroMark

I will probably add Bevel Gears support in the future, but only when we will have trigonometry functions available, because at present, a significant part of the work is to recreate sin, cos, tan and inverse trig functions asin, acos, atan. I miss also sqrt and pow functions… With bevel gears, you have more angles to deal with.

To answer your second question, I tried to group parameters by order of importance.

- 0 : **teeth number** : be careful with low teeth count (8 to 15 teeth) for Z1-Z2 as it may lead to functional interferences depending on the teeth count of the meshing gear (this is not inaccuracy of the generator). With 17 teeth or more, there is theoretically no functional interference
- 1 : **beta** : must match the other gear to mesh with. Right gear meshes with a left gear if you want the axes to be parallel. If you don’t, you will end with a Screw Gear (Crossed Helical Gear), which is fine but load capacity is limited (because of contact point instead of line contact)
- 2 : **modulus m\_n** : this is the “size of the tooth”, and it is standardized ([Gear - Wikipedia](https://en.wikipedia.org/wiki/Gear)).  
0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.25, 1.5, 2.0, 2.5, 3, 4, 5, 6, 8, 10 (…) mm  
3D printing with a 0.4mm nozzle on my Prusa MK4, m\_n = 0.5mm is the minimum reasonable value; 0.8mm is very good
- 3 : **pressure angle alpha\_n** : this is standardized, keep 20° unless you have a good reason to change, such as meshing with an existing gear that has a different pressure angle or functional interferences that cannot be fixed by teeth’s offset
- 4 : **tooth height** : this is standardized, don’t change it unless you have a good reason
- 5 : **backlash** : this is the clearance required for the gears to mesh. It depends on the manufacturing process. For 3D printing with 0.4mm nozzle, 0.1mm to 0.2mm works good for me
- 6 : **teeth offset** : keep it to zero unless you have a good reason to change. This is a more advanced parameter which has several purpose:  
° adjust the center distance between two gears without changing teeth count, modulus or helix angle; center distance is modified when x1+x2 ≠ 0 (for gears 1 and 2)  
° fix functional interferences in case pinion has a low teeth count  
° fix tooth geometry; eg increase tooth’s resistance when the base of the tooth is too thin in case of low teeth count
- 7 : **teeth\_fillets** : on the negative side, it reduces the useful length of the tooth’s profile but on the positive side, it breaks sharp angle and it helps reducing functional interferences. For 3D printed gears, I usually use 0.1 to 0.2
- 8 : **teeth\_chamfer and axle\_chamfer** : teeth\_chamfer prevents machining burr to interfere with meshing. Not mandatory for 3D printing in my experience.  
For visualization, chamfer and fillets are great because they catch the light and are indeed mandatory to get a nice rendering.
- 9 : **b, w, d\_axle** : no impact on teeth’s geometry but define gears

 ![param explained](https://us1.discourse-cdn.com/flex002/uploads/shapr3d/original/3X/9/0/901bb2734c19a6b977c83eb289fb8543b2a39d9e.png)

---

<div class="post-metadata">

**Author:** ![GroMark](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@GroMark](https://discourse.shapr3d.com/u/GroMark)\
**Post date:** [March 14, 2025, 11:30am UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860/5 "2025-03-14T11:30:17Z")

</div>

Thank you, this is great!

---

<div class="post-metadata">

**Author:** ![Aquariumsetc](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@Aquariumsetc](https://discourse.shapr3d.com/u/Aquariumsetc)\
**Post date:** [March 15, 2025, 1:01am UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860/6 "2025-03-15T01:01:49Z")

</div>

Brilliant! and thank you for sharing

---

<div class="post-metadata">

**Author:** ![Justquestions](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.shapr3d.com/justquestions/32/26680_2.png) [@Justquestions](https://discourse.shapr3d.com/u/Justquestions)\
**Post date:** [March 24, 2025, 12:29am UTC](https://discourse.shapr3d.com/t/parametric-helical-gear-generator/36860/7 "2025-03-24T00:29:02Z")

</div>

A lot off work there thanks for posting.
