Code cleaning + add ears to the bottle clip! #22
1 changed files with 50 additions and 52 deletions
Fix rotation problem
commit
2ac86c04a9
|
|
@ -105,29 +105,28 @@ module render_bottle_clip(name="", font="", logo="", format=0, has_ears=true) {
|
|||
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);
|
||||
}
|
||||
}
|
||||
scale([5, 5, 5]) {
|
||||
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 && RENDER_COLOR_EARS) {
|
||||
ears(ht=ht, ru=ru, rl=rl);
|
||||
if (has_ears) {
|
||||
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
|
||||
}
|
||||
}
|
||||
|
||||
// Render ears if requested
|
||||
if (has_ears && RENDER_COLOR_EARS) {
|
||||
ears(ht=ht, ru=ru, rl=rl, clip_width=width, ears_style=ears_style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module name(name, font, rl, ht, ru) {
|
||||
|
|
@ -197,43 +196,42 @@ module logo(logo, rl, ht, ru, width) {
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
clear_anti_aliasing = 0.01; // The margin to avoid empty surfaces in the preview.
|
||||
translate([0, 0, -clear_anti_aliasing/2])
|
||||
cylinder(r1=rl, r2=ru, h=ht+clear_anti_aliasing);
|
||||
// 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);
|
||||
// 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);
|
||||
outer_cutoff(rl, e, ru, ht, width);
|
||||
}
|
||||
|
||||
clear_anti_aliasing = 0.01; // The margin to avoid empty surfaces in the preview.
|
||||
translate([0, 0, -clear_anti_aliasing/2])
|
||||
cylinder(r1=rl, r2=ru, h=ht+clear_anti_aliasing);
|
||||
// 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]);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue