Merge PR #29 from gizmoplex/master into master

This commit is contained in:
Dyana Wu 2020-10-09 12:51:27 +08:00
commit 9156d95f48

View file

@ -295,31 +295,35 @@ module involute_bevel_gear_tooth (
module gear (
number_of_teeth=15,
circular_pitch=false, diametral_pitch=false,
circular_pitch=undef, diametral_pitch=undef,
pressure_angle=28,
clearance = 0.2,
clearance = undef,
gear_thickness=5,
rim_thickness=8,
rim_width=5,
hub_thickness=10,
hub_diameter=15,
bore_diameter=5,
rim_thickness=undef,
rim_width=undef,
hub_thickness=undef,
hub_diameter=undef,
bore_diameter=undef,
circles=0,
backlash=0,
twist=0,
involute_facets=0,
flat=false)
{
if (circular_pitch==false && diametral_pitch==false)
// Check for undefined circular pitch (happens when neither circular_pitch or diametral_pitch are specified)
if (circular_pitch==undef)
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);
circular_pitch = (circular_pitch!=undef?circular_pitch:pi/diametral_pitch);
// Calculate default clearance if not specified
clearance = (clearance!=undef?clearance:0.25 * circular_pitch / pi);
// Pitch diameter: Diameter of pitch circle.
pitch_diameter = number_of_teeth * circular_pitch / 180;
pitch_diameter = number_of_teeth * circular_pitch / pi;
pitch_radius = pitch_diameter/2;
echo ("Teeth:", number_of_teeth, " Pitch radius:", pitch_radius);
echo (str("Teeth: ", number_of_teeth, ", Pitch Radius: ", pitch_radius, ", Clearance: ", clearance));
// Base Circle
base_radius = pitch_radius*cos(pressure_angle);
@ -342,8 +346,17 @@ module gear (
half_thick_angle = (360 / number_of_teeth - backlash_angle) / 4;
// Variables controlling the rim.
rim_thickness = (rim_thickness!=undef?(rim_thickness!=0?rim_thickness:gear_thickness):gear_thickness * 1.5);
rim_width = (rim_width!=undef?rim_width:root_radius * .1);
rim_radius = root_radius - rim_width;
// Variables controlling the hub_diameter
hub_thickness = (hub_thickness!=undef?(hub_thickness!=0?hub_thickness:gear_thickness):gear_thickness * 2);
hub_diameter = (hub_diameter!=undef?hub_diameter:root_radius * .3);
// Variables controlling the bore
bore_diameter = (bore_diameter!=undef?bore_diameter:root_radius * .1);
// Variables controlling the circular holes in the gear.
circle_orbit_diameter=hub_diameter/2+rim_radius;
circle_orbit_curcumference=pi*circle_orbit_diameter;
@ -736,4 +749,3 @@ module test_backlash ()
translate([0,0,-5])
cylinder ($fn=20,r=backlash / 4,h=25);
}