//these 4 functions are used by gear function polar(r,theta) = r*[sin(theta), cos(theta)]; //convert polar to cartesian coordinates function iang(r1,r2) = sqrt((r2/r1)*(r2/r1) - 1)/3.1415926*180 - acos(r1/r2); //unwind a string this many degrees to go from radius r1 to radius r2 function q7(f,r,b,r2,t,s) = q6(b,s,t,(1-f)*max(b,r)+f*r2); //radius a fraction f up the curved side of the tooth function q6(b,s,t,d) = polar(d,s*(iang(b,d)+t)); //point at radius d on the involute curve pi = 3.1415926; module space( mm_per_tooth = 3, //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth number_of_teeth = 11, //total number of teeth around the entire perimeter hole_diameter = 3, //diameter of the hole in the center, in mm thickness = 6, //thickness of gear in mm twist = 0, //teeth rotate this many degrees from bottom of gear to top. 360 makes the gear a screw with each thread going around once pressure_angle = 28, //Controls how straight or bulged the tooth sides are. In degrees. clearance = 0.0, //gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters) backlash = 0.0 //gap between two meshing teeth, in the direction along the circumference of the pitch circle ){ p = mm_per_tooth * number_of_teeth / pi / 2; //radius of pitch circle c = p + mm_per_tooth / pi - clearance; //radius of outer circle b = p*cos(pressure_angle); //radius of base circle r = p-(c-p)-clearance; //radius of root circle t = mm_per_tooth/2-backlash/2; //tooth thickness at pitch circle k = -iang(b, p) - t/2/p/pi*180; //angle to where involute meets base circle on each side of tooth linear_extrude(height = thickness, center = true, convexity = 10, twist = twist) polygon( points=[ [0, -hole_diameter/10], polar(r, -181/number_of_teeth), polar(r, r