-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrugged-box.scad
426 lines (391 loc) · 24.6 KB
/
rugged-box.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
/*
Parametric 3D print Rugged box
© 2010 by OK1HRA https://remoteqth.com/3d-rugged-box.php
Creative Commons BY-SA
-------------------------------------------------------------------
How to export .stl
After open change inputs parameters
- set arangeForPrint to 1
and press F5 for preview
.STL export press F6 and F7 (or menu /Design/Export as STL...)
How to export .dxf for lasercuter front panel
- set enableBOTinside to 1
- set arangeForPrint to 1
- set DXFexport to 1
- render [F6]
- menu File/Export/ExportDXF
----------------- Input parameter ---------------------------------*/
// inner sizes in mm
width = 116.4; // inner size mm
depth = 88.4; // inner size mm
thickness = 3.5; // [>3.5] box thickness mm
// top part
heightTOP = 22+8+27; // must be bigger than 4 x thickness variable
// bottom part
heightBOT = 22; // must be bigget than 7 x thickness variable
boltLength = 30; // length your bolt M3 in mm
widthCLIP = boltLength/2-0.6; // calculate by boltLength, do not change
widthCLIPsupport = boltLength/4; // calculate by boltLength, do not change
// diameter in mm of the bolt hole (conical holes for screw without nuts)
diameterCLIP = 3; // must be smaller than thickness variable
// for clips on both sides
disableHINGE = 0; // [0:1] by your prefer
enableTOPinside = 1; // [0:1] customize inside
enableBOTinside = 1; // [0:1] customize inside
arangeForPrint = 0; // [0:1] for render to print must be 1
DXFexport = 0; // [0:1] for .DXF export panel only
openingAngle = 120; // [0:220] for preview only
//-------------------------------------------------------------------
FrontPanelEmbedmentDepthTop = 8+27;
FrontPanelEmbedmentDepthBot = 2;
FrontPanelScrewDia = 3;
module TOPinside(){
fourSupport(FrontPanelScrewDia,heightTOP-FrontPanelEmbedmentDepthTop); // screw dia, height
}
module BOTinside(){
fourSupport(FrontPanelScrewDia,heightBOT-FrontPanelEmbedmentDepthBot); // screw dia, height
}
//-------------------------------------------------------------------
if(arangeForPrint==1){
if(DXFexport==1&&enableBOTinside==1){
// panel
projection(cut=true) translate([0,0,-FrontPanelEmbedmentDepthBot/2])
difference(){
layer(width,depth,thickness*4-0.4, thickness*4-0.4, FrontPanelEmbedmentDepthBot, thickness);
translate([width/2-2*thickness,-depth/2+2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
translate([-width/2+2*thickness,-depth/2+2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
translate([width/2-2*thickness,depth/2-2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
translate([-width/2+2*thickness,depth/2-2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
}
}else{
translate([-width/2-5*thickness-10,0,0]) SealingTrowel();
translate([width/2+5*thickness,0,0]) rotate([0,0,-90]) rotate([0,90,0]) translate([-width*0.25-widthCLIP/2,-depth/2-2.5*thickness+1.125*diameterCLIP,-thickness-heightBOT+5.0*thickness+(1.25*diameterCLIP)/2])
clip(width,depth,heightBOT,thickness, 0.5);
translate([width/2+5*thickness,15*thickness,0]) rotate([0,0,-90]) rotate([0,90,0]) translate([-width*0.25-widthCLIP/2,-depth/2-2.5*thickness+1.125*diameterCLIP,-thickness-heightBOT+5.0*thickness+(1.25*diameterCLIP)/2])
clip(width,depth,heightBOT,thickness, 0.5);
if(disableHINGE ==1){
translate([0,-30*thickness,0]){
translate([width/2+5*thickness,0,0]) rotate([0,0,-90]) rotate([0,90,0]) translate([-width*0.25-widthCLIP/2,-depth/2-2.5*thickness+1.125*diameterCLIP,-thickness-heightBOT+5.0*thickness+(1.25*diameterCLIP)/2])
clip(width,depth,heightBOT,thickness, 0.5);
translate([width/2+5*thickness,15*thickness,0]) rotate([0,0,-90]) rotate([0,90,0]) translate([-width*0.25-widthCLIP/2,-depth/2-2.5*thickness+1.125*diameterCLIP,-thickness-heightBOT+5.0*thickness+(1.25*diameterCLIP)/2])
clip(width,depth,heightBOT,thickness, 0.5);
}
}
translate([0,-depth-10*thickness,0])
box(width,depth,heightTOP,thickness,1);
box(width,depth,heightBOT,thickness,0);
}
}else{
difference(){
union(){
if(enableBOTinside==1){
// panel
% translate([0,depth/2+3.5*thickness,-FrontPanelEmbedmentDepthBot])
difference(){
layer(width,depth,thickness*4-0.4, thickness*4-0.4, FrontPanelEmbedmentDepthBot, thickness);
translate([width/2-2*thickness,-depth/2+2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
translate([-width/2+2*thickness,-depth/2+2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
translate([width/2-2*thickness,depth/2-2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
translate([-width/2+2*thickness,depth/2-2*thickness,-0.1]) cylinder(h=FrontPanelEmbedmentDepthBot+0.2, d=FrontPanelScrewDia+0.2, center=false, $fn=60);
}
}
% translate([width/2+1.0*thickness, depth/2+2*thickness,0]) rotate([60,0,0]) SealingTrowel();
rotate([openingAngle,0,0]) translate([0,depth/2+3.5*thickness,-thickness-heightBOT]) clip(width,depth,heightBOT,thickness, 0.5);
rotate([openingAngle,0,0]) translate([-width/2,depth/2+3.5*thickness,-thickness-heightBOT]) clip(width,depth,heightBOT,thickness, 0.5);
if(disableHINGE ==1){
rotate([openingAngle,0,0]) translate([0,depth/2+3.5*thickness,-thickness-heightBOT]) mirror([0,1,0]) clip(width,depth,heightBOT,thickness, 0.5);
rotate([openingAngle,0,0]) translate([-width/2,depth/2+3.5*thickness,-thickness-heightBOT]) mirror([0,1,0]) clip(width,depth,heightBOT,thickness, 0.5);
}
rotate([openingAngle,0,0]) translate([0,depth/2+3.5*thickness,-thickness-heightBOT])
translate([0,0,2*thickness+heightTOP+heightBOT+0]) mirror([0,0,1])
box(width,depth,heightTOP,thickness,1);
translate([0,depth/2+3.5*thickness,-thickness-heightBOT]) box(width,depth,heightBOT,thickness,0);
}
// -1/2
// translate([-width,depth/2,-heightBOT-2*thickness]) cube([width*2, depth*2, (heightTOP+heightBOT)*2]);
}
}
module SealingTrowel(){
hull(){
translate([0,20,0]) cylinder(h=4, d=20, $fn=60);
translate([-5,0,0]) cube([10, 1, 2],center=false);
}
rotate([-90,0,0])
//# translate([width/2+1.0*thickness, depth/2+2*thickness,0])
translate([0,-0.5,-thickness])
difference(){
intersection() {
hull(){
translate([0, thickness, 0]) cylinder(h=1*thickness, d1=thickness*0.5, d2=thickness*1, center=false, $fn=30);
translate([0, -thickness, 0]) cylinder(h=1*thickness, d1=thickness*0.5, d2=thickness*1, center=false, $fn=30);
}
cube([thickness*1.5, 1, thickness*3],center=true);
}
cube([thickness*1.5, 1.1, thickness+0.1*2],center=true);
}
}
module clip(XX,YY,ZZ,WALL,hump){
difference(){
union(){
translate([XX*0.25,YY/2+2*WALL,WALL+ZZ+3.5*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP, d=3.5*diameterCLIP, center=true, $fn=160);
hull(){
translate([XX*0.25, YY/2+2*WALL+1.125*diameterCLIP, WALL+ZZ+3.5*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP, d=1.25*diameterCLIP, center=true, $fn=60);
translate([XX*0.25, YY/2+2*WALL+1.125*diameterCLIP, WALL+ZZ-3.0*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP, d=1.25*diameterCLIP, center=true, $fn=60);
}
hull(){
translate([XX*0.25, YY/2+2*WALL+1.125*diameterCLIP, WALL+ZZ-3.0*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP, d=1.25*diameterCLIP, center=true, $fn=60);
translate([XX*0.25, YY/2+2.5*WALL+1.125*diameterCLIP, WALL+ZZ-5.0*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP, d=1.25*diameterCLIP, center=true, $fn=60);
}
translate([XX*0.25,YY/2+2*WALL,WALL+ZZ-3.0*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP, d=3.5*diameterCLIP, center=true, $fn=160);
}
// -
translate([XX*0.25,YY/2+2*WALL,WALL+ZZ+3.5*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP+0.4, center=true, $fn=60);
hull(){
translate([XX*0.25,YY/2+2*WALL,WALL+ZZ]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
translate([XX*0.25,YY/2+2*WALL,WALL+ZZ-3.0*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
}
hull(){
translate([XX*0.25,YY/2+2*WALL-3.5/6*diameterCLIP,WALL+ZZ-3.0*WALL+hump]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
translate([XX*0.25,YY/2+2*WALL,WALL+ZZ-3.0*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
}
hull(){
translate([XX*0.25,YY/2+2*WALL-3.5/6*diameterCLIP,WALL+ZZ-3.0*WALL+hump]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
translate([XX*0.25,YY/2+2*WALL-3.5/2*diameterCLIP,WALL+ZZ-3.0*WALL-hump]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
}
hull(){
translate([XX*0.25,YY/2+2*WALL-3.5/2*diameterCLIP,WALL+ZZ-3.0*WALL-hump-diameterCLIP/2]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
translate([XX*0.25,YY/2+2*WALL-3.5/2*diameterCLIP,WALL+ZZ-3.0*WALL-hump-diameterCLIP]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=diameterCLIP, center=true, $fn=60);
}
translate([XX*0.25,YY/2+2*WALL-3.5/2*diameterCLIP,WALL+ZZ-3.0*WALL+3.5/2*diameterCLIP]) rotate([0,90,0]) cylinder(h=widthCLIP+0.4, d=3.5*diameterCLIP, center=true, $fn=60);
}
}
module box(XX,YY,ZZ,WALL,TOP){
// outside
difference(){
union(){
translate([0,0,WALL+ZZ-2*WALL]) layer(XX,YY,WALL*8, WALL*8, 2*WALL, WALL);
translate([0,0,WALL+ZZ-3*WALL]) layer(XX,YY,WALL*6, WALL*8, WALL, WALL);
translate([0,0,WALL]) layer(XX,YY,WALL*6, WALL*6, ZZ-3*WALL, WALL);
translate([0,0,0]) layer(XX,YY,WALL*4, WALL*4+2*WALL, WALL, WALL);
// clip support YY
hull(){
translate([0,0.25*YY,WALL+ZZ/2]) cube([XX+4*WALL,2*WALL,ZZ], center=true);
translate([0,0.25*YY,WALL/2]) cube([XX+2*WALL,2*WALL,WALL], center=true);
}
hull(){
translate([0,-0.25*YY,WALL+ZZ/2]) cube([XX+4*WALL,2*WALL,ZZ], center=true);
translate([0,-0.25*YY,WALL/2]) cube([XX+2*WALL,2*WALL,WALL], center=true);
}
// clip support XX
translate([XX*0.25+widthCLIP/2+widthCLIPsupport/2+0.3,0,0]) clipSupport(YY,ZZ,WALL,TOP,widthCLIPsupport,0);
translate([XX*0.25-widthCLIP/2-widthCLIPsupport/2-0.3,0,0]) clipSupport(YY,ZZ,WALL,TOP,widthCLIPsupport,1);
if(TOP==1 &&disableHINGE==0 ){
translate([XX*0.25,0,0]) difference(){
hull(){
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=widthCLIP, d=3*WALL, center=true, $fn=60);
translate([0,-YY/2-2*WALL,WALL+ZZ-WALL]) cube([widthCLIP,0.1,2*WALL], center=true);
// translate([0,-YY/2,WALL+ZZ-3.5*WALL]) cube([widthCLIP+0.4,2*WALL,WALL], center=true);
}
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=widthCLIP+1, d=diameterCLIP+0.2, center=true, $fn=30);
}
translate([-XX*0.25,0,0]) difference(){
hull(){
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=widthCLIP, d=3*WALL, center=true, $fn=60);
translate([0,-YY/2-2*WALL,WALL+ZZ-WALL]) cube([widthCLIP,0.1,2*WALL], center=true);
// translate([0,-YY/2,WALL+ZZ-3.5*WALL]) cube([widthCLIP+0.4,2*WALL,WALL], center=true);
}
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=widthCLIP+1, d=diameterCLIP+0.2, center=true, $fn=30);
}
}
translate([-XX*0.25+widthCLIP/2+widthCLIPsupport/2+0.3,0,0]) clipSupport(YY,ZZ,WALL,TOP,widthCLIPsupport,2);
translate([-XX*0.25-widthCLIP/2-widthCLIPsupport/2-0.3,0,0]) clipSupport(YY,ZZ,WALL,TOP,widthCLIPsupport,0);
}
// - inside
if(TOP==0){
difference(){
translate([0,0,WALL+ZZ-1.0*WALL]) layer(XX,YY,WALL*6.5, WALL*7, 1*WALL+0.1, WALL);
translate([0,0,WALL+ZZ-1.0*WALL]) layer(XX,YY,WALL*5.5, WALL*5, 1*WALL+0.1, WALL);
}
}else{
translate([XX*0.25,YY/2+2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP+0.6, d=3.5*diameterCLIP+2, center=true, $fn=60);
translate([-XX*0.25,YY/2+2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP+0.6, d=3.5*diameterCLIP+2, center=true, $fn=60);
if(disableHINGE==1){
translate([XX*0.25,-YY/2-2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP+0.6, d=3.5*diameterCLIP+2, center=true, $fn=60);
translate([-XX*0.25,-YY/2-2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=widthCLIP+0.6, d=3.5*diameterCLIP+2, center=true, $fn=60);
}
}
translate([0,0,WALL]) layer(XX,YY,WALL*4, WALL*4, ZZ+1, WALL);
rotate([0,0,180]) translate([0,0,0.85*WALL]){
linear_extrude(height = 3, center = false, convexity = 5, twist = -0, slices = 20, scale = 1.0) {
text(str(width,"x",depth,"x",heightTOP+heightBOT,"|",thickness," mm"), font = "Sans Uralic:style=Bold", halign="center", size=width/16);
}
}
}
if(TOP==1){
difference(){
translate([0,0,WALL+ZZ]) layer(XX,YY,WALL*7, WALL*6.5, 0.5*WALL, WALL);
translate([0,0,WALL+ZZ-0.01]) layer(XX,YY,WALL*5, WALL*5.5, 0.5*WALL+0.02, WALL);
}
if(enableTOPinside==1){
TOPinside();
}
}else{
if(enableBOTinside==1){
BOTinside();
}
}
}
module clipSupport(YY,ZZ,WALL,TOP,WIDTH,HOLEPOS){
difference(){
union(){
hull(){
translate([0,YY/2+2*WALL,WALL+ZZ-1.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH, d=3*WALL, center=true, $fn=60);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-1.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH, d=3*WALL, center=true, $fn=60);
}
if(TOP==1){
translate([0,YY/2+2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH, d=3*WALL, center=true, $fn=60);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH, d=3*WALL, center=true, $fn=60);
}
}else{
translate([0,YY/2+2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH, d=3*WALL, center=true, $fn=60);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH, d=3*WALL, center=true, $fn=60);
}
}
if(TOP==0){
translate([0,0,WALL+ZZ-6*WALL]) cube([WIDTH,YY+4*WALL,1], center=true);
}else{
if(heightTOP>6.1*WALL){
translate([0,0,WALL+ZZ-6*WALL]) cube([WIDTH,YY+4*WALL,1], center=true);
}else{
if(disableHINGE==1){
translate([0,0,0.5]) cube([WIDTH,YY+4*WALL,1], center=true);
}else{
translate([0,0.5*WALL,0.5]) cube([WIDTH,YY+3*WALL,1], center=true);
}
}
}
}
if(TOP==0 &&disableHINGE==0 ){
hull(){
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=WIDTH, d=3*WALL, center=true, $fn=60);
translate([0,-YY/2-2*WALL,WALL+ZZ-1.5*WALL]) cube([WIDTH,0.1,3*WALL], center=true);
}
}
hull(){
translate([0,0,WALL+ZZ/2]) cube([WIDTH,YY+4*WALL,ZZ], center=true);
translate([0,0,WALL/2]) cube([WIDTH,YY+2*WALL,WALL], center=true);
}
}
// -
if(TOP==1){
// HOLEPOS defines the orientation conical holes for screw without nuts
if(HOLEPOS==1){
translate([0,YY/2+2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d1=diameterCLIP-0.4, d2=diameterCLIP+0.2, center=true, $fn=30);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d1=diameterCLIP-0.4, d2=diameterCLIP+0.2, center=true, $fn=30);
}
}else if(HOLEPOS==2){
translate([0,YY/2+2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d2=diameterCLIP-0.4, d1=diameterCLIP+0.2, center=true, $fn=30);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d2=diameterCLIP-0.4, d1=diameterCLIP+0.2, center=true, $fn=30);
}
}else{
translate([0,YY/2+2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d=diameterCLIP+0.2, center=true, $fn=30);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3.5*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d=diameterCLIP+0.2, center=true, $fn=30);
}
}
}else{
if(HOLEPOS==1){
translate([0,YY/2+2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d1=diameterCLIP-0.4, d2=diameterCLIP+0.2, center=true, $fn=30);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d1=diameterCLIP-0.4, d2=diameterCLIP+0.2, center=true, $fn=30);
}
}else if(HOLEPOS==2){
translate([0,YY/2+2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d2=diameterCLIP-0.4, d1=diameterCLIP+0.2, center=true, $fn=30);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d2=diameterCLIP-0.4, d1=diameterCLIP+0.2, center=true, $fn=30);
}
}else{
translate([0,YY/2+2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d=diameterCLIP+0.2, center=true, $fn=30);
if(disableHINGE==1){
translate([0,-YY/2-2*WALL,WALL+ZZ-3*WALL]) rotate([0,90,0]) cylinder(h=WIDTH+1, d=diameterCLIP+0.2, center=true, $fn=30);
}
}
}
if(HOLEPOS==1 &&disableHINGE==0 ){
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=WIDTH+1, d1=diameterCLIP-0.4, d2=diameterCLIP+0.2, center=true, $fn=30);
}else if(HOLEPOS==2){
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=WIDTH+1, d2=diameterCLIP-0.4, d1=diameterCLIP+0.2, center=true, $fn=30);
}else{
translate([0,-YY/2-3.5*WALL-0*diameterCLIP,WALL+ZZ]) rotate([0,90,0]) cylinder(h=WIDTH+1, d=diameterCLIP+0.2, center=true, $fn=30);
}
}
}
module layer(XX,YY,D1,D2,ZZ,WALL){
hull(){
translate([XX/2-2*WALL,YY/2-2*WALL,0]) cylinder(h=ZZ, d1=D1, d2=D2, center=false, $fn=60);
translate([-XX/2+2*WALL,YY/2-2*WALL,0]) cylinder(h=ZZ, d1=D1, d2=D2, center=false, $fn=60);
translate([XX/2-2*WALL,-YY/2+2*WALL,0]) cylinder(h=ZZ, d1=D1, d2=D2, center=false, $fn=60);
translate([-XX/2+2*WALL,-YY/2+2*WALL,0]) cylinder(h=ZZ, d1=D1, d2=D2, center=false, $fn=60);
}
}
module fourSupport(SCREWDIA,ZZ){
difference(){
// four support
union(){
difference(){
union(){
hull(){
translate([width/2-2*thickness,depth/2-2*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
translate([width/2-1*thickness,depth/2-1*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
}
hull(){
translate([width/2-2*thickness,-depth/2+2*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
translate([width/2-1*thickness,-depth/2+1*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
}
hull(){
translate([-width/2+2*thickness,depth/2-2*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
translate([-width/2+1*thickness,depth/2-1*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
}
hull(){
translate([-width/2+2*thickness,-depth/2+2*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
translate([-width/2+1*thickness,-depth/2+1*thickness,thickness]) cylinder(h=ZZ, d=3*thickness, center=false, $fn=60);
}
}
translate([width/2-2*thickness,depth/2-2*thickness,thickness+0.1]) cylinder(h=ZZ, d=SCREWDIA-0.3, center=false, $fn=60);
translate([width/2-2*thickness,depth/2-2*thickness,thickness+ZZ-4.9]) cylinder(h=5, d1=SCREWDIA-0.3, d2=SCREWDIA+0.2, center=false, $fn=60);
translate([width/2-2*thickness,-depth/2+2*thickness,thickness+0.1]) cylinder(h=ZZ, d=SCREWDIA-0.3, center=false, $fn=60);
translate([width/2-2*thickness,-depth/2+2*thickness,thickness+0.1]) cylinder(h=5, d1=SCREWDIA-0.3, d2=SCREWDIA+0.2, center=false, $fn=60);
translate([-width/2+2*thickness,depth/2-2*thickness,thickness+0.1]) cylinder(h=ZZ, d=SCREWDIA-0.3, center=false, $fn=60);
translate([-width/2+2*thickness,depth/2-2*thickness,thickness+0.1]) cylinder(h=5, d1=SCREWDIA-0.3, d2=SCREWDIA+0.2, center=false, $fn=60);
translate([-width/2+2*thickness,-depth/2+2*thickness,thickness+0.1]) cylinder(h=ZZ, d=SCREWDIA-0.3, center=false, $fn=60);
translate([-width/2+2*thickness,-depth/2+2*thickness,thickness+0.1]) cylinder(h=5, d1=SCREWDIA-0.3, d2=SCREWDIA+0.2, center=false, $fn=60);
}
}
difference(){
translate([0,0,thickness+heightBOT-1.0*thickness]) layer(width,depth,thickness*6.5, thickness*7, 1*thickness+0.1, thickness);
translate([0,0,thickness+heightBOT-1.0*thickness]) layer(width,depth,thickness*5.5, thickness*5, 1*thickness+0.1, thickness);
}
// bevel support
A=width/2-3*thickness;
B=depth/2-3*thickness;
C=sqrt( pow(A,2) + pow(B,2) );
D=width/2-0.5*thickness;
E=depth/2-0.5*thickness;
F=sqrt( pow(D,2) + pow(E,2) );
translate([0,0,thickness]) cylinder(h=ZZ+0.1,d1=2*F,d2=2*C, $fn=400);
}
// center support
difference(){
translate([-5,depth/2,thickness+ZZ]) rotate([180,0,0]) cube([10,thickness,10],center=false);
translate([-6,depth/2-thickness,thickness+ZZ]) rotate([180+20,0,0]) cube([12,thickness*1.5,12],center=false);
}
mirror([0,1,0]) difference(){
translate([-5,depth/2,thickness+ZZ]) rotate([180,0,0]) cube([10,thickness,10],center=false);
translate([-6,depth/2-thickness,thickness+ZZ]) rotate([180+20,0,0]) cube([12,thickness*1.5,12],center=false);
}
}