333 lines
6.2 KiB
OpenSCAD
333 lines
6.2 KiB
OpenSCAD
tooth_width = 0.8;
|
|
tooth_crop = 0.5;
|
|
tooth_thickness = 1.0;
|
|
|
|
module tooth() {
|
|
width = tooth_width;
|
|
thickness = tooth_thickness;
|
|
crop = tooth_crop;
|
|
|
|
points = [[0, width/2], [0, -width/2], [1, 0]];
|
|
intersection() {
|
|
// rotate([90, 0, 0])
|
|
linear_extrude(height=thickness, center=true)
|
|
polygon(points);
|
|
|
|
cube([crop*2, width, thickness], center=true);
|
|
}
|
|
}
|
|
|
|
function gear_base_radius(n) =
|
|
let (perimeter = tooth_width * (1 + 0.8*(1-tooth_crop)) * n)
|
|
perimeter / PI / 2;
|
|
|
|
function gear_wheel_radius(n) =
|
|
sqrt(gear_base_radius(n)^2 + (tooth_width/2)^2);
|
|
|
|
function gear_radius(n) =
|
|
(gear_wheel_radius(n)
|
|
+ gear_base_radius(n) + tooth_crop)/2;
|
|
|
|
module gear(n) {
|
|
radius = gear_base_radius(n);
|
|
wheel_radius = gear_wheel_radius(n);
|
|
thickness = tooth_thickness;
|
|
|
|
// rotate([90, 0, 0])
|
|
linear_extrude(height=thickness, center=true)
|
|
circle(wheel_radius, $fn=50);
|
|
|
|
for (i=[0:n-1]) {
|
|
angle=360 / n;
|
|
rotate([0, 0, i * angle])
|
|
translate([radius, 0, 0])
|
|
tooth();
|
|
}
|
|
}
|
|
|
|
gear_scale = 5;
|
|
|
|
module final_gear(n) {
|
|
scale([gear_scale, gear_scale, gear_scale])
|
|
gear(n);
|
|
}
|
|
|
|
module orbit_ring(n1, n2) {
|
|
difference() {
|
|
union() {
|
|
cylinder(h=24, r=20, center=true);
|
|
|
|
translate([22, 0, 0])
|
|
rotate([0, 90, 0])
|
|
cylinder(h=10, r=5, center=true);
|
|
|
|
translate([0, 0, 12])
|
|
final_gear(n=n1);
|
|
|
|
translate([0, 0, -12])
|
|
final_gear(n=n2);
|
|
}
|
|
cylinder(h=100, r=14.7, center=true);
|
|
}
|
|
}
|
|
|
|
module orbit(length, orbit_order, n1, n2=25, planet_size=40) {
|
|
// orbit_length = 100;
|
|
// orbit_order = 20;
|
|
|
|
orbit_length = length + 50;
|
|
|
|
thickness = 2.0;
|
|
|
|
rotate([0, 90, 0])
|
|
translate([0, 0, orbit_length/2])
|
|
cylinder(h=orbit_length, r=thickness/2, center=true, $fn=50);
|
|
|
|
translate([orbit_length, 0, 0])
|
|
translate([0, 0, orbit_order/2])
|
|
cylinder(h=orbit_order, r=thickness/2, center=true, $fn=50);
|
|
|
|
translate([orbit_length, 0, orbit_order+planet_size/2])
|
|
sphere(planet_size/2);
|
|
|
|
orbit_ring(n1, n2);
|
|
}
|
|
|
|
module _sidegear_diff(r) {
|
|
difference() {
|
|
cylinder(h=200, r=r, center=true);
|
|
|
|
translate([-2.5, 0, -110])
|
|
cube([5, 300, 300]);
|
|
|
|
rotate([0, 0, 120])
|
|
translate([-2.5, 0, -110])
|
|
cube([5, 300, 300]);
|
|
|
|
rotate([0, 0, 240])
|
|
translate([-2.5, 0, -110])
|
|
cube([5, 300, 300]);
|
|
|
|
cylinder(h=210, r=8, center=true);
|
|
}
|
|
|
|
cube([4, 4, 25], center=true);
|
|
}
|
|
|
|
module sidegear(n) {
|
|
difference() {
|
|
final_gear(n);
|
|
_sidegear_diff(n*0.75);
|
|
}
|
|
}
|
|
|
|
module flangebrace() {
|
|
translate([0, -30, 0])
|
|
cube([14.7, 5, 23], center=true);
|
|
|
|
difference() {
|
|
union() {
|
|
translate([0, -12, 10])
|
|
cube([14.7, 39, 3], center=true);
|
|
|
|
translate([0, -12, -10])
|
|
cube([14.7, 39, 3], center=true);
|
|
}
|
|
|
|
cylinder(h=50, r=4, center=true);
|
|
}
|
|
}
|
|
|
|
module flange(offset) {
|
|
difference() {
|
|
cylinder(h=5, r=22, center=true);
|
|
|
|
cylinder(h=10, r=14.4, center=true);
|
|
}
|
|
|
|
difference() {
|
|
translate([offset, 0, 0])
|
|
cylinder(h=5, r=32, center=true);
|
|
|
|
translate([offset, -32, 0])
|
|
cube([15, 10, 15], center=true);
|
|
|
|
translate([offset, 0, 0])
|
|
_sidegear_diff(25);
|
|
|
|
translate([offset, 0, 0])
|
|
cylinder(h=6, d=6.3, center=true);
|
|
}
|
|
}
|
|
|
|
module shaftend() {
|
|
difference() {
|
|
cylinder(h=3, r=3.9, center=true);
|
|
|
|
cube([4, 4, 5], center=true);
|
|
}
|
|
}
|
|
|
|
module linkage(offset, n1=25, n2) {
|
|
color("pink")
|
|
translate([offset, 0, 0]) {
|
|
cube([4, 4, 25], center=true);
|
|
|
|
translate([0, 0, 10])
|
|
shaftend();
|
|
|
|
translate([0, 0, -10])
|
|
shaftend();
|
|
|
|
translate([0, 0, 5])
|
|
sidegear(n=n1);
|
|
|
|
translate([0, 0, -5])
|
|
sidegear(n=n2);
|
|
}
|
|
|
|
color("white")
|
|
flange(offset);
|
|
|
|
translate([offset, 0, 0])
|
|
flangebrace();
|
|
}
|
|
|
|
|
|
module sungear(n) {
|
|
difference() {
|
|
//orbit_ring(n1=25, n2=25);
|
|
final_gear(n);
|
|
cylinder(h=200, r=14.7, center=true);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
module sunshaft() {
|
|
translate([0, 0, -180])
|
|
cylinder(h=400, r=15, center=true);
|
|
|
|
translate([0, 0, -380])
|
|
cylinder(h=20, r=150, center=true);
|
|
|
|
translate([0, 0, 45])
|
|
sphere(d=66);
|
|
}
|
|
|
|
/*
|
|
|
|
inner gears:
|
|
-----
|
|
25: 9
|
|
30: 2
|
|
27: 1
|
|
29: 2
|
|
35: 1
|
|
31: 1
|
|
-----
|
|
16
|
|
|
|
side gears:
|
|
-----
|
|
25: 7
|
|
20: 2
|
|
23: 1
|
|
19: 1
|
|
21: 2
|
|
15: 1
|
|
-----
|
|
14
|
|
|
|
*/
|
|
|
|
sh = 29;
|
|
fh = 5;
|
|
function sleevez(i) = -i * (sh + fh) - sh/2;
|
|
function flangez(i) = sleevez(i) - 17;
|
|
function orbitz(i) = 20 - sleevez(i);
|
|
|
|
gear_offset = 48;
|
|
|
|
orbit_ring(35, 25);
|
|
|
|
|
|
//color("white") sunshaft();
|
|
/*
|
|
// mercury
|
|
color("grey")
|
|
translate([0, 0, sleevez(0)])
|
|
orbit(50, orbitz(0), n1=25);
|
|
|
|
translate([0, 0, flangez(0)])
|
|
linkage(offset=gear_offset, n2=20);
|
|
/*
|
|
// venus
|
|
color("yellow")
|
|
translate([0, 0, sleevez(1)])
|
|
orbit(130, orbitz(1), n1=30);
|
|
|
|
translate([0, 0, flangez(1)])
|
|
linkage(offset=gear_offset, n2=23);
|
|
|
|
// earth
|
|
color("#34a56f")
|
|
translate([0, 0, sleevez(2)])
|
|
orbit(200, orbitz(2), n1=27);
|
|
|
|
translate([0, 0, flangez(2)])
|
|
linkage(offset=gear_offset, n2=21);
|
|
|
|
// mars
|
|
color("red")
|
|
translate([0, 0, sleevez(3)])
|
|
orbit(270, orbitz(3), n1=29);
|
|
|
|
translate([0, 0, flangez(3)])
|
|
linkage(offset=50, n2=15);
|
|
|
|
// jupiter
|
|
color("orange")
|
|
translate([0, 0, sleevez(4)])
|
|
orbit(450, orbitz(4), n1=35);
|
|
|
|
translate([0, 0, flangez(4)])
|
|
linkage(offset=50, n2=20);
|
|
|
|
// saturn
|
|
color("purple")
|
|
translate([0, 0, sleevez(5)])
|
|
orbit(540, orbitz(5), n1=30);
|
|
|
|
translate([0, 0, flangez(5)])
|
|
linkage(offset=50, n2=19);
|
|
|
|
// uranus
|
|
color("#aaaaff")
|
|
translate([0, 0, sleevez(6)])
|
|
orbit(640, orbitz(6), n1=31);
|
|
|
|
translate([0, 0, flangez(6)])
|
|
linkage(offset=50, n2=21);
|
|
|
|
// neptune
|
|
color("#3333aa")
|
|
translate([0, 0, sleevez(7)])
|
|
orbit(710, orbitz(7), n1=29);
|
|
|
|
/*
|
|
*/
|
|
|
|
/*
|
|
gear0 = 7;
|
|
gear1 = 7;
|
|
|
|
spacing = 1.0;
|
|
|
|
rotate([0, 0, $t*360])
|
|
final_gear(gear0);
|
|
|
|
translate([spacing + (gear_radius(gear0) + gear_radius(gear1)) * gear_scale, 0, 0])
|
|
rotate([0, 0, -$t*360 * gear0 / gear1])
|
|
final_gear(gear1);
|
|
*/ |