incorporated 2D export to involute_gears, by Amp

This commit is contained in:
Elmom 2010-08-15 12:58:20 +03:00
parent ce3806d619
commit fcf6ba699b

View file

@ -1,7 +1,7 @@
// Parametric Involute Bevel and Spur Gears by GregFrost // Parametric Involute Bevel and Spur Gears by GregFrost
// It is licensed under the Creative Commons - GNU GPL license. // It is licensed under the Creative Commons - GNU LGPL 2.1 license.
// © 2010 by GregFrost // © 2010 by GregFrost, thingiverse.com/Amp
// http://www.thingiverse.com/thing:3575 // http://www.thingiverse.com/thing:3575 and http://www.thingiverse.com/thing:3752
// Simple Test: // Simple Test:
//gear (circular_pitch=700, //gear (circular_pitch=700,
@ -30,6 +30,10 @@ module test_bevel_gear_pair(){
bevel_gear_pair (); bevel_gear_pair ();
} }
module test_bevel_gear(){bevel_gear();}
bevel_gear();
pi=3.1415926535897932384626433832795; pi=3.1415926535897932384626433832795;
//================================================== //==================================================
@ -303,7 +307,8 @@ module gear (
circles=0, circles=0,
backlash=0, backlash=0,
twist=0, twist=0,
involute_facets=0) involute_facets=0,
flat=false)
{ {
if (circular_pitch==false && diametral_pitch==false) if (circular_pitch==false && diametral_pitch==false)
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");
@ -349,13 +354,13 @@ module gear (
0.70*circle_orbit_curcumference/circles, 0.70*circle_orbit_curcumference/circles,
(rim_radius-hub_diameter/2)*0.9); (rim_radius-hub_diameter/2)*0.9);
difference () difference()
{ {
union () union ()
{ {
difference () difference ()
{ {
linear_extrude (height=rim_thickness, convexity=10, twist=twist) linear_exturde_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,
@ -370,25 +375,40 @@ 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)
cylinder (r=rim_radius,h=gear_thickness); linear_exturde_flat_option(flat=flat, height=gear_thickness)
if (hub_thickness > gear_thickness) circle (r=rim_radius);
if (flat == false && hub_thickness > gear_thickness)
translate ([0,0,gear_thickness]) translate ([0,0,gear_thickness])
cylinder (r=hub_diameter/2,h=hub_thickness-gear_thickness); linear_exturde_flat_option(flat=flat, height=hub_thickness-gear_thickness)
circle (r=hub_diameter/2);
} }
translate ([0,0,-1]) translate ([0,0,-1])
cylinder ( linear_exturde_flat_option(flat =flat, height=2+max(rim_thickness,hub_thickness,gear_thickness))
r=bore_diameter/2, circle (r=bore_diameter/2);
h=2+max(rim_thickness,hub_thickness,gear_thickness));
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])
cylinder(r=circle_diameter/2,h=max(gear_thickness,rim_thickness)+3); linear_exturde_flat_option(flat =flat, height=max(gear_thickness,rim_thickness)+3)
circle(r=circle_diameter/2);
} }
} }
} }
module linear_exturde_flat_option(flat =false, height = 10, center = false, convexity = 2, twist = 0)
{
if(flat==false)
{
linear_extrude(height = height, center = center, convexity = convexity, twist= twist) child(0);
}
else
{
child(0);
}
}
module gear_shape ( module gear_shape (
number_of_teeth, number_of_teeth,
pitch_radius, pitch_radius,