Skip to content

Instantly share code, notes, and snippets.

@triffid
Created February 11, 2015 02:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save triffid/fd57832765fb67485599 to your computer and use it in GitHub Desktop.
Save triffid/fd57832765fb67485599 to your computer and use it in GitHub Desktop.
openscad 2d involute gear
module gear_shape_2d (
number_of_teeth = 15,
circular_pitch = false, diametral_pitch = false,
pressure_angle = 28,
clearance = 0.2,
circles=0,
backlash=0,
involute_facets=0)
{
if (circular_pitch==false && diametral_pitch==false)
echo("MCAD ERROR: gear module needs either a diametral_pitch or circular_pitch");
//Convert diametrial pitch to our native circular pitch
circular_pitch = (circular_pitch!=false?circular_pitch:180/diametral_pitch);
// Pitch diameter: Diameter of pitch circle.
pitch_diameter = number_of_teeth * circular_pitch / PI;
pitch_radius = pitch_diameter/2;
echo ("Teeth:", number_of_teeth, " Pitch radius:", pitch_radius);
// Base Circle
base_radius = pitch_radius*cos(pressure_angle);
// 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;
//Outer Circle
outer_radius = pitch_radius + addendum;
// 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;
backlash_angle = backlash / pitch_radius * 180 / pi;
half_thick_angle = (360 / number_of_teeth - backlash_angle) / 4;
gear_shape (
number_of_teeth,
pitch_radius = pitch_radius,
root_radius = root_radius,
base_radius = base_radius,
outer_radius = outer_radius,
half_thick_angle = half_thick_angle,
involute_facets=involute_facets);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment