inner_radius = 8.0/2.0; outer_radius = 25.0/2.0; num_points = 40; gear_width = 1; thickness = 3.0; thresh = 0.4; protrusion_thickness = 2.0; pi = 3.1415; module gear(){ points = [ for (i = [0 : 1 : num_points]) (outer_radius + gear_width * (i % 2)) * [ sin(360 / num_points * i), cos(360 / num_points * i) ] ]; difference(){ union(){ cylinder(r=inner_radius + 2.0, h=thickness + 2.0, center=true, $fn=100); linear_extrude(height = thickness, center = true, convexity = num_points) polygon(points); } cylinder(r=inner_radius, h=thickness + 2.0, center=true, $fn=100); } } gear();