-
-
Notifications
You must be signed in to change notification settings - Fork 268
/
flap_container.scad
200 lines (164 loc) · 6.26 KB
/
flap_container.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*
Copyright 2020 Scott Bezek and the splitflap contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
include <../flap_dimensions.scad>
use <../splitflap.scad>
use <../flap.scad>
num_flaps = 40;
containers_x = 1;
containers_y = 1;
flap_thickness_allowance = 1.1 - flap_thickness; // fudged, so all flaps are considered 1.1 mm thick
cavity_top_allowance = 2; // extra case height above the flaps
flap_clearance = 0.5; // distance between the flap edges and the case walls
wall_thickness = 3.5; // thickness of the case walls around the flaps
bottom_thickness = 5.0; // thickness of the bottom of the case, below the flaps
thumb_hole_diameter = 20.0; // diameter for the thumb hole at the bottom of the case
pinch_cutout_width = 25.0; // width of the 'pinch' opening for grabbing flaps
pinch_cutout_offset = 12.5; // offset from the bottom of the pinch hole to the bottom of the cavity
band_slot_diameter = 10.0; // diameter of the slot for the retaining band
band_slot_depth = 2.5; // depth of the retaining band slot, measured from the base to the peak
fillet_case_corners = 3.0; // bottom outside corner fillet
fillet_flap_notch = 1.0; // inside of flap notches, in cavity
fillet_pinch_top = 5.0; // at the top of the case, where the pinch cutout starts
fillet_thumb_hole = 1.0; // 3D fillet on the top inside of the thumb hole
// Calculated Values
eps = 0.01; // extra distance for through geometry
cavity_height = num_flaps * (flap_thickness + flap_thickness_allowance) + cavity_top_allowance;
case_height = bottom_thickness + cavity_height;
case_width = flap_width + flap_clearance * 2 + wall_thickness * 2;
case_length = flap_height + flap_clearance * 2 + wall_thickness * 2;
pinch_cutout_height = cavity_height - pinch_cutout_offset; // total height of the cutout
pinch_cutout_top_offset = case_height - cavity_height + pinch_cutout_offset + pinch_cutout_width/2; // top of the case to the center of the pinch cutout circle
module fillet_tool(radius) {
difference() {
translate([-eps, -eps])
square(radius + eps);
translate([radius, radius, 0])
circle(r=radius, $fn=100);
}
}
module flap_position() {
translate([-flap_width/2, -(flap_height - flap_pin_width)/2, 0])
children();
}
module case_body() {
linear_extrude(height = case_height)
flap_position() {
difference() {
diff = wall_thickness + flap_clearance;
offset(delta = diff)
flap_2d(cut_tabs = false);
translate([0, -flap_pin_width/2]) { // re-centering on bottom edge
// bottom left corner fillet
translate([-diff, -diff])
fillet_tool(fillet_case_corners);
// bottom right corner fillet
translate([-diff + case_width, -diff])
mirror([1, 0, 0])
fillet_tool(fillet_case_corners);
}
}
}
}
module flap_cavity() {
module notch_fillet() {
mirror([1,0,0])
translate([flap_clearance - flap_notch_depth, flap_clearance + flap_pin_width/2])
intersection() {
square([flap_notch_depth, flap_notch_height_default]); // limit to size of notch
fillet_tool(fillet_flap_notch);
}
}
module notch_top() {
mirror([0, 1, 0])
translate([0, -flap_pin_width - flap_notch_height_default])
children();
}
module notch_right() {
translate([flap_width, 0, 0])
mirror([1, 0, 0])
children();
}
translate([0, 0, case_height - cavity_height])
linear_extrude(height = cavity_height + eps)
flap_position() {
offset(delta = flap_clearance)
flap_2d();
// left, notch bottom
notch_fillet();
// left, notch top
notch_top()
notch_fillet();
// right, notch bottom
notch_right()
notch_fillet();
notch_right()
notch_top()
notch_fillet();
}
}
module thumb_hole() {
translate([0, 0, -eps])
linear_extrude(bottom_thickness + eps*2)
circle(r=thumb_hole_diameter/2, $fn=100);
}
module thumb_hole_fillet() {
translate([0, 0, bottom_thickness]) {
rotate_extrude($fn = 100)
translate([thumb_hole_diameter/2, 0, 0])
rotate([180, 0, 0])
fillet_tool(fillet_thumb_hole);
}
}
module pinch_hole() {
rotate([90, 0, 0])
translate([0, pinch_cutout_top_offset , -case_length/2 - eps])
linear_extrude(height=case_length + eps*2)
union() {
translate([-pinch_cutout_width/2, 0, 0])
square([pinch_cutout_width, pinch_cutout_height - pinch_cutout_width/2 + eps]);
circle(r=pinch_cutout_width/2, $fn=100);
// left top fillet
translate([-pinch_cutout_width/2, pinch_cutout_height - pinch_cutout_width/2,0])
mirror([1, 1, 0])
fillet_tool(fillet_pinch_top);
// right top fillet
translate([pinch_cutout_width/2, pinch_cutout_height - pinch_cutout_width/2,0])
mirror([0, 1, 0])
fillet_tool(fillet_pinch_top);
}
}
module band_slot() {
rotate([90, 0, 0])
translate([0, band_slot_depth - band_slot_diameter/2, -case_length/2 - eps])
linear_extrude(height=case_length + eps*2)
circle(r=band_slot_diameter/2, $fn=60);
}
module flap_container() {
difference() {
case_body();
flap_cavity();
thumb_hole();
thumb_hole_fillet();
pinch_hole();
band_slot();
}
}
union() {
for(x = [0 : containers_x - 1]) {
translate([x * (case_width - wall_thickness), 0])
for(y = [0 : containers_y - 1]) {
translate([0, y * (case_length - wall_thickness), 0])
flap_container();
}
}
}