Add the HAS_EARS variable to be able to generate bottle clips without ears. Rename the RENDER_EARS to RENDER_COLOR_EARS
258 lines
8 KiB
OpenSCAD
258 lines
8 KiB
OpenSCAD
/**
|
|
* A name tag that can easily be clipped to the neck of your bottle.
|
|
* Copyright (C) 2013 Roland Hieber <rohieb+bottleclip@rohieb.name>
|
|
*
|
|
* This file was modified by obelix <christian@loelkes.com> for the
|
|
* OHM2013-Logo. If you wish to use other logos please use the original
|
|
* file. All other parameters were not modified.
|
|
*
|
|
* This file was modified again by djerun to use the catars printed
|
|
* by c3cat: https://www.printables.com/model/35076-cat-ears
|
|
* as the logo and optionally allow use the easrs from
|
|
* https://www.thingiverse.com/thing:5029374
|
|
* printed at scale 0.2 as glue-ins for additional ears.
|
|
*
|
|
* `Ohren_4.stl` and `catears.stl` need to be placed in `../stls/`
|
|
* for the symlinks to work otherwise `catears.stl` needs to be placed
|
|
* at `./catears.stl` and `Ohren_4.stl` at `./catear.stl`.
|
|
*
|
|
* Version of the modification: 1.0
|
|
*
|
|
* See examples.scad for examples on how to use this module.
|
|
*
|
|
* The contents of this file are licenced under CC-BY-SA 3.0 Unported.
|
|
* See https://creativecommons.org/licenses/by-sa/3.0/deed for the
|
|
* licensing terms.
|
|
*/
|
|
|
|
include <write/Write.scad>
|
|
use <catear_headband.scad>
|
|
|
|
|
|
// The name that is printed on your name tag.
|
|
NAME = "c3cat";
|
|
// The logo that is printed on your name tag. Has to be a DXF file. You can use the thing-logo repository for inspiration.
|
|
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 = 3; // [0=Club Mate 50cL, 1=Long Neck as 25cL Club Mate or Fritz-kola, 2=Euroform 2, 3=Steinie bottles]
|
|
|
|
// Append ears to the bottle clip
|
|
HAS_EARS = true;
|
|
|
|
/* [Render] */
|
|
// Whether to render the clip, the body.
|
|
RENDER_COLOR_CLIP = true;
|
|
// Whether to render the text part.
|
|
RENDER_COLOR_TEXT = true;
|
|
// Whether to render the logo part.
|
|
RENDER_COLOR_LOGO = true;
|
|
// Whether to render the cat ears part.
|
|
RENDER_COLOR_EARS = true;
|
|
|
|
// Set the number of facets for circles.
|
|
$fn = 360;
|
|
|
|
|
|
/**
|
|
* Creates one instance of a bottle clip name tag. The default values are
|
|
* suitable for 0.5l Club Mate bottles (and similar bottles). By default, logo
|
|
* and text are placed on the name tag so they both share half the height. In this
|
|
* version the logo is fixed.
|
|
*
|
|
* Parameters:
|
|
* ru: the radius on the upper side of the clip
|
|
* rl: the radius on the lower side of the clip
|
|
* ht: the height of the clip
|
|
* width: the thickness of the wall. Values near 2.5 usually result in a good
|
|
* clippiness for PLA prints.
|
|
* name: the name that is printed on your name tag. For the default ru/rt/ht
|
|
* values, this string should not exceed 18 characters to fit on the name tag.
|
|
* font: the path to a font for Write.scad.
|
|
*/
|
|
|
|
/**
|
|
* currently openscad fails to render the original `Ohren_4.stl` outside of the preview mode
|
|
* according to [the wiki](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Why_is_my_imported_STL_file_appearing_with_F5_but_not_F6?) this is the stls fault
|
|
* using meshlab to run `Filters` -> `Cleaning and Repairing` -> `Remove T-Vertices` by `Edge-Flip` with `Ratio` of `1000000` before importing the stl works but but two errors remain.
|
|
*/
|
|
scale([0.2, 0.2, 0.2]) {
|
|
render_bottle_clip(
|
|
name=NAME,
|
|
font=FONT,
|
|
logo=LOGO_FILE,
|
|
format=FORMAT,
|
|
has_ears=HAS_EARS);
|
|
}
|
|
|
|
module render_bottle_clip(name="", font="", logo="", format=0, has_ears=true) {
|
|
name = name == "" ? "c3cat" : name ;
|
|
font = font == "" ? "write/orbitron.dxf" : font ;
|
|
|
|
if (format < 0 || format > 3) {
|
|
assert(false, str("Unknown format ", format, "."));
|
|
}
|
|
|
|
// Format == 0: Club-Mate 0.5L bottle
|
|
// Format == 1: Long Neck bottle (like fritz-kola) 0.25L
|
|
// Format == 2: Euroform 2 bottle
|
|
// Format == 3: Steinie bottle
|
|
ru = 13;
|
|
rl = format == 1 ? 15 : format == 2 ? 22.5 : 17.5 ;
|
|
ht = format == 3 ? 13 : 26 ;
|
|
width = 2.5;
|
|
|
|
|
|
scale([5, 5, 5])
|
|
rotate(45, [0, 0, 1]) {
|
|
difference() {
|
|
bottle_clip(
|
|
name=NAME,
|
|
font=FONT,
|
|
logo=LOGO_FILE,
|
|
ru=ru,
|
|
rl=rl,
|
|
ht=ht,
|
|
width=width);
|
|
|
|
// Render ears if requested
|
|
if (has_ears) {
|
|
ears(ht=ht, ru=ru, rl=rl);
|
|
}
|
|
}
|
|
|
|
// Render ears if requested
|
|
if (has_ears && RENDER_COLOR_EARS) {
|
|
ears(ht=ht, ru=ru, rl=rl);
|
|
}
|
|
}
|
|
}
|
|
|
|
module name(name, font, rl, ht, ru) {
|
|
writecylinder(
|
|
text=name,
|
|
where=[0, 0, 0],
|
|
radius=rl+0.5,
|
|
height=ht/13*7,
|
|
h=ht/13*4,
|
|
t=max(rl,ru),
|
|
font=font);
|
|
}
|
|
|
|
module logo(logo, rl, ht, ru, width) {
|
|
echo(logo=logo);
|
|
if(logo == "") {
|
|
// No logo file specified? Let's print a catear headband instead!
|
|
ear_size=ht;
|
|
echo(ht=ht);
|
|
echo(ru=ru);
|
|
echo(rl=rl);
|
|
echo(width=width);
|
|
translate([0, -max(ru,rl), ht*3/4+.5])
|
|
rotate([90, 0, 0])
|
|
scale([1, 1, 1])
|
|
scale([ht/100, ht/100, 1])
|
|
translate([0, -ht/2, 0])
|
|
rotate(-90, [0, 0, 1])
|
|
catear_headband(
|
|
size=ear_size,
|
|
height=max(ru, rl),
|
|
thickness=width,
|
|
stretch_len=0,
|
|
tip_len=0,
|
|
details=false,
|
|
with_rake=false
|
|
);
|
|
} 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");
|
|
*/
|
|
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");
|
|
*/
|
|
}
|
|
}
|
|
|
|
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
|
|
if (RENDER_COLOR_CLIP) {
|
|
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);
|
|
}
|
|
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
|
|
}
|
|
translate([0, 0, -1])
|
|
cylinder(r1=rl, r2=ru, h=ht+2);
|
|
// finally, subtract 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]);
|
|
}
|
|
}
|
|
// text
|
|
if (RENDER_COLOR_TEXT) {
|
|
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_LOGO) {
|
|
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 subtracted, so the text and the logo end
|
|
// somewhere on the outside ;-)
|
|
difference () {
|
|
cylinder(r1=rl+e, r2=ru+e, h=ht);
|
|
translate([0, 0, -1])
|
|
// Note: bottom edges of characters are hard to print when character
|
|
// depth is > 0.7
|
|
cylinder(r1=rl+width+0.7, r2=ru+width+0.7, h=ht+2);
|
|
}
|
|
}
|
|
|
|
module ear() {
|
|
if (USE_TINY_EARS) {
|
|
rotate(-90, [0, 0, 1]) union() {
|
|
scale([1, 1 ,1]) translate([0, -85]) import("catear.stl");
|
|
scale([1, -1, 1]) translate([0, -85]) import("catear.stl");
|
|
}
|
|
}
|
|
}
|