This an OpenScad Library.
Look at screenshot to see how it becomes easy to create paired straight gears.
1) create main gear parameter.
2) create paired gear parameter based on main gear
3) draw and move both gear
4) parameter of this "paired gear" may become a "main gear parameter" for a third gear, etc...
Stl files are only examples
Download my libraries and put it in same folders: