mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-06 04:09:47 +00:00
Added ability to make spiral bevel gears.
This commit is contained in:
parent
f92d2fe15d
commit
5b7a026244
1 changed files with 143 additions and 52 deletions
|
@ -2,8 +2,8 @@
|
||||||
// Public Domain Parametric Involute Spur Gear (and involute helical gear and involute rack)
|
// Public Domain Parametric Involute Spur Gear (and involute helical gear and involute rack)
|
||||||
// version 1.1
|
// version 1.1
|
||||||
// by Leemon Baird, 2011, Leemon@Leemon.com
|
// by Leemon Baird, 2011, Leemon@Leemon.com
|
||||||
// Corrected and tweaked by Revar Desmera, 2017, revarbat@gmail.com
|
|
||||||
// http://www.thingiverse.com/thing:5505
|
// http://www.thingiverse.com/thing:5505
|
||||||
|
// Tweaked, and improved by Revar Desmera, 2017-2019, revarbat@gmail.com
|
||||||
//
|
//
|
||||||
// This file is public domain. Use it for any purpose, including commercial
|
// This file is public domain. Use it for any purpose, including commercial
|
||||||
// applications. Attribution would be nice, but is not required. There is
|
// applications. Attribution would be nice, but is not required. There is
|
||||||
|
@ -57,6 +57,83 @@
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
//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
|
||||||
|
) {
|
||||||
|
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
|
||||||
|
scale([1, 1/cos(bevelang), 1])
|
||||||
|
translate([0,-r,0])
|
||||||
|
polygon(
|
||||||
|
points=[
|
||||||
|
polar(r-1, -181/number_of_teeth),
|
||||||
|
polar(r, -181/number_of_teeth),
|
||||||
|
polar(r, r<b ? k : -180/number_of_teeth),
|
||||||
|
q7(0/5,r,b,c,k, 1),q7(1/5,r,b,c,k, 1),q7(2/5,r,b,c,k, 1),q7(3/5,r,b,c,k, 1),q7(4/5,r,b,c,k, 1),q7(5/5,r,b,c,k, 1),
|
||||||
|
q7(5/5,r,b,c,k,-1),q7(4/5,r,b,c,k,-1),q7(3/5,r,b,c,k,-1),q7(2/5,r,b,c,k,-1),q7(1/5,r,b,c,k,-1),q7(0/5,r,b,c,k,-1),
|
||||||
|
polar(r, r<b ? -k : 180/number_of_teeth),
|
||||||
|
polar(r, 181/number_of_teeth),
|
||||||
|
polar(r-1, 181/number_of_teeth),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Creates a 2D involute spur gear, with reasonable defaults for all the parameters.
|
||||||
|
// Normally, you should just specify the first 2 parameters, and let the rest be default values.
|
||||||
|
// Meshing gears must match in mm_per_tooth, pressure_angle, and twist,
|
||||||
|
// and be separated by the sum of their pitch radii, which can be found with pitch_radius().
|
||||||
|
// mm_per_tooth = This is the "circular pitch", the circumference of the pitch circle divided by the number of teeth
|
||||||
|
// number_of_teeth = Total number of teeth along the rack
|
||||||
|
// teeth_to_hide = Number of teeth to delete to make this only a fraction of a circle
|
||||||
|
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
|
||||||
|
// clearance = Gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
|
||||||
|
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
|
||||||
|
// Example:
|
||||||
|
// 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
|
||||||
|
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
|
||||||
|
union() {
|
||||||
|
circle(r=r-0.5, $fn=number_of_teeth);
|
||||||
|
for (i = [0:number_of_teeth-teeth_to_hide-1] ) {
|
||||||
|
rotate(i*360/number_of_teeth) {
|
||||||
|
translate([0,r,0]) {
|
||||||
|
gear_tooth_profile(
|
||||||
|
mm_per_tooth = mm_per_tooth,
|
||||||
|
number_of_teeth = number_of_teeth,
|
||||||
|
pressure_angle = pressure_angle,
|
||||||
|
clearance = clearance,
|
||||||
|
backlash = backlash,
|
||||||
|
bevelang = bevelang
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creates an involute spur gear, with reasonable defaults for all the parameters.
|
// Creates an involute spur gear, with reasonable defaults for all the parameters.
|
||||||
// Normally, you should just choose the first 4 parameters, and let the rest be default values.
|
// Normally, you should just choose the first 4 parameters, and let the rest be default values.
|
||||||
// Meshing gears must match in mm_per_tooth, pressure_angle, and twist,
|
// Meshing gears must match in mm_per_tooth, pressure_angle, and twist,
|
||||||
|
@ -65,56 +142,68 @@
|
||||||
// number_of_teeth = Total number of teeth along the rack
|
// number_of_teeth = Total number of teeth along the rack
|
||||||
// thickness = Thickness of rack in mm (affects each tooth)
|
// thickness = Thickness of rack in mm (affects each tooth)
|
||||||
// hole_diameter = Diameter of centeral shaft hole.
|
// hole_diameter = Diameter of centeral shaft hole.
|
||||||
// twist = Teeth rotate this many degrees from bottom of gear to top. 360 makes the gear a screw with each thread going around once
|
|
||||||
// teeth_to_hide = Number of teeth to delete to make this only a fraction of a circle
|
// teeth_to_hide = Number of teeth to delete to make this only a fraction of a circle
|
||||||
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
|
// pressure_angle = Controls how straight or bulged the tooth sides are. In degrees.
|
||||||
// clearance = Gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
|
// clearance = Gap between top of a tooth on one gear and bottom of valley on a meshing gear (in millimeters)
|
||||||
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
|
// backlash = Gap between two meshing teeth, in the direction along the circumference of the pitch circle
|
||||||
|
// twist = Teeth rotate this many degrees from bottom of gear to top. 360 makes the gear a screw with each thread going around once
|
||||||
|
// scale = Scale of top of gear compared to bottom. Useful for making crown gears.
|
||||||
|
// slices = Number of slices to divide gear into. Useful for refining gears with `twist`.
|
||||||
// Example:
|
// Example:
|
||||||
// gear(mm_per_tooth=5, number_of_teeth=20, thickness=5, hole_diameter=5);
|
// 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
|
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
|
number_of_teeth = 11, //total number of teeth around the entire perimeter
|
||||||
thickness = 6, //thickness of gear in mm
|
thickness = 6, //thickness of gear in mm
|
||||||
hole_diameter = 3, //diameter of the hole in the center, in mm
|
hole_diameter = 3, //diameter of the hole in the center, 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
|
|
||||||
teeth_to_hide = 0, //number of teeth to delete to make this only a fraction of a circle
|
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.
|
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 = 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
|
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 = mm_per_tooth * number_of_teeth / PI / 2; //radius of pitch circle
|
||||||
|
p2 = p - (thickness*tan(bevelang));
|
||||||
c = p + mm_per_tooth / PI - clearance; //radius of outer 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
|
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
|
|
||||||
difference() {
|
difference() {
|
||||||
linear_extrude(height = thickness, center = true, convexity = 10, twist = twist, slices = ceil(abs(twist)/5)+1)
|
linear_extrude(height=thickness, center=true, convexity=10, twist=twist, scale=p2/p, slices=slices) {
|
||||||
for (i = [0:number_of_teeth-teeth_to_hide-1] )
|
gear2d(
|
||||||
rotate([0,0,i*360/number_of_teeth])
|
mm_per_tooth = mm_per_tooth,
|
||||||
polygon(
|
number_of_teeth = number_of_teeth,
|
||||||
points=[
|
teeth_to_hide = teeth_to_hide,
|
||||||
polar(hole_diameter/10, -181/number_of_teeth),
|
pressure_angle = pressure_angle,
|
||||||
polar(r, -181/number_of_teeth),
|
clearance = clearance,
|
||||||
polar(r, r<b ? k : -180/number_of_teeth),
|
backlash = backlash,
|
||||||
q7(0/5,r,b,c,k, 1),q7(1/5,r,b,c,k, 1),q7(2/5,r,b,c,k, 1),q7(3/5,r,b,c,k, 1),q7(4/5,r,b,c,k, 1),q7(5/5,r,b,c,k, 1),
|
bevelang = bevelang
|
||||||
q7(5/5,r,b,c,k,-1),q7(4/5,r,b,c,k,-1),q7(3/5,r,b,c,k,-1),q7(2/5,r,b,c,k,-1),q7(1/5,r,b,c,k,-1),q7(0/5,r,b,c,k,-1),
|
|
||||||
polar(r, r<b ? -k : 180/number_of_teeth),
|
|
||||||
polar(r, 181/number_of_teeth),
|
|
||||||
polar(hole_diameter/10, 181/number_of_teeth),
|
|
||||||
],
|
|
||||||
paths=[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]]
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
if (hole_diameter > 0) {
|
||||||
cylinder(h=2*thickness+1, r=hole_diameter/2, center=true);
|
cylinder(h=2*thickness+1, r=hole_diameter/2, center=true);
|
||||||
}
|
}
|
||||||
};
|
if (bevelang != 0) {
|
||||||
|
h = (c-r)*sin(bevelang);
|
||||||
|
translate([0,0,-thickness/2]) {
|
||||||
|
difference() {
|
||||||
|
cube([2*c/cos(bevelang),2*c/cos(bevelang),2*h], center=true);
|
||||||
|
cylinder(h=h, r1=r, r2=c, center=false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//these 4 functions are used by gear
|
//these 4 functions are used by gear
|
||||||
function polar(r,theta) = r*[sin(theta), cos(theta)]; //convert polar to cartesian coordinates
|
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 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 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
|
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.
|
// Creates a rack, which is a straight line with teeth.
|
||||||
// The same as a segment of teeth from an infinite diameter gear.
|
// The same as a segment of teeth from an infinite diameter gear.
|
||||||
// The "pitch circle" is a line along the X axis.
|
// The "pitch circle" is a line along the X axis.
|
||||||
|
@ -154,7 +243,8 @@ module rack (
|
||||||
],
|
],
|
||||||
paths=[[0,1,2,3,4,5,6,7]]
|
paths=[[0,1,2,3,4,5,6,7]]
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
//These 5 functions let the user find the derived dimensions of the gear.
|
//These 5 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
|
//A gear fits within a circle of radius outer_radius, and two gears should have
|
||||||
|
@ -168,6 +258,7 @@ function pitch_radius (mm_per_tooth=5,number_of_teeth=11) = mm_per_tooth * nu
|
||||||
function outer_radius (mm_per_tooth=5,number_of_teeth=11,clearance=0.1) //The gear fits entirely within a cylinder of this radius.
|
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;
|
= mm_per_tooth*(1+number_of_teeth/2)/PI - clearance;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//example gear train.
|
//example gear train.
|
||||||
//Try it with OpenSCAD View/Animate command with 20 steps and 24 FPS.
|
//Try it with OpenSCAD View/Animate command with 20 steps and 24 FPS.
|
||||||
|
|
Loading…
Reference in a new issue