From a94d14e63212645c23d58ea494a6f933bcf3783b Mon Sep 17 00:00:00 2001 From: djerun Date: Sat, 14 Dec 2024 21:49:49 +0100 Subject: [PATCH] [WIP] leightweight lighthouse --- generate_lighthouse.sh | 43 +++++++++++++++++++++++++ lighthouse.scad | 72 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100755 generate_lighthouse.sh create mode 100644 lighthouse.scad diff --git a/generate_lighthouse.sh b/generate_lighthouse.sh new file mode 100755 index 0000000..a09cded --- /dev/null +++ b/generate_lighthouse.sh @@ -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 diff --git a/lighthouse.scad b/lighthouse.scad new file mode 100644 index 0000000..df12e9c --- /dev/null +++ b/lighthouse.scad @@ -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); +}