-
Notifications
You must be signed in to change notification settings - Fork 0
/
hulls.scad
146 lines (127 loc) · 3.78 KB
/
hulls.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
$incolor = 1;
$knob = 0;
$cases = 1;
$boards = 0;
$alpha = 0.5;
$mounts = 0;
depth = 70;
width = 90;
height = 50;
bottom_height = 15;
thickness = 1.5;
radius = 2;
bottom_height = 15;
lod = 64;
$fs = 0.01;
module case_envelope(depth, width, radius) {
roundedcube([depth, width, 90], false, radius=radius, "z");
}
module case_bottom() {
intersection() {
difference() {
case_envelope(depth, width, radius);
translate([thickness, thickness, thickness])
case_envelope(depth-thickness*2, width-thickness*2, radius/thickness);
}
cube([depth, width, bottom_height]);
}
}
module top_lcd_cutout() {
translate([14.4,10.5,-thickness/2])
roundedcube([61, 14.4, thickness*2], radius=2);
}
module top_button_panel() {
cube([depth+20, width, thickness]);
}
module fillet(r) {
offset(r = -r) {
offset(delta = r) {
children();
}
}
}
module case_assembly() {
// top section
intersection() {
case_envelope(depth, width, radius);
union() {
translate([0,0,57])
rotate([0,45,0])
top_lcd_panel();
translate([0,0,34])
rotate([0,15,0])
top_button_panel();
}
}
case_bottom();
}
module base_outline() {
union() {
fillet(-radius)
fillet(radius)
polygon([[0,0], [0,20], [40,30], [60,50], [70,50], [70,0], [0,0]]);
square([depth, 10]);
}
}
module side_section() {
rotate([90,0,0])
linear_extrude(width)
difference() {
base_outline();
offset(-thickness) base_outline();
}
}
module outer_case_hull(width, depth, segments, thickness, radius) {
union()
for(s = segments)
hull()
for(
{
hull()
for(x = [0: width-radius*2: width])
translate([x+radius, 0, 0])
for(pos = [[0,0], [0,20], [35,30], [35,0]])
translate([0, pos[0]+radius, pos[1]+radius])
sphere(radius);
hull()
for(x = [0: width-radius*2: width])
translate([x+radius, 0, 0])
for(pos = [[35,30], [55,50], [depth-radius*2,50], [depth-radius*2,0], [35,0]])
translate([0, pos[0]+radius, pos[1]+radius])
sphere(radius);
roundedcube([width, depth, 10], false, radius=radius, "z");
}
}
outer_case_hull(width, depth, [
[[0,0], [0,20], [35,30], [35,0], [35,30], [55,50]],
[[depth-radius*2,50], [depth-radius*2,0], [35,0]]], thickness, radius);
module inner_case_hull() {
union() {
hull()
for(x = [thickness: width-radius-thickness*2: width])
translate([x+radius/2, 0, 0])
for(pos = [[0,0], [0,20-thickness/2], [35,30-thickness/2], [35,0]])
translate([0, pos[0]+radius/2+thickness, pos[1]+radius/2+thickness])
sphere(radius/2);
hull()
for(x = [thickness: width-radius-thickness*2: width])
translate([x+radius/2, 0, 0])
for(pos = [[35,30-thickness/2], [55,50-thickness/2], [depth-radius*2-thickness/2,50-thickness/2], [depth-radius*2-thickness/2,0], [35,0]])
translate([0, pos[0]+radius/2+thickness, pos[1]+radius/2+thickness])
sphere(radius/2);
}
}
module case_hull() {
difference() {
difference() {
outer_case_hull();
inner_case_hull();
}
}
}
module case_bottom() {
intersection() {
case_hull();
cube([width, depth, bottom_height]);
}
}