Merge branch 'devel'
Made some corrections and several updates to default values in the gear module.
This commit is contained in:
commit
caa5acfb4c
|
@ -295,31 +295,35 @@ module involute_bevel_gear_tooth (
|
||||||
|
|
||||||
module gear (
|
module gear (
|
||||||
number_of_teeth=15,
|
number_of_teeth=15,
|
||||||
circular_pitch=false, diametral_pitch=false,
|
circular_pitch=undef, diametral_pitch=undef,
|
||||||
pressure_angle=28,
|
pressure_angle=28,
|
||||||
clearance = 0.2,
|
clearance = undef,
|
||||||
gear_thickness=5,
|
gear_thickness=5,
|
||||||
rim_thickness=8,
|
rim_thickness=undef,
|
||||||
rim_width=5,
|
rim_width=undef,
|
||||||
hub_thickness=10,
|
hub_thickness=undef,
|
||||||
hub_diameter=15,
|
hub_diameter=undef,
|
||||||
bore_diameter=5,
|
bore_diameter=undef,
|
||||||
circles=0,
|
circles=0,
|
||||||
backlash=0,
|
backlash=0,
|
||||||
twist=0,
|
twist=0,
|
||||||
involute_facets=0,
|
involute_facets=0,
|
||||||
flat=false)
|
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");
|
echo("MCAD ERROR: gear module needs either a diametral_pitch or circular_pitch");
|
||||||
|
|
||||||
//Convert diametrial pitch to our native 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: 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;
|
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 Circle
|
||||||
base_radius = pitch_radius*cos(pressure_angle);
|
base_radius = pitch_radius*cos(pressure_angle);
|
||||||
|
@ -342,7 +346,16 @@ module gear (
|
||||||
half_thick_angle = (360 / number_of_teeth - backlash_angle) / 4;
|
half_thick_angle = (360 / number_of_teeth - backlash_angle) / 4;
|
||||||
|
|
||||||
// Variables controlling the rim.
|
// 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;
|
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.
|
// Variables controlling the circular holes in the gear.
|
||||||
circle_orbit_diameter=hub_diameter/2+rim_radius;
|
circle_orbit_diameter=hub_diameter/2+rim_radius;
|
||||||
|
@ -360,7 +373,7 @@ module gear (
|
||||||
{
|
{
|
||||||
difference ()
|
difference ()
|
||||||
{
|
{
|
||||||
linear_exturde_flat_option(flat=flat, height=rim_thickness, convexity=10, twist=twist)
|
linear_extrude_flat_option(flat=flat, height=rim_thickness, convexity=10, twist=twist)
|
||||||
gear_shape (
|
gear_shape (
|
||||||
number_of_teeth,
|
number_of_teeth,
|
||||||
pitch_radius = pitch_radius,
|
pitch_radius = pitch_radius,
|
||||||
|
@ -375,36 +388,36 @@ module gear (
|
||||||
cylinder (r=rim_radius,h=rim_thickness-gear_thickness+1);
|
cylinder (r=rim_radius,h=rim_thickness-gear_thickness+1);
|
||||||
}
|
}
|
||||||
if (gear_thickness > rim_thickness)
|
if (gear_thickness > rim_thickness)
|
||||||
linear_exturde_flat_option(flat=flat, height=gear_thickness)
|
linear_extrude_flat_option(flat=flat, height=gear_thickness)
|
||||||
circle (r=rim_radius);
|
circle (r=rim_radius);
|
||||||
if (flat == false && hub_thickness > gear_thickness)
|
if (flat == false && hub_thickness > gear_thickness)
|
||||||
translate ([0,0,gear_thickness])
|
translate ([0,0,gear_thickness])
|
||||||
linear_exturde_flat_option(flat=flat, height=hub_thickness-gear_thickness)
|
linear_extrude_flat_option(flat=flat, height=hub_thickness-gear_thickness)
|
||||||
circle (r=hub_diameter/2);
|
circle (r=hub_diameter/2);
|
||||||
}
|
}
|
||||||
translate ([0,0,-1])
|
translate ([0,0,-1])
|
||||||
linear_exturde_flat_option(flat =flat, height=2+max(rim_thickness,hub_thickness,gear_thickness))
|
linear_extrude_flat_option(flat =flat, height=2+max(rim_thickness,hub_thickness,gear_thickness))
|
||||||
circle (r=bore_diameter/2);
|
circle (r=bore_diameter/2);
|
||||||
if (circles>0)
|
if (circles>0)
|
||||||
{
|
{
|
||||||
for(i=[0:circles-1])
|
for(i=[0:circles-1])
|
||||||
rotate([0,0,i*360/circles])
|
rotate([0,0,i*360/circles])
|
||||||
translate([circle_orbit_diameter/2,0,-1])
|
translate([circle_orbit_diameter/2,0,-1])
|
||||||
linear_exturde_flat_option(flat =flat, height=max(gear_thickness,rim_thickness)+3)
|
linear_extrude_flat_option(flat =flat, height=max(gear_thickness,rim_thickness)+3)
|
||||||
circle(r=circle_diameter/2);
|
circle(r=circle_diameter/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module linear_exturde_flat_option(flat =false, height = 10, center = false, convexity = 2, twist = 0)
|
module linear_extrude_flat_option(flat =false, height = 10, center = false, convexity = 2, twist = 0)
|
||||||
{
|
{
|
||||||
if(flat==false)
|
if(flat==false)
|
||||||
{
|
{
|
||||||
linear_extrude(height = height, center = center, convexity = convexity, twist= twist) child(0);
|
linear_extrude(height = height, center = center, convexity = convexity, twist= twist) children(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
child(0);
|
children(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue