Code cleaning + add ears to the bottle clip! #22

Open
ajabep wants to merge 23 commits from ajabep/scad:trunk into trunk
Showing only changes of commit b342b09dab - Show all commits

Fix indent, some typo, and all of that

Ajabep 2026-01-09 20:31:34 +01:00

View file

@ -33,8 +33,8 @@ $fn = 360;
NAME = "c3cat";
LOGO_FILE = ""; // empty string is catear model
RENDER_COLOR_ONE = true;
RENDER_COLOR_TWO = true;
RENDER_COLOR_THREE = true;
RENDER_COLOR_TEXT = true;
RENDER_COLOR_LOGO = true;
USE_TINY_EARS = true;
/**
@ -61,9 +61,18 @@ USE_TINY_EARS = true;
*/
scale([0.2, 0.2, 0.2]) {
difference() {
scale([5, 5, 5]) rotate(45, [0, 0, 1]) bottle_clip(name=NAME);
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();
scale([5, 5, 5])
rotate(45, [0, 0, 1])
bottle_clip(
name=NAME);
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_TWO) {
color("orange")
@ -82,7 +91,7 @@ scale([0.2, 0.2, 0.2]) {
module name(name, font, rl, ht, ru) {
writecylinder(
text=name,
where=[0,0,0],
where=[0, 0, 0],
radius=rl+0.5,
height=ht/13*7,
h=ht/13*4,
@ -91,22 +100,22 @@ module name(name, font, rl, ht, ru) {
}
module logo(logo, rl, ht, ru, width) {
echo("logo: ", logo);
echo(logo=logo);
if(logo == "") {
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])
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),
height=max(ru, rl),
thickness=width,
stretch_len=0,
tip_len=0,
@ -116,27 +125,27 @@ module logo(logo, rl, ht, ru, width) {
} 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])
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)
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])
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");
*/
@ -144,8 +153,8 @@ 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]) {
e = 100; // should be big enough, used for the outer boundary of the text/logo
rotate([0, 0, -45]) {
// main cylinder
if (RENDER_COLOR_ONE) {
color("black") difference() {
@ -157,12 +166,12 @@ module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/o
}
cylinder(r1=rl+width/2, r2=ru+width/2, h=ht);
}
translate([0,0,-1])
translate([0, 0, -1])
cylinder(r1=rl, r2=ru, h=ht+2);
// finally, substract a cube as a gap so we can clip it to the bottle
// 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]);
translate([0, 0, -1])
cube([50, 50, 50]);
}
}
// text
@ -185,11 +194,11 @@ module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="c3cat", font="write/o
}
module outer_cutoff(rl, e, ru, ht, width) {
// outer cylinder which is substracted, so the text and the logo end
// 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])
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);