[WIP] leightweight lighthouse

This commit is contained in:
djerun 2024-12-14 21:49:49 +01:00
parent 89a33df7ff
commit a94d14e632
2 changed files with 115 additions and 0 deletions

43
generate_lighthouse.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/sh
# usage: generate_bottle_tag.sh NAME
set -u
VERSION=0.1
FN=360
# usage: render LAYER PART
render() {
case "$2" in
layer)
CONNECTOR=false
;;
connector)
CONNECTOR=true
;;
*)
echo 'fatal: invalid part' >&2
exit 1
;;
esac
echo rendering "$1" "$2"
openscad \
-D "\$fn=${FN}" \
-D "CONNECTOR=${CONNECTOR}" \
-D "LAYER=$1" \
-o "stls/lighthouse-${2}${1}-v${VERSION}.stl" \
lighthouse.scad
}
cd "$(dirname $0)"
for LAYER in 1 2 3 4;
do
for PART in layer connector
do
render "$LAYER" "$PART"
sleep 1
done
done

72
lighthouse.scad Normal file
View file

@ -0,0 +1,72 @@
$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);
}