I just uploaded a library to Thingiverse for creating parametric involute
spur gears using list comprehension (instead of my old library that builds
a half tooth, and uses transforms to rotate and mirror and unions to
duplicate the teeth). http://www.thingiverse.com/thing:1919326
I would think this should be much quicker than the old version.
It also is as simple as possible. My old script had all sorts of arguments
for the hub size thickness and hole size, and parameters for the rim and
other holes through the gear. The new script just creates the 2D involute
gear polygon and leaves the rest up to the user. I think this works better
for a library.
It's my first project with list comprehension, so I was wondering if
someone more familiar with LCs could look at shout out "your doing it
wrong" if there are better approaches.
Thanks,
Greg Frost
I haven't seen anything wrong or any inappropriate use of LC in your code.
Whenever possible I avoid to use flatten. For instance, instead of :
gear_points=flatten([for(i=[0:num_teeth-1])
rotate_list(-360/num_teeth*i,tooth)]);
I would prefer:
gear_points=[for(i=[0:num_teeth-1],
tooth_pt=rotate_list(-360/num_teeth*i,tooth)) tooth_pt ];
I don't know the gear profile generation techniques but your code seems to
be clean and well commented.