From 086ccfc7535dcc8a35fdb58afe9c55f1537c8c82 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Thu, 7 Feb 2019 21:11:28 -0800 Subject: [PATCH] Added gear2d(), fixed clearance calculations. --- involute_gears.scad | 112 ++++++++++++++++++++++++-------------------- 1 file changed, 61 insertions(+), 51 deletions(-) diff --git a/involute_gears.scad b/involute_gears.scad index 701e7f27..12e9a88d 100644 --- a/involute_gears.scad +++ b/involute_gears.scad @@ -59,17 +59,22 @@ //gear_tooth_profile(mm_per_tooth=5, number_of_teeth=20, pressure_angle=20); module gear_tooth_profile( - 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 - bevelang = 0.0 + 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. + backlash = 0.0, //gap between two meshing teeth, in the direction along the circumference of the pitch circle + bevelang = 0.0, //Gear face angle for bevelled gears. + clearance = undef //gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters) ) { - 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 + function polar(r,theta) = r*[sin(theta), cos(theta)]; //convert polar to cartesian coordinates + function iang(r1,r2) = sqrt((r2/r1)*(r2/r1) - 1)/PI*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 + + p = pitch_radius(mm_per_tooth, number_of_teeth); + c = outer_radius(mm_per_tooth, number_of_teeth); + r = root_radius(mm_per_tooth, number_of_teeth, clearance); + b = base_radius(mm_per_tooth, number_of_teeth, pressure_angle); 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 scale([1, 1/cos(bevelang), 1]) @@ -103,17 +108,15 @@ module gear_tooth_profile( // gear2d(mm_per_tooth=5, number_of_teeth=20); // linear_extrude(height=5*20/PI/2/2, scale=0.5) gear2d(mm_per_tooth=5, number_of_teeth=20); module gear2d( - 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 - teeth_to_hide = 0, //number of teeth to delete to make this only a fraction of a circle - 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 + 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 + teeth_to_hide = 0, //number of teeth to delete to make this only a fraction of a circle + pressure_angle = 28, //Controls how straight or bulged the tooth sides are. In degrees. + clearance = undef, //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 bevelang = 0.0 ) { - p = mm_per_tooth * number_of_teeth / PI / 2; //radius of pitch circle - c = p + mm_per_tooth / PI - clearance; //radius of outer circle - r = p-(c-p)-clearance; //radius of root circle + r = root_radius(mm_per_tooth, number_of_teeth, clearance); union() { circle(r=r-0.5, $fn=number_of_teeth); for (i = [0:number_of_teeth-teeth_to_hide-1] ) { @@ -152,23 +155,23 @@ module gear2d( // Example: // gear(mm_per_tooth=5, number_of_teeth=20, thickness=10*cos(45), hole_diameter=5, twist=-30, bevelang=45, slices=12, $fa=1, $fs=1); // gear(mm_per_tooth=5, number_of_teeth=20, thickness=8, hole_diameter=5, $fa=1, $fs=1); -module gear ( +module gear( 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 thickness = 6, //thickness of gear in mm hole_diameter = 3, //diameter of the hole in the center, in mm teeth_to_hide = 0, //number of teeth to delete to make this only a fraction of a circle 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) + clearance = undef, //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 bevelang = 0.0, //angle of bevelled gear face. twist = undef, //teeth rotate this many degrees from bottom of gear to top. 360 makes the gear a screw with each thread going around once slices = undef //Number of slices to divide gear into. Useful for refining gears with `twist`. ) { - p = mm_per_tooth * number_of_teeth / PI / 2; //radius of pitch circle + p = pitch_radius(mm_per_tooth, number_of_teeth); + c = outer_radius(mm_per_tooth, number_of_teeth); + r = root_radius(mm_per_tooth, number_of_teeth, clearance); p2 = p - (thickness*tan(bevelang)); - c = p + mm_per_tooth / PI - clearance; //radius of outer circle - r = p-(c-p)-clearance; //radius of root circle difference() { linear_extrude(height=thickness, center=true, convexity=10, twist=twist, scale=p2/p, slices=slices) { gear2d( @@ -197,13 +200,6 @@ module gear ( } -//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)/PI*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 - - // Creates a rack, which is a straight line with teeth. // The same as a segment of teeth from an infinite diameter gear. // The "pitch circle" is a line along the X axis. @@ -215,21 +211,22 @@ function q6(b,s,t,d) = polar(d,s*(iang(b,d)+t)); //p // backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle // Example: // rack(mm_per_tooth=5, number_of_teeth=30, thickness=5, height=5, pressure_angle=20); -module rack ( +module rack( mm_per_tooth = 5, //this is the "circular pitch", the circumference of the pitch circle divided by the number of teeth number_of_teeth = 20, //total number of teeth along the rack thickness = 5, //thickness of rack in mm (affects each tooth) height = 10, //height of rack in mm, from tooth top to back of rack. pressure_angle = 28, //Controls how straight or bulged the tooth sides are. In degrees. - backlash = 0.0 //gap between two meshing teeth, in the direction along the circumference of the pitch circle + backlash = 0.0, //gap between two meshing teeth, in the direction along the circumference of the pitch circle + clearance = undef ) { a = adendum(mm_per_tooth); - d = dedendum(mm_per_tooth); + d = dedendum(mm_per_tooth, clearance); xa = a * sin(pressure_angle); xd = d * sin(pressure_angle); - linear_extrude(height = thickness, center = true, convexity = 10) - for (i = [0:number_of_teeth-1] ) - translate([i*mm_per_tooth,0,0]) + linear_extrude(height = thickness, center = true, convexity = 10) { + for (i = [0:number_of_teeth-1] ) { + translate([i*mm_per_tooth,0,0]) { polygon( points=[ [-1/2 * mm_per_tooth - 0.01, a-height], @@ -240,23 +237,36 @@ module rack ( [ 1/4 * mm_per_tooth - backlash + xd, -d], [ 1/2 * mm_per_tooth, -d], [ 1/2 * mm_per_tooth + 0.01, a-height], - ], - paths=[[0,1,2,3,4,5,6,7]] + ] ); + } + } + } } -//These 5 functions let the user find the derived dimensions of the gear. +//These functions let the user find the derived dimensions of the gear. //A gear fits within a circle of radius outer_radius, and two gears should have -//their centers separated by the sum of their pictch_radius. -function circular_pitch (mm_per_tooth=5) = mm_per_tooth; //tooth density expressed as "circular pitch" in millimeters -function diametral_pitch (mm_per_tooth=5) = PI / mm_per_tooth; //tooth density expressed as "diametral pitch" in teeth per millimeter -function adendum (mm_per_tooth=5) = module_value(mm_per_tooth); -function dedendum (mm_per_tooth=5) = 1.25 * module_value(mm_per_tooth); -function module_value (mm_per_tooth=5) = mm_per_tooth / PI; //tooth density expressed as "module" or "modulus" in millimeters -function pitch_radius (mm_per_tooth=5,number_of_teeth=11) = mm_per_tooth * number_of_teeth / PI / 2; -function outer_radius (mm_per_tooth=5,number_of_teeth=11,clearance=0.1) //The gear fits entirely within a cylinder of this radius. - = mm_per_tooth*(1+number_of_teeth/2)/PI - clearance; +//their centers separated by the sum of their pitch_radius. +function circular_pitch(mm_per_tooth=5) = mm_per_tooth; //tooth density expressed as "circular pitch" in millimeters +function diametral_pitch(mm_per_tooth=5) = PI / mm_per_tooth; //tooth density expressed as "diametral pitch" in teeth per millimeter + +function module_value(mm_per_tooth=5) = mm_per_tooth / PI; //tooth density expressed as "module" or "modulus" in millimeters +function adendum (mm_per_tooth=5) = module_value(mm_per_tooth); +function dedendum (mm_per_tooth=5, clearance=undef) = (clearance==undef)? (1.25 * module_value(mm_per_tooth)) : (module_value(mm_per_tooth) + clearance); +function pitch_radius(mm_per_tooth=5, number_of_teeth=11) = mm_per_tooth * number_of_teeth / PI / 2; + +//The gear fits entirely within a cylinder of this radius. +function outer_radius(mm_per_tooth=5, number_of_teeth=11) + = pitch_radius(mm_per_tooth, number_of_teeth) + adendum(mm_per_tooth); + +// Radius of circle at base of dedendum. +function root_radius(mm_per_tooth=5, number_of_teeth=11, clearance=undef) + = pitch_radius(mm_per_tooth, number_of_teeth) - dedendum(mm_per_tooth, clearance); + +// The base circle for involute teeth. +function base_radius(mm_per_tooth=5, number_of_teeth=11, pressure_angle=28) + = pitch_radius(mm_per_tooth, number_of_teeth) * cos(pressure_angle); ////////////////////////////////////////////////////////////////////////////////////////////// @@ -281,10 +291,10 @@ d13=pitch_radius(mm_per_tooth,n1) + pitch_radius(mm_per_tooth,n3); d14=pitch_radius(mm_per_tooth,n1) + pitch_radius(mm_per_tooth,n4); translate([ 0, 0, 0]) rotate([0,0, $t*360/n1]) color([1.00,0.75,0.75]) gear(mm_per_tooth,n1,thickness,hole); -translate([ 0, d12, 0]) rotate([0,0,-($t+n2/2-0*n1+1/2)*360/n2]) color([0.75,1.00,0.75]) gear(mm_per_tooth,n2,thickness,hole,0); +translate([ 0, d12, 0]) rotate([0,0,-($t+n2/2-0*n1+1/2)*360/n2]) color([0.75,1.00,0.75]) gear(mm_per_tooth,n2,thickness,hole); translate([ d13, 0, 0]) rotate([0,0,-($t-n3/4+n1/4+1/2)*360/n3]) color([0.75,0.75,1.00]) gear(mm_per_tooth,n3,thickness,hole); translate([ d13, 0, 0]) rotate([0,0,-($t-n3/4+n1/4+1/2)*360/n3]) color([0.75,0.75,1.00]) gear(mm_per_tooth,n3,thickness,hole); -translate([-d14, 0, 0]) rotate([0,0,-($t-n4/4-n1/4+1/2-floor(n4/4)-3)*360/n4]) color([1.00,0.75,0.50]) gear(mm_per_tooth,n4,thickness,hole,0,n4-3); +translate([-d14, 0, 0]) rotate([0,0,-($t-n4/4-n1/4+1/2-floor(n4/4)-3)*360/n4]) color([1.00,0.75,0.50]) gear(mm_per_tooth,n4,thickness,hole); translate([(-floor(n5/2)-floor(n1/2)+$t+n1/2-1/2)*9, -d1+0.0, 0]) rotate([0,0,0]) color([0.75,0.75,0.75]) rack(mm_per_tooth,n5,thickness,height); */