Compare commits

..

3 commits

Author SHA1 Message Date
djerun ab18f4751f add bottletag generation script 2024-12-08 19:20:37 +01:00
djerun 7950ae530e c3cat_bottle_tag v2.2 2024-11-29 18:53:44 +01:00
djerun 90521c426a c3cat_bottle_tag v2.1 2024-11-25 23:35:41 +01:00
2 changed files with 125 additions and 48 deletions

View file

@ -65,9 +65,18 @@ scale([0.2, 0.2, 0.2]) {
translate([ 15*5, 0*5, 18*5]) rotate(80, [0, 1, 0]) catear();
translate([-15*5, 0*5, 18*5]) rotate(-80, [0, 1, 0]) catear();
}
translate([0, 5*5, 0]) catear();
rotate(180) translate([0, 5*5, 0]) catear();
if (RENDER_COLOR_TWO) {
color("orange")
translate([ 15*5, 0*5, 18*5])
rotate(80, [0, 1, 0])
catear();
}
if (RENDER_COLOR_THREE) {
color("yellow")
translate([-15*5, 0*5, 18*5])
rotate(-80, [0, 1, 0])
catear();
}
}
module name(name, font, rl, ht, ru) {
@ -107,61 +116,75 @@ module logo(logo, rl, ht, ru, width) {
} else {
// The logo has been split in 3 parts. // well was... TODO
/*
rotate([0,0,-48]) translate([0,0,ht*3/4-0.1])
rotate([90,0,0])
scale([0.9,0.9,1])
scale([ht/100,ht/100,1])
translate([-25,-29,0.5])
linear_extrude(height=max(ru,rl)*2)
import("logo_1.dxf");
rotate([0,0,-48]) translate([0,0,ht*3/4-0.1])
rotate([90,0,0])
scale([0.9,0.9,1])
scale([ht/100,ht/100,1])
translate([-25,-29,0.5])
linear_extrude(height=max(ru,rl)*2)
import("logo_1.dxf");
*/
translate([0,0,ht*3/4-0.1])
rotate([90,0,0])
scale([0.8,0.8,1])
scale([ht/100,ht/100,1])
translate([-18,-22,0.5])
linear_extrude(height=max(ru,rl)*2)
import(logo);
translate([0,0,ht*3/4-0.1])
rotate([90,0,0])
scale([0.8,0.8,1])
scale([ht/100,ht/100,1])
translate([-18,-22,0.5])
linear_extrude(height=max(ru,rl)*2)
import(logo);
/*
rotate([0,0,44]) translate([0,0,ht*3/4-0.1])
rotate([90,0,0])
scale([0.7,0.7,1])
scale([ht/100,ht/100,1])
translate([-25,-26,0.5])
linear_extrude(height=max(ru,rl)*2)
import("logo_3.dxf");
rotate([0,0,44]) translate([0,0,ht*3/4-0.1])
rotate([90,0,0])
scale([0.7,0.7,1])
scale([ht/100,ht/100,1])
translate([-25,-26,0.5])
linear_extrude(height=max(ru,rl)*2)
import("logo_3.dxf");
*/
}
}
module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/orbitron.dxf", logo="") {
e=100; // should be big enough, used for the outer boundary of the text/logo
difference() {
rotate([0,0,-45]) union() {
// main cylinder
if (RENDER_COLOR_ONE) {
color("black")
difference() {
cylinder(r1=rl+width, r2=ru+width, h=ht);
rotate([0,0,-45]) {
// main cylinder
if (RENDER_COLOR_ONE) {
color("black") difference() {
cylinder(r1=rl+width, r2=ru+width, h=ht);
difference() {
union() {
name(name=name, font=font, rl=rl, ht=ht, ru=ru);
logo(logo=logo, rl=rl, ht=ht, ru=ru, width=width);
}
}
// text
if (RENDER_COLOR_TWO) {
color("orange")
name(name=name, font=font, rl=rl, ht=ht, ru=ru);
}
// logo
if (RENDER_COLOR_THREE) {
color("yellow") logo(logo=logo, rl=rl, ht=ht, ru=ru, width=2*width);
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
}
translate([0,0,-1])
cylinder(r1=rl, r2=ru, h=ht+2);
// finally, substract a cube as a gap so we can clip it to the bottle
rotate([0, 0, 45])
translate([0,0,-1])
cube([50,50,50]);
}
}
// inner cylinder which is substracted
translate([0,0,-1])
cylinder(r1=rl, r2=ru, h=ht+2);
// text
if (RENDER_COLOR_TWO) {
color("orange") difference() {
name(name=name, font=font, rl=rl, ht=ht, ru=ru);
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
outer_cutoff(rl, e, ru, ht, width);
}
}
// logo
if (RENDER_COLOR_THREE) {
color("yellow") difference() {
logo(logo=logo, rl=rl, ht=ht, ru=ru, width=2*width);
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
outer_cutoff(rl, e, ru, ht, width);
}
}
}
}
module outer_cutoff(rl, e, ru, ht, width) {
// outer cylinder which is substracted, so the text and the logo end
// somewhere on the outside ;-)
difference () {
@ -171,9 +194,6 @@ module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/o
// depth is > 0.7
cylinder(r1=rl+width+0.7, r2=ru+width+0.7, h=ht+2);
}
// finally, substract a cube as a gap so we can clip it to the bottle
translate([0,0,-1]) cube([50,50,50]);
}
}
module catear() {

57
generate_bottle_tag.sh Executable file
View file

@ -0,0 +1,57 @@
#!/bin/sh
# usage: generate_bottle_tag.sh NAME
set -u
VERSION=2.2
LOGO_FILE='""'
TINY_EARS=false
FN=90
NAME="\"$1\""
# usage: render NAME PART
render() {
case "$2" in
body)
ONE=true
TWO=false
THREE=false
;;
name)
ONE=false
TWO=true
THREE=false
;;
logo)
ONE=false
TWO=false
THREE=true
;;
*)
echo 'fatal: invalid part' >&2
exit 1
;;
esac
echo rendering "$1" "$2"
openscad \
-D "\$fn=${FN}" \
-D "USE_TINY_EARS=${TINY_EARS}" \
-D "LOGO_FILE=${LOGO_FILE}" \
-D "NAME=${NAME}" \
-D "RENDER_COLOR_ONE=${ONE}" \
-D "RENDER_COLOR_TWO=${TWO}" \
-D "RENDER_COLOR_THREE=${THREE}" \
-o "stls/c3cat-bottle-clip-v${VERSION}_${NAME}_${PART}.stl" \
c3cat-bottle-clip/c3cat-bottle-clip.scad
}
cd "$(dirname $0)"
for PART in body logo name
do
render "$NAME" "$PART"
sleep 1
done