scad/lighthouse.scad

73 lines
1.7 KiB
OpenSCAD
Raw Permalink Normal View History

2024-12-14 21:49:49 +01:00
$fn=360;
LAYER = 1;
CONNECTOR = false;
BASE_LAYER_DIAMETER = 140;
LAYER_HEIGHT = 125;
LAYER_SHRINK = 10;
CONNECTOR_RING_GROOVE_DEPTH = 0.5;
module layer(d) {
difference() {
cylinder(h=LAYER_HEIGHT, d1=d, d2=d-LAYER_SHRINK);
cylinder(h=LAYER_HEIGHT, d1=d-1, d2=d-LAYER_SHRINK-1);
}
}
module layer_connector(d) {
difference() {
cylinder(h=3*CONNECTOR_RING_GROOVE_DEPTH, d=d+2, center=true);
cylinder(h=3*CONNECTOR_RING_GROOVE_DEPTH, d=d-3, center=true);
translate([0, 0, CONNECTOR_RING_GROOVE_DEPTH/2]) layer(d);
translate([0, 0, -125-CONNECTOR_RING_GROOVE_DEPTH/2]) layer(d+LAYER_SHRINK);
}
}
module base(d) {
difference() {
union() {
difference() {
cylinder(h=LAYER_HEIGHT/10, d=d+3*LAYER_SHRINK);
translate([0, 0, LAYER_HEIGHT/10-CONNECTOR_RING_GROOVE_DEPTH])
cylinder(h=LAYER_HEIGHT, d1=d, d2=d-LAYER_SHRINK);;
}
intersection() {
cylinder(h=LAYER_HEIGHT, d1=d-1, d2=d-LAYER_SHRINK-1);
cylinder(h=LAYER_HEIGHT/5, d=d+3*LAYER_SHRINK);
}
}
cylinder(h=LAYER_HEIGHT, d=d-LAYER_SHRINK, center=true);
translate([0, 0, 5]) rotate([90, 0, 0]) cylinder(h=d, d=10);
translate([0, -d/2, 0]) cube([10, d, 10], center=true);
}
}
module brim(d) {
// TODO
}
module lightroom(d) {
// TODO
}
module light(d) {
// TODO
}
module roof(d) {
// TODO
}
D = BASE_LAYER_DIAMETER - (LAYER-1) * LAYER_SHRINK;
if (CONNECTOR) {
if (LAYER == 1) base(D);
if ((LAYER >= 2) && (LAYER <= 4)) layer_connector(D);
if (LAYER == 5) brim(D);
if (LAYER == 6) roof(D);
} else {
if ((LAYER >=1) && (LAYER <=4)) layer(D);
if (LAYER == 5) lightroom(D);
if (LAYER == 6) light(D);
}