Files
MEngine/gearbox.scad

204 lines
5.1 KiB
OpenSCAD
Raw Normal View History

use <PolyGear/PolyGear.scad>
use <PolyGear/PolyGearBasics.scad>
use <PolyGear/shortcuts.scad>
use <lovejoy.scad>
shaftd=9.49; // 3/8"
shaftback=21.41 + shaftd/2;
shaftz=21.75+shaftd/2;
flat=9.30;
ringh=3;
ringw=2;
GMod=.8;
module shaft(h, shaftd) {
difference() {
cylinder(d=shaftd, h=h, $fs=.1);
for (r=[0,120,240])
rotate([0,0,r]) translate([flat/2,-shaftd/2,-.05])
cube([shaftd/2,shaftd, h + .1]);
}
}
module drive_gear() {
difference() {
spur_gear(m=2, n=12, z=ringh, chamfer=10);
translate([0,0,-(ringh+2)/2]) shaft(h=ringh+2, shaftd=4);
}
}
module planet_gear(nt=10, gh, sh=4, m, ha=30) {
gfn = $preview ? 9 : 18;
difference() {
rotate([0,0,36/2]) spur_gear(m=m, n=nt, z=gh, chamfer=20, helix_angle=-ha, $fn=gfn, x=-.2);
cylinder(d=sh, h=gh+.1, $fs=.1, center=true);
}
}
module planet_carrier(nt=7, np=7, ns=49, m=GMod, incolor=true, pcolor="blue", ccolor="green", ha=30, rh=ringh) {
gfn = $preview ? 9 : 15;
cfs = $preview ? .1 : 2;
ratio = ns/np;
meshd = m*(ns+nt)/2;
planet_r = [ for (i = [0: 360/np : 360]) i + 90];
//planet_w = 180/-m*(nt/ns);
planet_w = ns % nt;
bodr = m*(ns+2*nt) - 4;
echo("Carrier Body Radius: ", bodr);
planet_color = incolor ? pcolor : undef;
carrier_color = incolor ? ccolor : undef;
color(planet_color) for (r=planet_r) {
rotate([0,0,r]) translate([meshd,0]) rotate([0,0,planet_w-r])
planet_gear(nt=nt, sh=4, m=m, gh=rh, ha=herringbone(helix=30, $fn=gfn));
}
color(carrier_color) translate([0,0,0]) difference() {
union() {
rotate([0,0,30])
cylinder(d=bodr, h=rh+2.4, center=true,$fs=cfs);
}
translate([0,0,ringh+1.2]) cylinder(d=309, h=2.3, center=true, $fs=cfs);
// Planet Orbits
for (r=planet_r) {
rotate([0,0,r]) translate([meshd,0])
difference() {
cylinder(d=2+m+nt*m, h=rh+.4, center=true, $fs=cfs);
cylinder(d=4-.4, h=rh+.6, center=true, $fs=cfs);
}
}
// Sun void
cylinder(d=2+m+ns*m, h=rh+.4, center=true, $fs=cfs);
cylinder(d=10, h=rh+.4, center=false, $fs=cfs);
}
}
module motor_gear(GMod=.8, z=8.25) {
//z=2*ringh;
// translate([0,0]) spur_gear(m=GMod, n=5, z=z, helix_angle=-30);
linear_extrude(height=z, twist=72*z/8.25)
projection() spur_gear(m=GMod, n=5, z=1, helix_angle=0);
}
module sun_gear(GMod=.8, nt=49, ha=30, h=2*ringh) {
gfn = $preview ? 9 : 15;
sd = 5.1;
spur_gear(m=GMod, n=nt, z=h, chamfer=20, helix_angle=ha, x=-.2, $fn=gfn);
cylinder(d=7.9, h=h+9.2, center=false, $fs=.1);
translate([0,7.9/2,h+6 +.2]) cube([2.95,2,6], center=true);
color("red")
translate([0,0,h/2+3+sd])
input_gear(nt=55, ha=-30);
}
module input_gear(GMod=.8, nt=49, ha=30, h=2*ringh) {
spur_gear(m=GMod, n=nt, z=h, chamfer=00, helix_angle=ha);
}
module ring_gear(np=14, ns=49, m=GMod, ww=1.5, rh=ringh) {
n=2*np + ns;
bodr = m*(ns+np/2) + .2;
bd = n*m + 2*ww;
ha = herringbone(helix=-30, $fn=9);
gfn = $preview ? 9 : 15;
cfs = $preview ? .1 : 2;
ch= rh;
difference() {
intersection () {
cylinder(h=ch+2*ww, d=bd, center=true);
//translate([-4,0,-5]) cube([50,60,20]);
}
//#translate([0,0,ringh/2+.7])
// middle clearance
cylinder(h=ch+.6, d=bd-2*ww-2, center=true, $fs=cfs);
cylinder(h=ch+.6+2, d=bodr, center=true, $fs=cfs);
spur_gear(m=m, n=n, z=rh+.2, chamfer=00, helix_angle=ha,
type=1, x=.3, ded=-.2, add=.2, $fn=gfn);
// Top Opening
translate([0,0,(ch/2 +ww/2)]) cylinder(h=ww+.1, d=11, center=true);
// Bottom Opening
translate([0,0,-(ch/2 +ww/2)]) cylinder(h=ww+.1, d=11, center=true);
}
}
module gearbox(ww) {
motor_r = 3*360/14 -90;
m=GMod;
ns=9;
np=7;
nt=24;
nr=ns+2*nt;
R=-nr/ns;
echo("R= ", R);
echo("Output: ", (1/(1+R)));
echo("Ring Size: ", nr);
color(sun_color) sun_gear(nt=ns, h=ringh, ha=herringbone(helix=30, $fn=9));
planet_carrier(incolor=incolor, ns=ns, np=3, nt=nt);
difference() {
//rr = 180/(ns+2*nt);
rr=0;
rotate([0,0,rr]) ring_gear(np=nt,ns=ns, ww=5);
translate([0,-shaftz-1,0]) cube([20,2,ringh+2*ww+.2], center=true);
}
}
incolor=true;
drive_color = incolor ? "green" : undef;
sun_color = incolor ? "yellow" : undef;
ww=5;
translate([0,shaftz,0]) {
difference() {
gearbox(ww=ww);
//translate([-30,-30])
//cube([60,60,40]);
//translate([0,-shaftz-1,0]) cube([20,2,ringh+2*ww+.2], center=true);2
}
// Input Drive
mgt=5;
tgt=49;
igt=55;
im=.8;
mmd=-im*(tgt+mgt)/2;
imd=-im*(igt+tgt)/2;
translate([0,0,5.1+3+ringh/2]) {
//color("red") input_gear(nt=igt, ha=-30);
echo("Motor Transmission D: ", mmd);
translate([imd,0]) color("darkslategrey") input_gear();
echo("Motor Drive D: ", mmd+imd);
translate([mmd+imd,0,-5]) rotate([0,0,5/8.25*72]) color("white") motor_gear();
}
// Input Body
Ri(D);
}
// Base Plate
translate([-60,0,-5]) cube([90,3,10]);
// Drive gear
//%rotate([0,0,motor_r]) translate([-m*(49+5)/2,0]) color(drive_color) {
// z=8.25;
// rotate([0,0,(ns-np) * motor_r *.8 +180]) {
// translate([0,0,0]) motor_gear(z=z);
// translate([0,0,-z]) motor_gear(z=z);
// }
//}
//rotate([0,0,36]) %sun_gear();
//translate([20,0,0]) spur_gear(m=.64, n=13, z=ringh, chamfer=10, helix_angle=30);
//rotate([0,0,0]) spur_gear(m=.64, n=13, z=ringh, chamfer=10, helix_angle=-30);