diff --git a/gear-v3.scad b/gear-v3.scad index 9776c3a..e5ac0e3 100644 --- a/gear-v3.scad +++ b/gear-v3.scad @@ -36,8 +36,10 @@ // Thickness of all gear wheels is 3.8mm // Standard 40t gear: root_radius=18.75 outer_radius=20.85 (mm_per_tooth =~ 3.1 by root) // Standard 24t gear: root_radius=10.7 outer_radius=12.8 (mm_per_tooth =~ 3.06 by root) -// Standard 16t gear: root_radius=6.8 outer_radius=7.9 (mm_per_tooth =~ 3.05 by root) +// Standard 16t gear: root_radius=6.8 outer_radius=8.7 (mm_per_tooth =~ 3.05 by root) // Standard 8t gear: root_radius=2.8 outer_radius=4.9 (mm_per_tooth =~ 3.05 by root) +// Standard 12t bevel gear: 12.7mm bottom diameter, 1.6mm top teeth length, 10.6mm top teeth outer diameter, 7.7mm top teeth root diameter, 2.5mm gear height + 0.5mm flat base + 1mm spacer at bottom +// Standard 20t idler bevel gear: 20.4mm bottom diameter, 18.4mm top teeth outer diameter, 1.8mm top teeth length, 15.6mm top teeth root diameter // Formulas for gear radiuses: //outer_radius = mm_per_tooth*(n_teeth/2+1)/3.1415926 - clearance; @@ -55,15 +57,21 @@ satellites_32t(); translate([0, 0, -8]) color([0.5, 1, 1, 1]) - carrier_32t_simpler(); -translate([0, 0, 16]) + carrier_32t_easy(); +translate([20, 0, 0]) + color([1, 0.5, 0.5, 1]) + rotate([0, 0, -22.5]) std_gear8(); +/*translate([0, 0, 16]) rotate([0, 180, 0]) color([0.5, 1, 0.5, 1]) sun_drive_32t();*/ -/* 2-stud-thick variant of 32-teeth ring gear */ +/* 1-stud/2-stud thick variants of 32-teeth ring gear */ -//ring_gear_2u_32t(); +//ring_gear_1u_32t(); +ring_gear_2u_32t(); +//carrier_32t_not_so_easy(); +//sun_drive_32t_simpler(); /* Standard 8-teeth gear */ @@ -97,11 +105,11 @@ translate([0, 0, 16]) /* Half-stud parametric gear with some holes */ -//myGear(24); +//myGear(16); /* Generic gear with involute teeth */ -//gear(mm_per_tooth=3.05, number_of_teeth=24, thickness=3.8, clearance=-0.1); +//gear(mm_per_tooth=3.05, number_of_teeth=16, thickness=4, pressure_angle=20); /* Same, but using an experimental OpenSCAD feature - vector concat() function */ @@ -109,44 +117,27 @@ translate([0, 0, 16]) //------------- -// Same as carrier_32t(), but with axle hole at the center +// Same as carrier_32t(), but solid with axle hole module sun_drive_32t() { root = 3.06*(32/2-1)/3.1415926; segments = 32*2; // so gear teeth edge never match cylinder segment edges difference() { union() { - difference() { - translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, clearance=-0.1); - cylinder($fn=100, h=8, r=root-0.5); - } - cylinder($fn=100, h=8, r=3.5); - difference() { - union() { - difference() { - translate([0, 0, 0.8-0.1]) cylinder($fn=32*2, h=7.2+0.1, r=root); - translate([0, 0, -0.1]) cylinder($fn=32*2, h=7.1, r=root-1); - } - translate([-8, 0, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([0, -8, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([0, 8, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([8, 0, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([-0.5, -root+0.5, 0]) cube(size=[1, root*2-1, 8]); - rotate([0, 0, 90]) translate([-0.5, -root+0.5, 0]) cube(size=[1, root*2-1, 8]); - } - translate([-20, -20, -0.2]) cube(size=[40, 40, 1]); - } + translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, pressure_angle=20); + cylinder($fn=100, h=7.2, r=root); + cylinder($fn=100, h=8, r=3.6); } rotate([0, 0, 45]) axleCut(0, 0, -0.2, 10); - translate([-8, 0, -0.2]) cylinder($fn=32, h=10, r=2.5); - translate([0, -8, -0.2]) cylinder($fn=32, h=10, r=2.5); - translate([0, 8, -0.2]) cylinder($fn=32, h=10, r=2.5); - translate([8, 0, -0.2]) cylinder($fn=32, h=10, r=2.5); + translate([-8, 0, -0.2]) cylinder($fn=32, h=10, r=2.55); + translate([0, -8, -0.2]) cylinder($fn=32, h=10, r=2.55); + translate([0, 8, -0.2]) cylinder($fn=32, h=10, r=2.55); + translate([8, 0, -0.2]) cylinder($fn=32, h=10, r=2.55); - translate([-8, 0, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); - translate([0, -8, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); - translate([0, 8, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); - translate([8, 0, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); + translate([-8, 0, -0.1]) cylinder($fn=32, h=1+0.1, r=3); + translate([0, -8, -0.1]) cylinder($fn=32, h=1+0.1, r=3); + translate([0, 8, -0.1]) cylinder($fn=32, h=1+0.1, r=3); + translate([8, 0, -0.1]) cylinder($fn=32, h=1+0.1, r=3); } } @@ -156,63 +147,55 @@ module sun_drive_32t_simpler() { union() { difference() { union() { + gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=7.2, pressure_angle=20); difference() { - translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, clearance=-0.1); - cylinder($fn=100, h=8, r=root-0.5); + cylinder($fn=32*2, h=7.2, r=root); + translate([0, 0, 1]) cylinder($fn=32*2, h=7.1, r=root-2); } - difference() { - translate([0, 0, 0.8]) cylinder($fn=32*2, h=7.2, r=root); - translate([0, 0, -0.1]) cylinder($fn=32*2, h=7.1, r=root-1); - } - cylinder($fn=100, h=8, r=3.5); + cylinder($fn=100, h=8, r=1.95+2); union() { - translate([-0.5, -root+0.5, 0.8]) cube(size=[1, root*2-1, 6.4]); - rotate([0, 0, 90]) translate([-0.5, -root+0.5, 0.8]) cube(size=[1, root*2-1, 6.4]); + translate([-1, -root+0.5, 0.8]) cube(size=[2, root*2-1, 6.4]); + rotate([0, 0, 90]) translate([-1, -root+0.5, 0.8]) cube(size=[2, root*2-1, 6.4]); } } - rotate([0, 0, 45]) axleCut(0, 0, -0.2, 10); + rotate([0, 0, 45]) axle(0, 0, -0.2, 10); } } } -// Simpler planetary carrier -module carrier_32t_simpler() { - root = 3.06*(32/2-1)/3.1415926; - segments = 32*2; // so gear teeth edge never match cylinder segment edges +// Symmetric planetary carrier gear (not so easy to print because it needs support) +module carrier_32t_not_so_easy() { + root = 3.1*(32/2-1)/3.1415926; + fn = 32*2; // so gear teeth edge never match cylinder segment edges difference() { union() { - difference() { - translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, clearance=-0.1); - cylinder($fn=100, h=8, r=root-0.5); - } - cylinder($fn=100, h=8, r=3.5); - difference() { - union() { - difference() { - translate([0, 0, 0.8-0.1]) cylinder($fn=32*2, h=7.2+0.1, r=root); - translate([0, 0, -0.1]) cylinder($fn=32*2, h=7.1, r=root-1); - } - translate([-8, 0, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([0, -8, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([0, 8, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([8, 0, 0.1]) cylinder($fn=32, h=8-0.2, r=3.5); - translate([-0.5, -root+0.5, 0]) cube(size=[1, root*2-1, 8]); - rotate([0, 0, 90]) translate([-0.5, -root+0.5, 0]) cube(size=[1, root*2-1, 8]); - } - translate([-20, -20, -0.2]) cube(size=[40, 40, 1]); - } + translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.1, number_of_teeth=32, thickness=4, pressure_angle=20); + translate([0, 0, 0.8]) cylinder($fn=fn, r=root, h=6.4); + cylinder($fn=32, r=2.4+0.15+1.2, h=8); } - translate([0, 0, -0.2]) cylinder($fn=32, h=10, r=2.5); + translate([0, 0, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([-8, 0, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([0, -8, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([0, 8, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([8, 0, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + } +} - translate([-8, 0, -0.2]) cylinder($fn=32, h=10, r=2.5); - translate([0, -8, -0.2]) cylinder($fn=32, h=10, r=2.5); - translate([0, 8, -0.2]) cylinder($fn=32, h=10, r=2.5); - translate([8, 0, -0.2]) cylinder($fn=32, h=10, r=2.5); - - translate([-8, 0, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); - translate([0, -8, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); - translate([0, 8, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); - translate([8, 0, 7.2]) cylinder($fn=32, h=0.8+0.1, r=3); +// Easy to print planetary carrier gear +module carrier_32t_easy() { + root = 3.1*(32/2-1)/3.1415926; + fn = 32*2; // so gear teeth edge never match cylinder segment edges + difference() { + union() { + gear_teeth(mm_per_tooth=3.1, number_of_teeth=32, thickness=6.4, pressure_angle=20); + cylinder($fn=fn, r=root, h=6.4); + cylinder($fn=32, r=2.4+0.15+1.2, h=7.2); // 1.2 = 0.4(nozzle)*3 perimeters + } + translate([0, 0, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([-8, 0, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([0, -8, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([0, 8, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); + translate([8, 0, -0.2]) cylinder($fn=32, h=10, r=2.4+0.15); } } @@ -222,7 +205,7 @@ module carrier_32t() { difference() { union() { difference() { - translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, clearance=-0.1); + translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, pressure_angle=20); cylinder($fn=100, h=8, r=root-0.5); } difference() { @@ -254,79 +237,34 @@ module carrier_32t() { } // Most compact planetary ring gear: 1 unit thick, 32 teeth outside, 24 teeth inside -// + 3 notches at each side to lower friction module ring_gear_1u_32t() { difference() { - union() { - translate([0, 0, 2]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, clearance=-0.1); - translate([0, 0, 0.8]) cylinder($fn=32*2, h=6.4, r=3.06*(32/2-1)/3.1415926); - // top knobs - translate([-12.8, 0, 6]) difference() { - sphere($fn=30, r=2, center=true); - translate([0, 0, -0.9]) cube(size=[6, 6, 4], center=true); - } - rotate([0, 0, 120]) translate([-12.8, 0, 6]) difference() { - sphere($fn=30, r=2, center=true); - translate([0, 0, -0.9]) cube(size=[6, 6, 4], center=true); - } - rotate([0, 0, 240]) translate([-12.8, 0, 6]) difference() { - sphere($fn=30, r=2, center=true); - translate([0, 0, -0.9]) cube(size=[6, 6, 4], center=true); - } - // bottom knobs - translate([-12.8, 0, 2]) difference() { - sphere($fn=30, r=2, center=true); - translate([0, 0, 0.9]) cube(size=[6, 6, 4], center=true); - } - rotate([0, 0, 120]) translate([-12.8, 0, 2]) difference() { - sphere($fn=30, r=2, center=true); - translate([0, 0, 0.9]) cube(size=[6, 6, 4], center=true); - } - rotate([0, 0, 240]) translate([-12.8, 0, 2]) difference() { - sphere($fn=30, r=2, center=true); - translate([0, 0, 0.9]) cube(size=[6, 6, 4], center=true); - } - } - translate([0, 0, 1.8]) gear_teeth(mm_per_tooth=3.1415926, number_of_teeth=24, thickness=4.4, clearance=-0.1); - translate([0, 0, -0.1]) cylinder($fn=32*2, h=8.2, r=(24/2-1)); + gear(mm_per_tooth=3.06, number_of_teeth=32, thickness=7.8, pressure_angle=20); + translate([0, 0, 1.7]) gear(mm_per_tooth=3.28, number_of_teeth=24, thickness=4.4, pressure_angle=20); + translate([0, 0, -0.1]) cylinder($fn=32*2, h=8.2, r=3.28*(24/2-1)/3.1415926); } } -// 2U 32T ring gear, with mounting holes +// Solid easy-to-print 2U 32T ring gear, with mounting holes module ring_gear_2u_32t() { fn = 32*2; difference() { union() { - translate([0, 0, 10]) gear_teeth(mm_per_tooth=3.06, number_of_teeth=32, thickness=4, clearance=-0.1); - translate([0, 0, 2]) cylinder($fn=fn, h=14, r=3.06*(32/2-1)/3.1415926); + gear_teeth(mm_per_tooth=3.1, number_of_teeth=32, thickness=6.4, pressure_angle=20); + cylinder($fn=fn, h=13.2, r=3.1*(32/2-1)/3.1415926); } - difference() { - cylinder($fn=fn, h=8.8, r=3.06*(32/2+1)/3.1415926+1); - translate([0, 0, -0.1]) cylinder($fn=fn, h=9, r=24/2+2.1); + translate([0, 0, 6.4]) difference() { + // inner 24-teeth gear radius should be 26.4mm, but we also make it slightly bigger + gear(mm_per_tooth=3.28, number_of_teeth=24, thickness=8.8+0.1, pressure_angle=20); + // printed holes are generally smaller than model ones by 0.5-0.6mm... => +0.3 radius :-( + cylinder($fn=fn, h=0.8, r=2.4+1+0.3); } - translate([0, 0, -0.1]) difference() { - gear(mm_per_tooth=3.1415926, number_of_teeth=24, thickness=8.8+0.1, clearance=-0.1); - translate([0, 0, 8-0.1]) cylinder($fn=fn, h=0.8+0.2, r=3.5); - } - translate([0, 0, 9.8]) difference() { - cylinder($fn=fn, h=8, r=(3.06*(32/2-1)/3.1415926-1)); - translate([-0.5, -20, -0.1]) cube(size=[1, 40, 10]); - translate([-20, -0.5, -0.1]) cube(size=[40, 1, 10]); - translate([0, 0, -0.1]) cylinder($fn=fn, h=10, r=3.5); - translate([0, -8, -0.1]) cylinder($fn=fn, h=10, r=3.5); - translate([0, 8, -0.1]) cylinder($fn=fn, h=10, r=3.5); - translate([-8, 0, -0.1]) cylinder($fn=fn, h=10, r=3.5); - translate([8, 0, -0.1]) cylinder($fn=fn, h=10, r=3.5); - } - translate([0, 0, 15.2]) difference() { - cylinder($fn=fn, h=1, r=(3.06*(32/2+1)/3.1415926+1)); - translate([0, 0, -0.1]) cylinder($fn=fn, h=10, r=3.5); - } - translate([0, 0, -0.1]) cylinder($fn=fn, h=20, r=2.5); - translate([0, -8, -0.1]) cylinder($fn=fn, h=20, r=2.5); - translate([0, 8, -0.1]) cylinder($fn=fn, h=20, r=2.5); - translate([-8, 0, -0.1]) cylinder($fn=fn, h=20, r=2.5); - translate([8, 0, -0.1]) cylinder($fn=fn, h=20, r=2.5); + // same for other holes + translate([0, 0, -0.1]) cylinder($fn=fn, h=20, r=2.4+0.3); + translate([0, -8, -0.1]) cylinder($fn=fn, h=20, r=2.4+0.3); + translate([0, 8, -0.1]) cylinder($fn=fn, h=20, r=2.4+0.3); + translate([-8, 0, -0.1]) cylinder($fn=fn, h=20, r=2.4+0.3); + translate([8, 0, -0.1]) cylinder($fn=fn, h=20, r=2.4+0.3); } } @@ -341,12 +279,50 @@ module satellites_32t() { //------------- +// An attempt to make something like standard 20t bevel gear... +module bevel_20t() { + difference() { + union() { + translate([0, 0, 1.5]) + linear_extrude(slices=5, height=2.5, scale=(20/2+1-2.5*tan(45))/(20/2+1), twist=0) + gear_concat_flat(mm_per_tooth=3.53, number_of_teeth=20, backlash=2, clearance=0.8, trim_factor=0.7); + cylinder($fn=48, h=1.5, r=3.53*(20/2-1)/3.1415926); + cylinder($fn=48, h=4, r=3.53*(20/2-1)/3.1415926*(20/2+1-2.5*tan(45))/(20/2+1)); + } + translate([0, 0, -0.1]) + difference() { + cylinder($fn=48, h=8, r=100); + translate([0, 0, -0.1]) cylinder($fn=48, h=8.2, r=3.53*(20/2-1)/3.1415926); + } + axle(0, 0, -0.2, 10); + } +} + +// An attempt to make something like standard 12t bevel gear... +module bevel_12t() { + difference() { + union() { + translate([0, 0, 1.5]) + linear_extrude(slices=5, height=2.5, scale=(12/2+1-2.5*tan(45))/(12/2+1), twist=0) + gear_concat_flat(mm_per_tooth=3.76, number_of_teeth=12, backlash=1, clearance=0.4, trim_factor=0.75); + cylinder($fn=48, h=1.5, r=3.76*(12/2-1)/3.1415926); + cylinder($fn=48, h=4, r=3.76*(12/2-1)/3.1415926*(12/2+1-2.5*tan(45))/(12/2+1)); + } + translate([0, 0, -0.1]) + difference() { + cylinder($fn=48, h=8, r=10); + translate([0, 0, -0.1]) cylinder($fn=48, h=8.2, r=3.76*(12/2-1)/3.1415926); + } + axle(0, 0, -0.2, 10); + } +} + // Standard 8-teeth gear module std_gear8() { difference() { union() { cylinder($fn=50, h=8, r=3.05*(8/2-1)/3.1415926); - translate([0, 0, 2.1]) gear(mm_per_tooth=3.05, number_of_teeth=8, thickness=3.8, clearance=-0.1); + translate([0, 0, 2.1]) gear(mm_per_tooth=3.05, number_of_teeth=8, thickness=3.8, pressure_angle=20); } axle(0, 0, -1, 10); }} @@ -358,7 +334,7 @@ module planetary_ring_gear(plane_height = 1) { difference() { union() { cylinder($fn=80, h=2, r=(0.1+3.1*(40/2+1)/3.1415926)); - translate([0, 0, 2]) gear(mm_per_tooth=3.1, number_of_teeth=40, thickness=4, clearance=-0.1); + translate([0, 0, 2]) gear(mm_per_tooth=3.1, number_of_teeth=40, thickness=4, pressure_angle=20); translate([0, 0, 5]) cylinder($fn=80, h=2.2, r=(3.1*(40/2-1)/3.1415926)); cylinder($fn=50, h=8, r=3.5); } @@ -447,7 +423,7 @@ module offsetGearSparse(number_of_teeth, gear_height=3.9, jaggy=1) { module offsetGear(number_of_teeth, gear_height=3.9, jaggy=1) { difference() { union() { - gear(number_of_teeth=number_of_teeth, mm_per_tooth=3.05, thickness=gear_height, clearance=-0.1); + gear(number_of_teeth=number_of_teeth, mm_per_tooth=3.05, thickness=gear_height, pressure_angle=20); translate([0, 0, gear_height]) cylinder($fs=0.5, h=8-gear_height, r=3.5); } // axle hole @@ -491,8 +467,8 @@ module offsetClutchGear(number_of_teeth, gear_height=3.8) { // Axle module axle(x, y, z, height) { - axle_gap = 1.85; - hole_radius = 2.5; + axle_gap = 1.95; + hole_radius = 2.55; union() { translate([x - hole_radius, y - axle_gap/2, z]) roundedRect([hole_radius * 2, axle_gap, height], .2); @@ -503,15 +479,22 @@ module axle(x, y, z, height) { // Axle hole (for difference()) with fixing slit module axleCut(x, y, z, height) { - axle_gap = 1.85; - axle_gap_cut = 1.7; - hole_radius = 2.5; + axle_gap = 1.95; + axle_gap_cut = 1.8; + hole_radius = 2.55; union() { translate([x - hole_radius, y - axle_gap/2, z]) roundedRect([hole_radius * 2, axle_gap, height], .2); translate([x - axle_gap_cut/2, y - hole_radius, z]) roundedRect([axle_gap_cut, hole_radius * 2, height], .2); translate([x-0.25, y-5, z]) cube(size=[0.5, 10, height]); + translate([x, y, z]) difference() { + cylinder($fn=32, r=4, h=height); + translate([0, 0, -0.1]) cylinder($fn=32, r=3.6, h=height+0.2); + translate([-2, -5, -0.1]) cube(size=[4, 10, height+0.2]); +/* translate([0, -2*sqrt(2), height/2-0.1]) rotate([0, 0, 45]) cube(size=[4, 4, height+0.2], center=true); + translate([0, 2*sqrt(2), height/2-0.1]) rotate([0, 0, 45]) cube(size=[4, 4, height+0.2], center=true);*/ + } } } @@ -521,7 +504,7 @@ module clutchGear(number_of_teeth) { union() { difference() { union() { - gear(thickness=3.7, mm_per_tooth=3.05, number_of_teeth=number_of_teeth, clearance = -0.1); + gear(thickness=3.7, mm_per_tooth=3.05, number_of_teeth=number_of_teeth, pressure_angle=20); translate([0, 0, 1]) cylinder($fn=number_of_teeth*2, h=5.8-1, r=6.8); translate([0, 0, -2]) cylinder($fn=number_of_teeth*2, h=2+1, r=3.7); } @@ -580,7 +563,7 @@ module myGearParamed(num_teeth, holes_row, holes_col, plus_row, plus_col) hole_radius = 2.5; difference() { - gear(thickness=gearHeight, number_of_teeth=num_teeth, mm_per_tooth=3.1415926); + gear(thickness=gearHeight, number_of_teeth=num_teeth, mm_per_tooth=3.06, pressure_angle=20); // We do two rectangular grids of holes, rotate 90 degrees and do them // again. @@ -747,7 +730,6 @@ module gear_teeth( } }; - // Same gear, but using recursion and experimental OpenSCAD vector // concat() function which must be enabled at compile time with CONFIG+=experimental // Clean and slightly faster @@ -774,6 +756,43 @@ module gear_concat( ); }; +// Same in 2D (non-extruded) +module gear_concat_flat( + 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 + 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 + trim_factor = 1 +) { + assign(pi = 3.1415926) + assign(p = mm_per_tooth * number_of_teeth / pi / 2) //radius of pitch circle + assign(c = p + mm_per_tooth / pi - clearance) //radius of outer circle + assign(b = p*cos(pressure_angle)) //radius of base circle + assign(r = p-(c-p)-clearance) //radius of root circle + assign(t = mm_per_tooth/2-backlash/2) //tooth thickness at pitch circle + assign(k = -iang(b, p) - t/2/p/pi*180) //angle to where involute meets base circle on each side of tooth + polygon( + points = gear_points_trimmed(r, b, c, k, number_of_teeth, number_of_teeth, trim_factor), + paths = [ range(15*(number_of_teeth)) ] + ); +}; +function gear_points_trimmed(r, b, c, k, number_of_teeth, i, f) = + (i <= 0 ? [] : concat( + gear_points_trimmed(r, b, c, k, number_of_teeth, i-1, f), + tooth_base_points_trimmed(r, b, c, k, number_of_teeth, i, f) + )); +function tooth_base_points_trimmed(r, b, c, k, number_of_teeth, i, f) = + (r < b ? concat( + [ polar(r*f, i*360/number_of_teeth + k) ], + tooth_points(r, b, c, k, number_of_teeth, i), + [ polar(r*f, i*360/number_of_teeth - k), + polar(r*f, i*360/number_of_teeth + 180/number_of_teeth) ] + ) : concat( + tooth_points(r, b, c, k, number_of_teeth, i), + [ polar(r*f, i*360/number_of_teeth + 180/number_of_teeth) ] + )); + function gear_points(r, b, c, k, number_of_teeth, i) = (i <= 0 ? [] : concat( gear_points(r, b, c, k, number_of_teeth, i-1), @@ -814,7 +833,6 @@ function q7r(f,r,b,r2,t,s,rot) = q6r(b,s,t,(1-f)*max(b,r)+f*r2,rot); function q6r(b,s,t,d,rot) = polar(d,rot+s*(iang(b,d)+t)); - // Original gear() module // Teeth shape is good, but the body is composed from individual sectors; // this sometimes results in bad "degenerate" faces due to floating point issues.