Skip to content

Commit a015267

Browse files
committed
done except for screw head size
1 parent 9ad1f66 commit a015267

File tree

1 file changed

+101
-11
lines changed

1 file changed

+101
-11
lines changed

mainbox.scad

Lines changed: 101 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ use <roundedsquare.scad>;
22
use <tubemesh.scad>;
33
use <certamenbutton.scad>;
44

5+
DEMO = 0;
6+
TOP = 1;
7+
BOTTOM = 2;
8+
9+
mode = TOP;
10+
511
// TODO:
612
// cut up
713
// screw wells for joining halves
814

9-
includeBoards = true;
15+
visualizeBoards = mode == DEMO;
1016
megaWidth = 53.34;
1117
megaLength = 101.6;
1218
megaHoles = [
@@ -56,7 +62,10 @@ speakerMountThickness = 1.5;
5662
grilleSolidWidth = 2;
5763
grilleHoleWidth = 2.5;
5864

59-
corner = 9; // corner-boardDivider must allow room for the speaker
65+
alignerThickness = 1+fitTolerance;
66+
alignerHeight = 4;
67+
68+
corner = 9; // must allow room for the speaker, as well as for the screw wells
6069

6170
pcbHolderThickness = 2;
6271
pcbHolderHeight = underPCBs+pcbThickness+2;
@@ -86,8 +95,10 @@ speakerDiameter1 = speakerDiameter + 2 * fitTolerance;
8695

8796
screwTolerance = 0.125;
8897
screwHoleSize = 2.6;
98+
maxScrewLength = 10;
8999
screwHoleSize1 = screwHoleSize + 2*screwTolerance;
90100
screwPillarSize = 12;
101+
screwHeadSize = 6; // TODO
91102

92103
speakerY = 0.5*insideLength;
93104
speakerX = boxWidth-corner-2*sideWallThickness;
@@ -115,7 +126,7 @@ module speakerGrille() {
115126
for (y=[-r:grilleSolidWidth+grilleHoleWidth:r]) {
116127
y1 = y+grilleHoleWidth/2;
117128
h = sqrt(r*r-y1*y1);
118-
translate([0, y, -h])
129+
translate([-nudge, y, -h])
119130
cube([sideWallThickness+2*nudge, grilleHoleWidth, 2*h]);
120131
}
121132
}
@@ -175,7 +186,7 @@ module pcbScrews(x,y,positions) {
175186
}
176187

177188
module box(height=boxHeight,inset=0) {
178-
linear_extrude(height=height) translate([-corner-sideWallThickness+inset,-sideWallThickness+inset]) roundedSquare([boxWidth-2*inset, boxLength-2*inset], radius=corner-inset);
189+
linear_extrude(height=height) translate([-corner-sideWallThickness+inset,-sideWallThickness+inset]) roundedSquare([boxWidth-2*inset, boxLength-2*inset], radius=corner-inset,$fn=36);
179190
}
180191

181192
module screenScrew(holeOnly=false) {
@@ -207,6 +218,7 @@ module shell() {
207218
screenScrews(holeOnly=true);
208219
translate([0,-sideWallThickness-nudge,0]) vent();
209220
translate([0,insideLength-nudge,0]) vent();
221+
joinScrewPillars(holeOnly=true);
210222
}
211223
}
212224

@@ -233,18 +245,96 @@ module vent() {
233245
translate([ventX-ventWidth/2,-nudge,ventZ-ventHeight/2])
234246
for (x=[0:2*ventSpacing:ventWidth]) {
235247
translate([x,0,0])
236-
cube([ventSpacing,2*nudge+sideWallThickness,ventHeight]);
248+
cube([ventSpacing,4*nudge+sideWallThickness,ventHeight]);
237249
}
238250
}
239251

252+
module joinScrewPillar(holeOnly=false) {
253+
$fn = 16;
254+
render(convexity=2)
255+
difference() {
256+
if(!holeOnly) translate([0,0,-bottomThickness]) cylinder(d=corner,h=bottomThickness+2*nudge+topZ);
257+
union() {
258+
cylinder(d=screwHoleSize1,h=maxScrewLength+cutLine);
259+
cylinder(d=screwHoleSize1+1,h=cutLine);
260+
translate([0,0,-bottomThickness-nudge])
261+
cylinder(d=screwHeadSize+2*fitTolerance,h=cutLine-2+bottomThickness);
262+
}
263+
}
264+
}
265+
266+
module joinScrewPillars(holeOnly=false) {
267+
module pair() {
268+
translate([-corner/2-sideWallThickness,0,0]) joinScrewPillar(holeOnly=holeOnly);
269+
translate([insideWidth+corner/2+sideWallThickness,0,0]) joinScrewPillar(holeOnly=holeOnly);
270+
}
271+
translate([0,corner*2,0]) pair();
272+
translate([0,insideLength-corner*2,0]) pair();
273+
}
240274

241-
module inside() {
275+
module whole() {
242276
boardMounts();
243277
screenScrews();
244-
%shell();
245-
if (includeBoards) contents(visualize=true);
278+
shell();
279+
if (visualizeBoards) contents(visualize=true);
280+
speakerMount();
281+
joinScrewPillars();
282+
}
283+
284+
module alignerPillar() {
285+
$fn=36;
286+
render(convexity=4)
287+
intersection() {
288+
difference() {
289+
union() {
290+
translate([0,0,cutLine]) cylinder(r=corner, h=topZ-cutLine+nudge);
291+
translate([0,0,cutLine-alignerHeight]) cylinder(r=corner-sideWallThickness-fitTolerance, h=alignerHeight+topZ-cutLine+nudge);
292+
}
293+
translate([0,0,cutLine-alignerHeight-nudge]) cylinder(r=corner-sideWallThickness-fitTolerance-alignerThickness, h=alignerHeight+topZ-cutLine+nudge);
294+
}
295+
translate([-corner, -corner, cutLine-alignerHeight-nudge])
296+
cube([corner,corner,alignerHeight+topZ-cutLine+nudge]);
297+
}
298+
}
299+
300+
module alignerPillars() {
301+
translate([-sideWallThickness,corner-sideWallThickness,0])
302+
alignerPillar();
303+
translate([insideWidth+sideWallThickness,corner-sideWallThickness,0])
304+
rotate([0,0,90])
305+
alignerPillar();
306+
translate([-sideWallThickness,insideLength-corner+sideWallThickness,0])
307+
rotate([0,0,-90])
308+
alignerPillar();
309+
translate([insideWidth+sideWallThickness,insideLength-corner+sideWallThickness,0])
310+
rotate([0,0,180])
311+
alignerPillar();
312+
}
313+
314+
module lowerHalf() {
315+
render(convexity=5)
316+
intersection() {
317+
whole();
318+
translate([-20,-20,-20]) cube([boxWidth+40,boxLength+40,cutLine+20]);
319+
}
320+
}
321+
322+
module upperHalf() {
323+
rotate([180,0,0])
324+
render(convexity=5) {
325+
intersection() {
326+
whole();
327+
translate([-20,-20,cutLine]) cube([boxWidth+40,boxLength+40,topThickness+topZ-cutLine+20]);
328+
}
329+
alignerPillars();
330+
}
331+
}
332+
333+
module demo() {
334+
whole();
335+
alignerPillars();
246336
}
247337

248-
%shell();
249-
inside();
250-
speakerMount();
338+
if (mode == TOP) upperHalf();
339+
else if (mode == BOTTOM) lowerHalf();
340+
else demo();

0 commit comments

Comments
 (0)