Add cat ears

This commit is contained in:
polyfloyd 2025-05-04 19:24:04 +02:00
parent 0763961823
commit febf25566d
3 changed files with 61 additions and 35 deletions

View file

@ -26,6 +26,10 @@ on:
- pixel-cats/spooked-right.svg - pixel-cats/spooked-right.svg
- pixel-cats/standing-left.svg - pixel-cats/standing-left.svg
- pixel-cats/standing-right.svg - pixel-cats/standing-right.svg
ears:
description: 'Cat Ears'
default: false
type: boolean
jobs: jobs:
@ -47,6 +51,7 @@ jobs:
env: env:
LABEL: "${{ inputs.label }}" LABEL: "${{ inputs.label }}"
ICON: "${{ inputs.icon }}" ICON: "${{ inputs.icon }}"
EARS: "${{ inputs.ears }}"
- name: Render to STL - name: Render to STL
run: openscad --export-format binstl -o bottle-clip.stl ci.scad run: openscad --export-format binstl -o bottle-clip.stl ci.scad

View file

@ -58,50 +58,71 @@ module multicolor(color) {
* text_color: The color of the text * text_color: The color of the text
* logo_color: The color of the logo * logo_color: The color of the logo
*/ */
module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="", gap=90, module bottle_clip(ru=13, rl=17.5, ht=26, width=2.5, name="", gap=90, ears=false,
logo="thing-logos/stratum0-lowres.dxf", font="write/orbitron.dxf", logo="thing-logos/stratum0-lowres.dxf", font="write/orbitron.dxf",
bg_color="DEFAULT", text_color="DEFAULT", logo_color="DEFAULT") { bg_color="DEFAULT", text_color="DEFAULT", logo_color="DEFAULT") {
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
difference() { difference() {
rotate([0,0,-45]) union() { union() {
// main cylinder difference() {
multicolor(bg_color) cylinder(r1=rl+width, r2=ru+width, h=ht); rotate([0,0,-45]) union() {
// text and logo // main cylinder
if(logo == "") { multicolor(bg_color) cylinder(r1=rl+width, r2=ru+width, h=ht);
multicolor(text_color) writecylinder(name, [0,0,3], rl+0.5, ht/13*7, h=ht/13*8, t=max(rl,ru), // text and logo
font=font); if(logo == "") {
} else { multicolor(text_color) writecylinder(name, [0,0,3], rl+0.5, ht/13*7, h=ht/13*8, t=max(rl,ru),
multicolor(text_color) writecylinder(name, [0,0,0], rl+0.5, ht/13*7, h=ht/13*4, t=max(rl,ru), font=font);
font=font); } else {
multicolor(logo_color) translate([0,0,ht*3/4-0.1]) multicolor(text_color) writecylinder(name, [0,0,0], rl+0.5, ht/13*7, h=ht/13*4, t=max(rl,ru),
rotate([90,0,0]) font=font);
scale([ht/100,ht/100,1]) multicolor(logo_color) translate([0,0,ht*3/4-0.1])
translate([-25,-25,0.5]) rotate([90,0,0])
linear_extrude(height=max(ru,rl)*2) scale([ht/100,ht/100,1])
import(logo); translate([-25,-25,0.5])
linear_extrude(height=max(ru,rl)*2)
import(logo);
}
}
// outer cylinder which is substracted, 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);
}
// finally, substract an equilateral triangle as a gap so we can clip it to
// the bottle
gap_x=50*sin(45-gap/2);
gap_y=50*cos(45-gap/2);
translate([0,0,-1])
linear_extrude(height=50)
polygon(points=[[0,0], [gap_x, gap_y], [50,50], [gap_y, gap_x]]);
}
// Cat ears!
if (ears) {
ear_size = 8;
rotate([0, 0, 45])
for (m = [0 : 1]) mirror([0, m, 0])
rotate([0, 0, -60])
translate([0, 0, ht-3])
rotate([0, -90, 0])
translate([0, 0, ru])
rotate([0, -30, 0])
// Ear solid
translate([0,0,-1])
linear_extrude(2)
polygon(points = [ [0, -ear_size], [0, ear_size], [ear_size*2, 1], [ear_size*2, -1] ]);
} }
} }
// inner cylinder which is substracted // inner cylinder which is substracted
translate([0,0,-1]) translate([0,0,-1])
cylinder(r1=rl, r2=ru, h=ht+2); cylinder(r1=rl, r2=ru, h=ht+2);
// outer cylinder which is substracted, 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);
}
// finally, substract an equilateral triangle as a gap so we can clip it to
// the bottle
gap_x=50*sin(45-gap/2);
gap_y=50*cos(45-gap/2);
translate([0,0,-1])
linear_extrude(height=50)
polygon(points=[[0,0], [gap_x, gap_y], [50,50], [gap_y, gap_x]]);
} }
} }

View file

@ -1,3 +1,3 @@
include <bottle-clip.scad> include <bottle-clip.scad>
bottle_clip(name="$LABEL", logo="$ICON"); bottle_clip(name="$LABEL", logo="$ICON", ears=$EARS);