To this end I have written a python script for generating involute gears. Other scripts are available, an OpenSCAD script thingiverse for example, however i) I like to do things myself, from scratch and ii) I'd prefer my setup work with a more mainstream programming language. The source-code is available at the bottom of this post.
The script generates involute spur gears, with pressure angles up to about 30 degrees. I hope to extend it to include racks and internal gears eventually, but it is quite useful now. Output is in SVG for easy editing in graphic-design/laser-cutting or DXF for use with OpenSCAD. I am currently working on a CGAL-based constructive solid geometry module for python that will allow CSG operations to be performed by python scripts. This would allow fully parameteric CSG design to be done in an open, mainstream language.
I've generated some examples using the following script:
# import the gears script from gears import * pa = 14.5 # pressure angle, in degrees P = 24 # pitch, teeth per unit distance # generate three gears ax, ay = gears_make_gear( pa, 12, P ) bx, by = gears_make_gear( pa, 24, P ) cx, cy = gears_make_gear( pa, 48, P ) dx, dy = gears_make_gear( 30.0, 8, P ) # write them out as svg files, scaled uniformly by 150 and 300 gears_svg_out( ax, ay, 'section_a.svg', 150 ) gears_svg_out( bx, by, 'section_b.svg', 150 ) gears_svg_out( cx, cy, 'section_c.svg', 150 ) gears_svg_out( dx, dy, 'section_d.svg', 300 )
The output is below:
14.5 degree pressure angle, 12 teeth
14.5 degree pressure angle, 24 teeth
14.5 degree pressure angle, 48 teeth
30 degree pressure angle, 8 teeth
Since I haven't finished the CGAL CSG python CSG library, I've been calling OpenSCAD from the command-line via python to generate actual gears. I 3D printed some of these on the Vancouver Hackspace (VHS) Makerbot, with reasonably good results:
These parts will eventually be used as part of a 1:4 drive for the leadscrews for my CNC. Currently I have ample torque, but cannot spin the motors fast enough to get fast rapid traversals. With a 1:4 drive, I will hopefully be able to drive the machine quite quickly.
Sourcecode for the script can be downloaded from: http://sites.google.com/site/jamesgregson/tmp/gears.py. Use it for whatever you'd like, but please don't redistribute it.
3 comments:
Excellent! Just spent 12 hours compiling pythonocc for pygears, only to find there was a bug concerning my graphics driver.
This was exactly what I was looking for. Simple, to the point, and q fine addition to CAD/CAM that runs on linux.
Glad to hear that it works for you! If you have any photos of projects where you've used the gears, I'd love to see them.
James
nice work. the only real involute python gear script I could find.
Post a Comment