2010-06-11 15:07:22 -05:00
|
|
|
//test_involute_curve();
|
2010-08-23 07:51:25 -05:00
|
|
|
//test_gears();
|
|
|
|
//demo_3d_gears();
|
2010-06-11 14:22:57 -05:00
|
|
|
|
|
|
|
// Geometry Sources:
|
|
|
|
// http://www.cartertools.com/involute.html
|
|
|
|
// gears.py (inkscape extension: /usr/share/inkscape/extensions/gears.py)
|
|
|
|
// Usage:
|
|
|
|
// Diametral pitch: Number of teeth per unit length.
|
|
|
|
// Circular pitch: Length of the arc from one tooth to the next
|
|
|
|
// Clearance: Radial distance between top of tooth on one gear to bottom of gap on another.
|
|
|
|
|
|
|
|
module gear(number_of_teeth,
|
2010-06-11 15:07:22 -05:00
|
|
|
circular_pitch=false, diametral_pitch=false,
|
2010-06-11 14:22:57 -05:00
|
|
|
pressure_angle=20, clearance = 0)
|
|
|
|
{
|
2010-06-11 15:07:22 -05:00
|
|
|
if (circular_pitch==false && diametral_pitch==false) echo("MCAD ERROR: gear module needs either a diametral_pitch or circular_pitch");
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
//Convert diametrial pitch to our native circular pitch
|
|
|
|
circular_pitch = (circular_pitch!=false?circular_pitch:180/diametral_pitch);
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
// Pitch diameter: Diameter of pitch circle.
|
|
|
|
pitch_diameter = number_of_teeth * circular_pitch / 180;
|
|
|
|
pitch_radius = pitch_diameter/2;
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
// Base Circle
|
|
|
|
base_diameter = pitch_diameter*cos(pressure_angle);
|
|
|
|
base_radius = base_diameter/2;
|
|
|
|
|
|
|
|
// Diametrial pitch: Number of teeth per unit length.
|
|
|
|
pitch_diametrial = number_of_teeth / pitch_diameter;
|
|
|
|
|
|
|
|
// Addendum: Radial distance from pitch circle to outside circle.
|
|
|
|
addendum = 1/pitch_diametrial;
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
//Outer Circle
|
|
|
|
outer_radius = pitch_radius+addendum;
|
|
|
|
outer_diameter = outer_radius*2;
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
// Dedendum: Radial distance from pitch circle to root diameter
|
|
|
|
dedendum = addendum + clearance;
|
|
|
|
|
|
|
|
// Root diameter: Diameter of bottom of tooth spaces.
|
|
|
|
root_radius = pitch_radius-dedendum;
|
|
|
|
root_diameter = root_radius * 2;
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
half_thick_angle = 360 / (4 * number_of_teeth);
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
union()
|
|
|
|
{
|
|
|
|
rotate(half_thick_angle) circle($fn=number_of_teeth*2, r=root_radius*1.001);
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
for (i= [1:number_of_teeth])
|
|
|
|
//for (i = [0])
|
|
|
|
{
|
|
|
|
rotate([0,0,i*360/number_of_teeth])
|
|
|
|
{
|
|
|
|
involute_gear_tooth(
|
|
|
|
pitch_radius = pitch_radius,
|
|
|
|
root_radius = root_radius,
|
|
|
|
base_radius = base_radius,
|
|
|
|
outer_radius = outer_radius,
|
|
|
|
half_thick_angle = half_thick_angle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module involute_gear_tooth(
|
|
|
|
pitch_radius,
|
|
|
|
root_radius,
|
|
|
|
base_radius,
|
|
|
|
outer_radius,
|
|
|
|
half_thick_angle
|
|
|
|
)
|
|
|
|
{
|
|
|
|
pitch_to_base_angle = involute_intersect_angle( base_radius, pitch_radius );
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
outer_to_base_angle = involute_intersect_angle( base_radius, outer_radius );
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
base1 = 0 - pitch_to_base_angle - half_thick_angle;
|
|
|
|
pitch1 = 0 - half_thick_angle;
|
|
|
|
outer1 = outer_to_base_angle - pitch_to_base_angle - half_thick_angle;
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
b1 = polar_to_cartesian([ base1, base_radius ]);
|
|
|
|
p1 = polar_to_cartesian([ pitch1, pitch_radius ]);
|
|
|
|
o1 = polar_to_cartesian([ outer1, outer_radius ]);
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
b2 = polar_to_cartesian([ -base1, base_radius ]);
|
|
|
|
p2 = polar_to_cartesian([ -pitch1, pitch_radius ]);
|
|
|
|
o2 = polar_to_cartesian([ -outer1, outer_radius ]);
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
// ( root_radius > base_radius variables )
|
|
|
|
pitch_to_root_angle = pitch_to_base_angle - involute_intersect_angle(base_radius, root_radius );
|
|
|
|
root1 = pitch1 - pitch_to_root_angle;
|
|
|
|
root2 = -pitch1 + pitch_to_root_angle;
|
|
|
|
r1_t = polar_to_cartesian([ root1, root_radius ]);
|
|
|
|
r2_t = polar_to_cartesian([ -root1, root_radius ]);
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
// ( else )
|
|
|
|
r1_f = polar_to_cartesian([ base1, root_radius ]);
|
|
|
|
r2_f = polar_to_cartesian([ -base1, root_radius ]);
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
if (root_radius > base_radius)
|
|
|
|
{
|
2010-06-11 15:07:22 -05:00
|
|
|
//echo("true");
|
2010-06-11 14:22:57 -05:00
|
|
|
polygon( points = [
|
|
|
|
r1_t,p1,o1,o2,p2,r2_t
|
|
|
|
], convexity = 3);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
polygon( points = [
|
|
|
|
r1_f, b1,p1,o1,o2,p2,b2,r2_f
|
|
|
|
], convexity = 3);
|
|
|
|
}
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 14:22:57 -05:00
|
|
|
}
|
|
|
|
|
2010-06-11 15:07:22 -05:00
|
|
|
// Mathematical Functions
|
|
|
|
//===============
|
2010-06-11 14:22:57 -05:00
|
|
|
|
|
|
|
// Finds the angle of the involute about the base radius at the given distance (radius) from it's center.
|
|
|
|
//source: http://www.mathhelpforum.com/math-help/geometry/136011-circle-involute-solving-y-any-given-x.html
|
|
|
|
|
|
|
|
function involute_intersect_angle(base_radius, radius) = sqrt( pow(radius/base_radius,2) - 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Polar coord [angle, radius] to cartesian coord [x,y]
|
|
|
|
|
|
|
|
function polar_to_cartesian(polar) = [
|
|
|
|
polar[1]*cos(polar[0]),
|
|
|
|
polar[1]*sin(polar[0])
|
|
|
|
];
|
|
|
|
|
|
|
|
|
2010-06-11 15:07:22 -05:00
|
|
|
// Test Cases
|
|
|
|
//===============
|
2010-06-11 14:22:57 -05:00
|
|
|
|
2010-06-11 15:07:22 -05:00
|
|
|
module test_gears()
|
|
|
|
{
|
|
|
|
gear(number_of_teeth=51,circular_pitch=200);
|
|
|
|
translate([0, 50])gear(number_of_teeth=17,circular_pitch=200);
|
|
|
|
translate([-50,0]) gear(number_of_teeth=17,diametral_pitch=1);
|
|
|
|
}
|
2010-06-11 14:22:57 -05:00
|
|
|
|
2010-06-11 15:07:22 -05:00
|
|
|
module demo_3d_gears()
|
|
|
|
{
|
|
|
|
//double helical gear
|
|
|
|
// (helics don't line up perfectly - for display purposes only ;)
|
|
|
|
translate([50,0])
|
|
|
|
{
|
|
|
|
linear_extrude(height = 10, center = true, convexity = 10, twist = -45)
|
|
|
|
gear(number_of_teeth=17,diametral_pitch=1);
|
|
|
|
translate([0,0,10]) linear_extrude(height = 10, center = true, convexity = 10, twist = 45)
|
|
|
|
gear(number_of_teeth=17,diametral_pitch=1);
|
|
|
|
}
|
2010-08-23 07:51:25 -05:00
|
|
|
|
2010-06-11 15:07:22 -05:00
|
|
|
//spur gear
|
|
|
|
translate([0,-50]) linear_extrude(height = 10, center = true, convexity = 10, twist = 0)
|
|
|
|
gear(number_of_teeth=17,diametral_pitch=1);
|
|
|
|
|
|
|
|
}
|
2010-06-11 14:22:57 -05:00
|
|
|
|
2010-06-11 15:07:22 -05:00
|
|
|
module test_involute_curve()
|
|
|
|
{
|
|
|
|
for (i=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])
|
|
|
|
{
|
|
|
|
translate(polar_to_cartesian([involute_intersect_angle( 0.1,i) , i ])) circle($fn=15, r=0.5);
|
|
|
|
}
|
2010-08-23 07:51:25 -05:00
|
|
|
}
|