You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

150 lines
2.7 KiB

include <TargetPcb.scad>
include <config.scad>
// test values:
//wallTh = 1.2;
//noPcbPrev = true;
if (is_undef(noBodyPrev) || noBodyPrev == false) {
caseBodyDrilled();
}
// -------------------
module caseBody() {
caseBase();
caseWallsCut();
pcbBackings();
drillBoxes();
}
module caseBodyDrilled() {
difference() {
caseBody();
caseDrillVoids();
}
}
// --- base and walls ---
module caseBase() {
cube([caseW, caseD, baseH]);
}
module caseBack() {
translate([wallTh, 0, baseH])
rotate(90, [0,0,1])
cube([caseD, wallTh, caseH - baseH]);
}
module caseWallR() {
translate([wallTh, 0, baseH])
cube([caseW-wallTh*2, wallTh, caseH - baseH]);
}
module caseWallL() {
translate([wallTh, caseD-wallTh, baseH])
cube([caseW-wallTh*2, wallTh, caseH - baseH]);
}
module caseFront() {
translate([caseW, 0, baseH])
rotate(90, [0,0,1])
cube([caseD, wallTh, caseH - baseH]);
}
// --- cuts ---
module dcCut() {
dcCutD = wallTh*3;
translate([dcCutD/2 + caseW, wallTh + pcbD/2-dcCutW/2-0.3, pcbZ+dcCutBottomPad])
rotate(90, [0,0,1])
cube([dcCutW, dcCutD, dcCutH+eps]);
}
module caseWallRCut() {
translate([pcbBackMargin,
-eps,
baseH + pcbBottomMargin + 2])
cube([pcbRightTerminalCut, wallRCutD, wallRCutH]);
}
module caseWalls() {
caseBack();
caseWallR();
caseWallL();
caseFront();
}
module caseWallsCut() {
difference() {
caseWalls();
dcCut();
caseWallRCut();
}
}
// --- insides ---
module pcbBackings() {
// rigth
translate([backingX, wallTh, baseH]) {
cube([backingW, backingD, backingH]);
}
// left
translate([backingX,
caseD-pcbLeftMargin-backingD,
baseH]) {
cube([backingW, backingD+pcbLeftMargin-wallTh, backingH]);
}
// back
translate([wallTh, wallTh + pcbD/2-espBackingD/2, baseH]) {
cube([pcbBackBackingW, espBackingD, backingH]);
}
}
module drillTube(h) {
cylinder(h, d=drillBoxW);
}
module drillBox(h) {
// use center positioning for tube compatiblility
translate([-drillBoxW/2, -drillBoxW/2, 0])
cube([drillBoxW, drillBoxW, h]);
}
module drillBoxes() {
translate(drillings[0]) {
drillBox(caseH-baseH);
}
translate(drillings[1]) {
drillBox(caseH-baseH);
}
}
// --- drillings ---
module drillVoid(h) {
cylinder(h, d=printedDrillD, $fn=drillFn);
}
module caseDrillVoids() {
translate(drillings[0]) {
drillVoid(caseH*1.5);
}
translate(drillings[1]) {
drillVoid(caseH*1.5);
}
translate(drillings[2]) {
drillVoid(caseH*0.5);
}
}