How to design a spur gear in solidworks?
Another solution is the site http://hessmer.org/gears/InvoluteSpurGearBuilder.html. It can generate internal/external gears and racks. It works with circular pitch instead of module, and generates DXF files with profiles that you can import and extrude in SW. I used it to make this model: Rack-Gear Coupling.