Code cleaning + add ears to the bottle clip! #22
1 changed files with 36 additions and 31 deletions
Add the monster can clip
commit
65b054cfa3
|
|
@ -34,7 +34,7 @@ LOGO_FILE = ""; // empty string is catear model
|
||||||
FONT = ""; // empty string is for Orbitron font
|
FONT = ""; // empty string is for Orbitron font
|
||||||
|
|
||||||
// Format of the bottle clip you want to create.
|
// 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, 3=Steinie bottles]
|
FORMAT = 0; // [0=Club Mate 50cL, 1=Long Neck as 25cL Club Mate or Fritz-kola, 2=Euroform 2, 3=Steinie bottles, 4=Monster can]
|
||||||
|
|
||||||
// Style of the ears to add... or not add. This parameter can add a LOT of calculation time.
|
// Style of the ears to add... or not add. This parameter can add a LOT of calculation time.
|
||||||
EARS_STYLE = 0; // [0=No ears, 1=Just arcs, 2=Filled ears with the same thickness, 3=Filled ears with the a thinner thickness inside, 4=Filled ears with the same thickness but shifted]
|
EARS_STYLE = 0; // [0=No ears, 1=Just arcs, 2=Filled ears with the same thickness, 3=Filled ears with the a thinner thickness inside, 4=Filled ears with the same thickness but shifted]
|
||||||
|
|
@ -131,7 +131,7 @@ module render_bottle_clip(name="", font="", logo="", format=0, ears_style=1) {
|
||||||
name = name == "" ? "c3cat" : name ;
|
name = name == "" ? "c3cat" : name ;
|
||||||
font = font == "" ? "write/orbitron.dxf" : font ;
|
font = font == "" ? "write/orbitron.dxf" : font ;
|
||||||
|
|
||||||
if (format < 0 || format > 3) {
|
if (format < 0 || format > 4) {
|
||||||
assert(false, str("Unknown format ", format, "."));
|
assert(false, str("Unknown format ", format, "."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,9 +139,10 @@ module render_bottle_clip(name="", font="", logo="", format=0, ears_style=1) {
|
||||||
// Format == 1: Long Neck bottle (like fritz-kola) 0.25L
|
// Format == 1: Long Neck bottle (like fritz-kola) 0.25L
|
||||||
// Format == 2: Euroform 2 bottle
|
// Format == 2: Euroform 2 bottle
|
||||||
// Format == 3: Steinie bottle
|
// Format == 3: Steinie bottle
|
||||||
ru = 13;
|
// Format == 4: Monster Can
|
||||||
rl = format == 1 ? 15 : format == 2 ? 22.5 : 17.5 ;
|
ru = format == 4 ? 26 : 13;
|
||||||
ht = format == 3 ? 13 : 26 ;
|
rl = format == 4 ? 32 : format == 1 ? 15 : format == 2 ? 22.5 : 17.5 ;
|
||||||
|
ht = format == 4 ? 10 : format == 3 ? 13 : 26 ;
|
||||||
width = 2.5;
|
width = 2.5;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -154,7 +155,8 @@ module render_bottle_clip(name="", font="", logo="", format=0, ears_style=1) {
|
||||||
ru=ru,
|
ru=ru,
|
||||||
rl=rl,
|
rl=rl,
|
||||||
ht=ht,
|
ht=ht,
|
||||||
width=width);
|
width=width,
|
||||||
|
format=format);
|
||||||
|
|
||||||
// Render ears if requested
|
// Render ears if requested
|
||||||
if (ears_style > 0) {
|
if (ears_style > 0) {
|
||||||
|
|
@ -195,18 +197,18 @@ module render_bottle_clip(name="", font="", logo="", format=0, ears_style=1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module name(name, font, rl, ht, ru) {
|
module name(name, font, rl, ht, ru, format) {
|
||||||
writecylinder(
|
writecylinder(
|
||||||
text=name,
|
text=name,
|
||||||
where=[0, 0, 0],
|
where=[0, 0, 0],
|
||||||
radius=rl+0.5,
|
radius=rl+0.5,
|
||||||
height=ht/13*7,
|
height=format == 4 ? ht : ht/13*7,
|
||||||
h=ht/13*4,
|
h=format == 4 ? ht/13*7 : ht/13*4,
|
||||||
t=max(rl,ru),
|
t=max(rl,ru),
|
||||||
font=font);
|
font=font);
|
||||||
}
|
}
|
||||||
|
|
||||||
module logo(logo, rl, ht, ru, width) {
|
module logo(logo, rl, ht, ru, width, format) {
|
||||||
echo(logo=logo);
|
echo(logo=logo);
|
||||||
if(logo == "") {
|
if(logo == "") {
|
||||||
// No logo file specified? Let's print a catear headband instead!
|
// No logo file specified? Let's print a catear headband instead!
|
||||||
|
|
@ -215,21 +217,20 @@ module logo(logo, rl, ht, ru, width) {
|
||||||
echo(ru=ru);
|
echo(ru=ru);
|
||||||
echo(rl=rl);
|
echo(rl=rl);
|
||||||
echo(width=width);
|
echo(width=width);
|
||||||
translate([0, -max(ru,rl), ht*3/4+.5])
|
translate([0, -max(ru,rl), format == 4 ? ht/2 : ht*3/4+.5])
|
||||||
rotate([90, 0, 0])
|
rotate([90, 0, 0])
|
||||||
scale([1, 1, 1])
|
scale([format == 4 ? ht/50 : ht/100, format == 4 ? ht/50 : ht/100, 1])
|
||||||
scale([ht/100, ht/100, 1])
|
translate([0, format == 4 ? 0 : -ht/2, 0])
|
||||||
translate([0, -ht/2, 0])
|
rotate(-90, [0, 0, 1])
|
||||||
rotate(-90, [0, 0, 1])
|
catear_headband(
|
||||||
catear_headband(
|
size=ear_size,
|
||||||
size=ear_size,
|
height=max(ru, rl),
|
||||||
height=max(ru, rl),
|
thickness=width,
|
||||||
thickness=width,
|
stretch_len=0,
|
||||||
stretch_len=0,
|
tip_len=0,
|
||||||
tip_len=0,
|
details=false,
|
||||||
details=false,
|
with_rake=false
|
||||||
with_rake=false
|
);
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
translate([0, 0, ht*3/4-0.1])
|
translate([0, 0, ht*3/4-0.1])
|
||||||
rotate([90, 0, 0])
|
rotate([90, 0, 0])
|
||||||
|
|
@ -260,7 +261,7 @@ module logo(logo, rl, ht, ru, width) {
|
||||||
*
|
*
|
||||||
* An empty logo file will create a headband with cat ears as a logo.
|
* An empty logo file will create a headband with cat ears as a logo.
|
||||||
*/
|
*/
|
||||||
module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/orbitron.dxf", logo="") {
|
module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/orbitron.dxf", logo="", format=0) {
|
||||||
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
|
||||||
|
|
||||||
// main cylinder
|
// main cylinder
|
||||||
|
|
@ -269,8 +270,12 @@ module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/o
|
||||||
cylinder(r1=rl+width, r2=ru+width, h=ht);
|
cylinder(r1=rl+width, r2=ru+width, h=ht);
|
||||||
difference() {
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
name(name=name, font=font, rl=rl, ht=ht, ru=ru);
|
if (name != "" || format != 4) {
|
||||||
logo(logo=logo, rl=rl, ht=ht, ru=ru, width=width);
|
name(name=name, font=font, rl=rl, ht=ht, ru=ru, format=format);
|
||||||
|
}
|
||||||
|
if (name == "" || format != 4) {
|
||||||
|
logo(logo=logo, rl=rl, ht=ht, ru=ru, width=width, format=format);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
|
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
|
||||||
}
|
}
|
||||||
|
|
@ -285,17 +290,17 @@ module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// text
|
// text
|
||||||
if (RENDER_COLOR_TEXT) {
|
if (RENDER_COLOR_TEXT && (name != "" || format != 4)) {
|
||||||
color("orange") difference() {
|
color("orange") difference() {
|
||||||
name(name=name, font=font, rl=rl, ht=ht, ru=ru);
|
name(name=name, font=font, rl=rl, ht=ht, ru=ru, format=format);
|
||||||
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
|
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
|
||||||
outer_cutoff(rl, e, ru, ht, width);
|
outer_cutoff(rl, e, ru, ht, width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// logo
|
// logo
|
||||||
if (RENDER_COLOR_LOGO) {
|
if (RENDER_COLOR_LOGO && (name == "" || format != 4)) {
|
||||||
color("yellow") difference() {
|
color("yellow") difference() {
|
||||||
logo(logo=logo, rl=rl, ht=ht, ru=ru, width=2*width);
|
logo(logo=logo, rl=rl, ht=ht, ru=ru, width=2*width, format=format);
|
||||||
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
|
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
|
||||||
outer_cutoff(rl, e, ru, ht, width);
|
outer_cutoff(rl, e, ru, ht, width);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue