Add a function to generate a the bottle clip depending on the asked format
This commit is contained in:
parent
f492bdd2cd
commit
6364985e55
1 changed files with 44 additions and 72 deletions
|
|
@ -77,84 +77,55 @@ $fn = 360;
|
||||||
* 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.
|
* 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]) {
|
scale([0.2, 0.2, 0.2]) {
|
||||||
difference() {
|
render_bottle_clip(
|
||||||
scale([5, 5, 5])
|
|
||||||
rotate(45, [0, 0, 1])
|
|
||||||
bottle_clip_format(
|
|
||||||
name=NAME,
|
name=NAME,
|
||||||
font=FONT,
|
font=FONT,
|
||||||
logo=LOGO_FILE,
|
logo=LOGO_FILE,
|
||||||
format=FORMAT);
|
format=FORMAT,
|
||||||
|
has_ears=USE_TINY_EARS);
|
||||||
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();
|
|
||||||
}
|
|
||||||
if (RENDER_COLOR_TEXT) {
|
|
||||||
color("orange")
|
|
||||||
translate([ 15*5, 0*5, 18*5])
|
|
||||||
rotate(80, [0, 1, 0])
|
|
||||||
catear();
|
|
||||||
}
|
|
||||||
if (RENDER_COLOR_LOGO) {
|
|
||||||
color("yellow")
|
|
||||||
translate([-15*5, 0*5, 18*5])
|
|
||||||
rotate(-80, [0, 1, 0])
|
|
||||||
catear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module bottle_clip_format(name="", font="", logo="", format=0) {
|
module render_bottle_clip(name="", font="", logo="", format=0, has_ears=true) {
|
||||||
name = name == "" ? "c3cat" : name ;
|
name = name == "" ? "c3cat" : name ;
|
||||||
font = font == "" ? "write/orbitron.dxf" : font ;
|
font = font == "" ? "write/orbitron.dxf" : font ;
|
||||||
|
|
||||||
if (format == 0) {
|
if (format < 0 || format > 3) {
|
||||||
// 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 if (format == 3) {
|
|
||||||
// Steinie bottle
|
|
||||||
bottle_clip(
|
|
||||||
name=name,
|
|
||||||
font=font,
|
|
||||||
logo=logo,
|
|
||||||
ru=13,
|
|
||||||
rl=17.5,
|
|
||||||
ht=13,
|
|
||||||
width=2.5);
|
|
||||||
} else {
|
|
||||||
assert(false, str("Unknown format ", format, "."));
|
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) {
|
||||||
|
ears(ht=ht, ru=ru, rl=rl);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module name(name, font, rl, ht, ru) {
|
module name(name, font, rl, ht, ru) {
|
||||||
|
|
@ -171,6 +142,7 @@ module name(name, font, rl, ht, ru) {
|
||||||
module logo(logo, rl, ht, ru, width) {
|
module logo(logo, rl, ht, ru, width) {
|
||||||
echo(logo=logo);
|
echo(logo=logo);
|
||||||
if(logo == "") {
|
if(logo == "") {
|
||||||
|
// No logo file specified? Let's print a catear headband instead!
|
||||||
ear_size=ht;
|
ear_size=ht;
|
||||||
echo(ht=ht);
|
echo(ht=ht);
|
||||||
echo(ru=ru);
|
echo(ru=ru);
|
||||||
|
|
@ -274,7 +246,7 @@ module outer_cutoff(rl, e, ru, ht, width) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module catear() {
|
module ear() {
|
||||||
if (USE_TINY_EARS) {
|
if (USE_TINY_EARS) {
|
||||||
rotate(-90, [0, 0, 1]) union() {
|
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");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue