Hi-ratio Planetary gearing - combine industrial spur gears with 3D prints

For a stepper application I needed a planetary gearing system (PG) with a ratio of 16, reasonable dimensions, good precision, and first of all high torque transmission with minimal backlash. My idea was to compose a special one-stage PG design by reusing industrial gears. Here are the basic considerations:
- The precision of 3D printed gears is very low. Therefore especially multi-stage gearing systems needed for higher ratios suffer from high backlash.
- For reasonable printing results a module m>1.5 must be chosen which leads to large dimensions. The ratio of a one-stage PG in classical design is limited to about i=9. While you can obtain such a ratio with a 3D printed system, you’ll end up with some very large structure (>170mm diameter).
- In my stock there are countless gears in high industrial quality and small modules (e.g. from cannibalized printers) which can’t be combined to a PG, mainly because ring gears with corresponding “small” modules can’t be 3D-printed with reasonable quality and torque resistance. I also have a box full of steppers already equipped with high quality “sun” gears. Unfortunately, the module is too small to directly combine them with 3D printed parts.
The solution I found addresses all three points. It combines a first stage system with given sun and planets in high industrial quality and small module m1 from stock with a second stage system (Planets and Ring) for gaining a multiplied ratio i=i1*i2.
The second stage system will be (automatically) calculated with a much larger module m2, provided a reasonable setup with i1 <= i2 is used. Gears with m2 > 1.5 can easily be 3D-printed in reasonable height to also fully account for the increased torque t2 at output which calculates as t1*i.
To give you an impression of the range and sizes the code generates, I have uploaded some screenshots of nice designs with different gear ratios and modules m>1. The parameter values for reconstruction can be taken from the console output below the viewport.