Skip to content

Commit 5efe18f

Browse files
committed
Merge pull request SolidCode#9 from TomHodson/master
added a root rounding option to involute_gears
2 parents 6621a9b + 9c458c5 commit 5efe18f

File tree

1 file changed

+83
-26
lines changed

1 file changed

+83
-26
lines changed

involute_gears.scad

Lines changed: 83 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@
44
// http://www.thingiverse.com/thing:3575 and http://www.thingiverse.com/thing:3752
55

66
// Simple Test:
7-
//gear (circular_pitch=700,
8-
// gear_thickness = 12,
9-
// rim_thickness = 15,
10-
// hub_thickness = 17,
11-
// circles=8);
7+
gear (
8+
number_of_teeth = 30,
9+
circular_pitch=700,
10+
gear_thickness = 12,
11+
rim_thickness = 15,
12+
hub_thickness = 17,
13+
circles=8,
14+
roundsize = 0
15+
);
16+
17+
translate([100,0,0])
18+
gear (
19+
number_of_teeth = 30,
20+
circular_pitch=700,
21+
gear_thickness = 12,
22+
rim_thickness = 15,
23+
hub_thickness = 17,
24+
circles=8,
25+
roundsize = 1
26+
);
1227

1328
//Complex Spur Gear Test:
1429
//test_gears ();
@@ -293,6 +308,8 @@ module involute_bevel_gear_tooth (
293308
}
294309
}
295310

311+
312+
296313
module gear (
297314
number_of_teeth=15,
298315
circular_pitch=false, diametral_pitch=false,
@@ -308,7 +325,9 @@ module gear (
308325
backlash=0,
309326
twist=0,
310327
involute_facets=0,
311-
flat=false)
328+
flat=false,
329+
roundsize = 1
330+
)
312331
{
313332
if (circular_pitch==false && diametral_pitch==false)
314333
echo("MCAD ERROR: gear module needs either a diametral_pitch or circular_pitch");
@@ -353,13 +372,12 @@ module gear (
353372
min (
354373
0.70*circle_orbit_curcumference/circles,
355374
(rim_radius-hub_diameter/2)*0.9);
356-
375+
//render()
357376
difference()
358377
{
359-
union ()
378+
union()
360379
{
361-
difference ()
362-
{
380+
363381
linear_exturde_flat_option(flat=flat, height=rim_thickness, convexity=10, twist=twist)
364382
gear_shape (
365383
number_of_teeth,
@@ -370,10 +388,6 @@ module gear (
370388
half_thick_angle = half_thick_angle,
371389
involute_facets=involute_facets);
372390

373-
if (gear_thickness < rim_thickness)
374-
translate ([0,0,gear_thickness])
375-
cylinder (r=rim_radius,h=rim_thickness-gear_thickness+1);
376-
}
377391
if (gear_thickness > rim_thickness)
378392
linear_exturde_flat_option(flat=flat, height=gear_thickness)
379393
circle (r=rim_radius);
@@ -382,16 +396,54 @@ module gear (
382396
linear_exturde_flat_option(flat=flat, height=hub_thickness-gear_thickness)
383397
circle (r=hub_diameter/2);
384398
}
385-
translate ([0,0,-1])
386-
linear_exturde_flat_option(flat =flat, height=2+max(rim_thickness,hub_thickness,gear_thickness))
387-
circle (r=bore_diameter/2);
388-
if (circles>0)
389-
{
399+
render() {
400+
if(roundsize > 0) {
401+
if(number_of_teeth % 4 == 0) {
402+
for(i=[1:number_of_teeth]) {
403+
rotate([0,0,(i+0.5)*(360/number_of_teeth) - (half_thick_angle*0)])
404+
translate([0,root_radius,-50])
405+
cylinder(r=((360/number_of_teeth - half_thick_angle)/360) * pi*root_radius/2 * roundsize, h = 100, $fn = 20);
406+
}
407+
}
408+
if(number_of_teeth % 4 == 1) {
409+
for(i=[1:number_of_teeth]) {
410+
rotate([0,0,(i+0.5)*(360/number_of_teeth) - (half_thick_angle)])
411+
translate([0,root_radius,-50])
412+
cylinder(r=((360/number_of_teeth - half_thick_angle)/360) * pi*root_radius/2 * roundsize, h = 100, $fn = 20);
413+
}
414+
}
415+
if(number_of_teeth % 4 == 2) {
416+
for(i=[1:number_of_teeth]) {
417+
rotate([0,0,(i)*(360/number_of_teeth) + (half_thick_angle*0)])
418+
translate([0,root_radius,-50])
419+
cylinder(r=((360/number_of_teeth - half_thick_angle)/360) * pi*root_radius/2 * roundsize, h = 100, $fn = 20);
420+
}
421+
}
422+
if(number_of_teeth % 4 == 3) {
423+
for(i=[1:number_of_teeth]) {
424+
rotate([0,0,(i)*(360/number_of_teeth) - (half_thick_angle)])
425+
translate([0,root_radius,-50])
426+
cylinder(r=((360/number_of_teeth - half_thick_angle)/360) * pi*root_radius/2 * roundsize, h = 100, $fn = 20);
427+
}
428+
}
429+
}
430+
431+
if (gear_thickness < rim_thickness)
432+
translate ([0,0,gear_thickness])
433+
cylinder (r=rim_radius,h=rim_thickness-gear_thickness+1);
434+
435+
translate ([0,0,-1])
436+
linear_exturde_flat_option(flat =flat, height=2+max(rim_thickness,hub_thickness,gear_thickness))
437+
circle (r=bore_diameter/2);
438+
439+
if (circles>0)
440+
{
390441
for(i=[0:circles-1])
391442
rotate([0,0,i*360/circles])
392443
translate([circle_orbit_diameter/2,0,-1])
393444
linear_exturde_flat_option(flat =flat, height=max(gear_thickness,rim_thickness)+3)
394445
circle(r=circle_diameter/2);
446+
}
395447
}
396448
}
397449
}
@@ -409,6 +461,7 @@ module linear_exturde_flat_option(flat =false, height = 10, center = false, conv
409461

410462
}
411463

464+
412465
module gear_shape (
413466
number_of_teeth,
414467
pitch_radius,
@@ -418,12 +471,15 @@ module gear_shape (
418471
half_thick_angle,
419472
involute_facets)
420473
{
474+
475+
421476
union()
422477
{
423478
rotate (half_thick_angle) circle ($fn=number_of_teeth*2, r=root_radius);
424479

425480
for (i = [1:number_of_teeth])
426481
{
482+
427483
rotate ([0,0,i*360/number_of_teeth])
428484
{
429485
involute_gear_tooth (
@@ -438,6 +494,7 @@ module gear_shape (
438494
}
439495
}
440496

497+
441498
module involute_gear_tooth (
442499
pitch_radius,
443500
root_radius,
@@ -520,14 +577,14 @@ module test_gears()
520577
{
521578
translate([17,-15])
522579
{
523-
gear (number_of_teeth=17,
580+
#gear (number_of_teeth=17,
524581
circular_pitch=500,
525582
circles=8);
526583

527584
rotate ([0,0,360*4/17])
528585
translate ([39.088888,0,0])
529586
{
530-
gear (number_of_teeth=11,
587+
#gear (number_of_teeth=11,
531588
circular_pitch=500,
532589
hub_diameter=0,
533590
rim_width=65);
@@ -539,7 +596,7 @@ module test_gears()
539596
rim_width=5,
540597
rim_thickness=6,
541598
pressure_angle=31);
542-
rotate ([0,0,360*5/6])
599+
#rotate ([0,0,360*5/6])
543600
translate ([22.5,0,1])
544601
gear (number_of_teeth=21,
545602
circular_pitch=300,
@@ -555,7 +612,7 @@ module test_gears()
555612

556613
translate ([-61.1111111,0,0])
557614
{
558-
gear (number_of_teeth=27,
615+
#gear (number_of_teeth=27,
559616
circular_pitch=500,
560617
circles=5,
561618
hub_diameter=2*8.88888889);
@@ -573,7 +630,7 @@ module test_gears()
573630
bore_diameter=5,
574631
circles=0);
575632
translate ([13.8888888,0,1])
576-
gear (
633+
#gear (
577634
number_of_teeth=11,
578635
circular_pitch=200,
579636
pressure_angle=5,
@@ -590,7 +647,7 @@ module test_gears()
590647

591648
rotate ([0,0,360*-5/17])
592649
translate ([44.444444444,0,0])
593-
gear (number_of_teeth=15,
650+
#gear (number_of_teeth=15,
594651
circular_pitch=500,
595652
hub_diameter=10,
596653
rim_width=5,
@@ -601,7 +658,7 @@ module test_gears()
601658

602659
rotate ([0,0,360*-1/17])
603660
translate ([30.5555555,0,-1])
604-
gear (number_of_teeth=5,
661+
#gear (number_of_teeth=5,
605662
circular_pitch=500,
606663
hub_diameter=0,
607664
rim_width=5,

0 commit comments

Comments
 (0)