How about a couple of programs which create gears?
Attached is a zip file (after downloading, edit the extension from .zipper to .zip before attempting to open the file). It contains 1 User Function program and 3 GRIP programs for modeling gears. Perhaps one of them will be of use to you. There's no documentation as such, but there is some information contained in the source files that you may wish to review before attempting to use them. Note that these programs are being provided as is with no implied warranty.
John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA