-
Notifications
You must be signed in to change notification settings - Fork 0
/
ear-saver.scad
102 lines (82 loc) · 2.6 KB
/
ear-saver.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Result of some quick hackery.
// "I didn’t have time to write short code, so I wrote a long one."
$fs=1.2;
e=0.01;
twig_width=6;
center_offset=6;
bobble_diameter_extra=0;
bobble_radius=(twig_width+bobble_diameter_extra)/2;
inner_radius=0.6;
inner_hook=0.5;
arm_long=center_offset+2*bobble_radius+inner_radius;
module hook_punch(width=20) {
// Inside cavity
translate([inner_radius, center_offset+inner_hook, -e]) rotate([0, 0, 5]) cylinder(r=inner_radius+inner_hook, h=2, $fs=0.5);
hull() {
translate([inner_radius, center_offset-inner_radius, -e]) cube([e, (inner_radius+inner_hook)*2, 2]);
translate([twig_width, center_offset-inner_radius, -e]) cube([e, inner_radius*2, 2]);
}
}
module hook(width=20) {
hull() { // center-part
translate([twig_width, 0, 0]) cube([e, center_offset-inner_radius, 1]);
translate([width, 0, 0]) cube([e, center_offset, 1]);
}
intersection() { // large rounded end-piece
translate([-50, 0, 0]) cube([50, 50, 1]);
rr=1.2*arm_long;
dd=arm_long;
circle_translate=sqrt(rr*rr - dd*dd);
// Rotation for low-resolution adaption.
translate([circle_translate, 0, 0])
rotate([0, 0, 3]) cylinder(r=rr, h=1);
}
// Connect center with outside
cube([twig_width, arm_long, 1]);
// Extended bobble outside.
translate([twig_width, center_offset+inner_radius+bobble_radius, 0]) rotate([0, 0, 20]) cylinder(r=bobble_radius, h=1);
}
module hook_group(d=14, c=3) {
difference() {
translate([0, -e, 0]) for (i = [0:1:c-e]) {
translate([i*d, 0, 0]) hook(width=d);
}
translate([0, -e, 0]) for (i = [0:1:c-e]) {
translate([i*d, 0, 0]) hook_punch(width=d);
}
}
}
module double_hooks() {
projection(cut=true) {
hook_group();
scale([1, -1, 1]) hook_group();
}
}
module sector(radius, angles, fn = 180) {
r = radius / cos(180 / fn);
step = -360 / fn;
points = concat([[0, 0]],
[for(a = [angles[0] : step : angles[1] - 360])
[r * cos(a), r * sin(a)]
],
[[r * cos(angles[1]), r * sin(angles[1])]]
);
difference() {
circle(radius, $fn = fn);
polygon(points);
}
}
module arc(radius, angles, width = 1, fn = 720) {
difference() {
sector(radius + width, angles, fn);
sector(radius, angles, fn);
}
}
module half() {
angle=7;
rotate([0, 0, angle]) translate([-84, -2, 0]) double_hooks();
r2=360 * 40 / (2 * PI * angle);
translate([0, -r2-10.5, 0]) rotate([0, 0, 90]) arc(radius=r2, angles=[0, 7.15], width=12);
}
translate([e, 0, 0]) half();
scale([-1, 1, 1]) translate([e, 0, 0]) half();