Add cat ears
This commit is contained in:
parent
0763961823
commit
febf25566d
3 changed files with 61 additions and 35 deletions
|
@ -26,6 +26,10 @@ on:
|
|||
- pixel-cats/spooked-right.svg
|
||||
- pixel-cats/standing-left.svg
|
||||
- pixel-cats/standing-right.svg
|
||||
ears:
|
||||
description: 'Cat Ears'
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
|
||||
|
@ -47,6 +51,7 @@ jobs:
|
|||
env:
|
||||
LABEL: "${{ inputs.label }}"
|
||||
ICON: "${{ inputs.icon }}"
|
||||
EARS: "${{ inputs.ears }}"
|
||||
|
||||
- name: Render to STL
|
||||
run: openscad --export-format binstl -o bottle-clip.stl ci.scad
|
||||
|
|
|
@ -58,50 +58,71 @@ module multicolor(color) {
|
|||
* text_color: The color of the text
|
||||
* 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",
|
||||
bg_color="DEFAULT", text_color="DEFAULT", logo_color="DEFAULT") {
|
||||
|
||||
e=100; // should be big enough, used for the outer boundary of the text/logo
|
||||
|
||||
difference() {
|
||||
rotate([0,0,-45]) union() {
|
||||
// main cylinder
|
||||
multicolor(bg_color) cylinder(r1=rl+width, r2=ru+width, h=ht);
|
||||
// text and logo
|
||||
if(logo == "") {
|
||||
multicolor(text_color) writecylinder(name, [0,0,3], rl+0.5, ht/13*7, h=ht/13*8, t=max(rl,ru),
|
||||
font=font);
|
||||
} else {
|
||||
multicolor(text_color) writecylinder(name, [0,0,0], rl+0.5, ht/13*7, h=ht/13*4, t=max(rl,ru),
|
||||
font=font);
|
||||
multicolor(logo_color) translate([0,0,ht*3/4-0.1])
|
||||
rotate([90,0,0])
|
||||
scale([ht/100,ht/100,1])
|
||||
translate([-25,-25,0.5])
|
||||
linear_extrude(height=max(ru,rl)*2)
|
||||
import(logo);
|
||||
union() {
|
||||
difference() {
|
||||
rotate([0,0,-45]) union() {
|
||||
// main cylinder
|
||||
multicolor(bg_color) cylinder(r1=rl+width, r2=ru+width, h=ht);
|
||||
// text and logo
|
||||
if(logo == "") {
|
||||
multicolor(text_color) writecylinder(name, [0,0,3], rl+0.5, ht/13*7, h=ht/13*8, t=max(rl,ru),
|
||||
font=font);
|
||||
} else {
|
||||
multicolor(text_color) writecylinder(name, [0,0,0], rl+0.5, ht/13*7, h=ht/13*4, t=max(rl,ru),
|
||||
font=font);
|
||||
multicolor(logo_color) translate([0,0,ht*3/4-0.1])
|
||||
rotate([90,0,0])
|
||||
scale([ht/100,ht/100,1])
|
||||
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
|
||||
translate([0,0,-1])
|
||||
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]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
include <bottle-clip.scad>
|
||||
|
||||
bottle_clip(name="$LABEL", logo="$ICON");
|
||||
bottle_clip(name="$LABEL", logo="$ICON", ears=$EARS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue