Add a "FORMAT" variable to change the format for the bottle.

This commit is contained in:
Ajabep 2026-01-10 11:08:01 +01:00
commit bbb63737cc
2 changed files with 62 additions and 25 deletions

View file

@ -36,6 +36,10 @@ LOGO_FILE = ""; // empty string is catear model
// The font to be used for the name tag. See Write.scad for details. // The font to be used for the name tag. See Write.scad for details.
FONT = ""; // empty string is for Orbitron font FONT = ""; // empty string is for Orbitron font
// Format of the bottle clip you want to create.
FORMAT = 0; // [0=Club Mate 50cL, 1=Long Neck as 25cL Club Mate or Fritz-kola, 2=Euroform 2]
/* [Render] */ /* [Render] */
// Whether to render the clip, the body. // Whether to render the clip, the body.
RENDER_COLOR_CLIP = true; RENDER_COLOR_CLIP = true;
@ -76,10 +80,11 @@ scale([0.2, 0.2, 0.2]) {
difference() { difference() {
scale([5, 5, 5]) scale([5, 5, 5])
rotate(45, [0, 0, 1]) rotate(45, [0, 0, 1])
bottle_clip( bottle_clip_format(
name=NAME, name=NAME,
font=FONT, font=FONT,
logo=LOGO_FILE); logo=LOGO_FILE,
format=FORMAT);
translate([ 15*5, 0*5, 18*5]) translate([ 15*5, 0*5, 18*5])
rotate(-80, [0, 1, 0]) rotate(-80, [0, 1, 0])
@ -103,6 +108,45 @@ scale([0.2, 0.2, 0.2]) {
} }
} }
module bottle_clip_format(name="", font="", logo="", format=0) {
name = name == "" ? "c3cat" : name ;
font = font == "" ? "write/orbitron.dxf" : font ;
if (format == 0) {
// Club-Mate 0.5L bottle
bottle_clip(
name=name,
font=font,
logo=logo,
ru=13,
rl=17.5,
ht=26,
width=2.5);
} else if (format == 1) {
// 0.25L Long Neck format (like fritz-kola)
bottle_clip(
name=name,
font=font,
logo=logo,
ru=13,
rl=15,
ht=26,
width=2.5);
} else if (format == 2) {
// Euroform 2 bottle
bottle_clip(
name=name,
font=font,
logo=logo,
ru=13,
rl=22.5,
ht=26,
width=2.5);
} else {
assert(false, str("Unknown format ", format, "."));
}
}
module name(name, font, rl, ht, ru) { module name(name, font, rl, ht, ru) {
writecylinder( writecylinder(
text=name, text=name,
@ -167,9 +211,7 @@ module logo(logo, rl, ht, ru, width) {
} }
} }
module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="", font="", logo="") { module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/orbitron.dxf", logo="") {
name = name == "" ? "c3cat" : name ;
font = font == "" ? "write/orbitron.dxf" : font ;
e = 100; // should be big enough, used for the outer boundary of the text/logo e = 100; // should be big enough, used for the outer boundary of the text/logo
rotate([0, 0, -45]) { rotate([0, 0, -45]) {
// main cylinder // main cylinder
@ -230,18 +272,3 @@ module catear() {
} }
} }
} }
/**
* Creates one instance of a bottle clip name tag suitable for 0.33l longneck
* bottles (like fritz cola, etc.). All parameters are passed to the module
* bottle_clip(), see there for their documentation.
*/
module bottle_clip_longneck(name="", width=2.5, font="") {
name = name == "" ? "c3cat" : name ;
font = font == "" ? "write/orbitron.dxf" : font ;
bottle_clip(name=name, ru=13, rl=15, ht=26, width=width, font=font, logo="");
}
/**
* The Steinie-Tag has been removed since it does not support logos.
**/

View file

@ -11,7 +11,7 @@ FN=90
NAME="\"$1\"" NAME="\"$1\""
# usage: render NAME PART # usage: render NAME PART [BOTTLE_FORMAT]
render() { render() {
case "$2" in case "$2" in
body) body)
@ -35,6 +35,12 @@ render() {
;; ;;
esac esac
if [ $# -lt 3 ]; then
BOTTLE_FORMAT="0"
else
BOTTLE_FORMAT="$3"
fi
echo rendering "$1" "$2" echo rendering "$1" "$2"
openscad \ openscad \
-D "\$fn=${FN}" \ -D "\$fn=${FN}" \
@ -44,14 +50,18 @@ render() {
-D "RENDER_COLOR_CLIP=${CLIP}" \ -D "RENDER_COLOR_CLIP=${CLIP}" \
-D "RENDER_COLOR_TEXT=${TEXT}" \ -D "RENDER_COLOR_TEXT=${TEXT}" \
-D "RENDER_COLOR_LOGO=${LOGO}" \ -D "RENDER_COLOR_LOGO=${LOGO}" \
-o "stls/c3cat-bottle-clip-v${VERSION}_${NAME}_${PART}.stl" \ -o "stls/c3cat-bottle-clip-v${VERSION}_BOTTLE${BOTTLE_FORMAT}_${NAME}_${PART}.stl" \
c3cat-bottle-clip/c3cat-bottle-clip.scad c3cat-bottle-clip/c3cat-bottle-clip.scad
} }
cd "$(dirname $0)" cd "$(dirname $0)"
for PART in body logo name for BOTTLE_FORMAT in 0 1 2
do do
render "$NAME" "$PART" echo "Generating bottle format ${BOTTLE_FORMAT}"
sleep 1 for PART in body logo name
do
render "$NAME" "$PART" "$BOTTLE_FORMAT"
sleep 1
done
done done