diff --git a/c3cat-bottle-clip/c3cat-bottle-clip.scad b/c3cat-bottle-clip/c3cat-bottle-clip.scad index 9e6dc35..f629f0e 100644 --- a/c3cat-bottle-clip/c3cat-bottle-clip.scad +++ b/c3cat-bottle-clip/c3cat-bottle-clip.scad @@ -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. 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] */ // Whether to render the clip, the body. RENDER_COLOR_CLIP = true; @@ -76,10 +80,11 @@ scale([0.2, 0.2, 0.2]) { difference() { scale([5, 5, 5]) rotate(45, [0, 0, 1]) - bottle_clip( + bottle_clip_format( name=NAME, font=FONT, - logo=LOGO_FILE); + logo=LOGO_FILE, + format=FORMAT); translate([ 15*5, 0*5, 18*5]) 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) { writecylinder( 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="") { - name = name == "" ? "c3cat" : name ; - font = font == "" ? "write/orbitron.dxf" : font ; +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 rotate([0, 0, -45]) { // 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. -**/ diff --git a/generate_bottle_tag.sh b/generate_bottle_tag.sh index 42e553e..6707ea4 100755 --- a/generate_bottle_tag.sh +++ b/generate_bottle_tag.sh @@ -11,7 +11,7 @@ FN=90 NAME="\"$1\"" -# usage: render NAME PART +# usage: render NAME PART [BOTTLE_FORMAT] render() { case "$2" in body) @@ -35,6 +35,12 @@ render() { ;; esac + if [ $# -lt 3 ]; then + BOTTLE_FORMAT="0" + else + BOTTLE_FORMAT="$3" + fi + echo rendering "$1" "$2" openscad \ -D "\$fn=${FN}" \ @@ -44,14 +50,18 @@ render() { -D "RENDER_COLOR_CLIP=${CLIP}" \ -D "RENDER_COLOR_TEXT=${TEXT}" \ -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 } cd "$(dirname $0)" -for PART in body logo name +for BOTTLE_FORMAT in 0 1 2 do - render "$NAME" "$PART" - sleep 1 + echo "Generating bottle format ${BOTTLE_FORMAT}" + for PART in body logo name + do + render "$NAME" "$PART" "$BOTTLE_FORMAT" + sleep 1 + done done