108 lines
4.2 KiB
OpenSCAD
108 lines
4.2 KiB
OpenSCAD
//-----------------------------------------------------------------------
|
|
// Speaker enclosure - 4cm x 5cm x 10cm exterior, 4.5cm speaker opening
|
|
// Built with YAPP_Box (YAPPgenerator_v3.scad)
|
|
//-----------------------------------------------------------------------
|
|
include <./YAPPgenerator_v3.scad>
|
|
|
|
printBaseShell = true;
|
|
printLidShell = true;
|
|
|
|
// Reference "PCB" - there's no real PCB here, this block just defines
|
|
// the box's internal footprint. Exterior = pcbLength/pcbWidth + 2*wallThickness
|
|
// (padding = 0), so: 36 + 2*2 = 40mm, 46 + 2*2 = 50mm.
|
|
pcbLength = 40; // X axis (front-to-back) -> 4cm exterior
|
|
pcbWidth = 50; // Y axis (side-to-side) -> 5cm exterior
|
|
pcbThickness = 1.6;
|
|
standoffHeight = 0;
|
|
standoffDiameter = 0;
|
|
standoffPinDiameter = 0;
|
|
|
|
pcb = [
|
|
["Main", pcbLength, pcbWidth, 0, 0, pcbThickness,
|
|
standoffHeight, standoffDiameter, standoffPinDiameter, 0.4]
|
|
];
|
|
|
|
paddingFront = 0;
|
|
paddingBack = 0;
|
|
paddingRight = 0;
|
|
paddingLeft = 0;
|
|
|
|
wallThickness = 2.0;
|
|
basePlaneThickness = 2.0;
|
|
lidPlaneThickness = 2.0;
|
|
|
|
// Total exterior height = basePlaneThickness + baseWallHeight
|
|
// + lidWallHeight + lidPlaneThickness
|
|
// = 2 + 86 + 10 + 2 = 100mm (10cm)
|
|
baseWallHeight = 86;
|
|
lidWallHeight = 10;
|
|
|
|
ridgeHeight = 5.0;
|
|
roundRadius = 3.0;
|
|
|
|
//---------------------------------------------------------------
|
|
// Speaker cutout - centered on the Front face (the 5cm x 10cm face)
|
|
// Front face local coords (yappCoordBox, corner-referenced):
|
|
// p(0) = position from the Left edge (Y axis)
|
|
// p(1) = position from the Bottom edge (Z axis)
|
|
// A 45mm circle centered at Y=25, Z=50 has its bounding-box corner at:
|
|
// p1 = 50 - 22.5 = 27.5
|
|
//---------------------------------------------------------------
|
|
cutoutsFront = [
|
|
[2.5, 2.5, 0, 0, 22.5, yappCircle]
|
|
];
|
|
|
|
cutoutsLid = [
|
|
[7, 14, 0, 0, 0.25*25.4, yappCircle],
|
|
[25, 35, 0, 0, 0.125*25.4, yappCircle],
|
|
];
|
|
|
|
//---------------------------------------------------------------
|
|
// Angled speaker-retaining wall
|
|
// A near-vertical rib that rises 30mm from the front-bottom of
|
|
// the base and leans slightly back toward the box centre. Its
|
|
// speaker-facing surface sits 15mm behind the front (speaker)
|
|
// wall at the floor and 17.5mm behind it at the top, so it
|
|
// backstops the speaker and holds it against the speaker hole.
|
|
//---------------------------------------------------------------
|
|
frontInnerX = shellInsideLength + wallThickness; // X of inner front-wall face
|
|
retainGapBot = 15; // mm behind the front wall at the floor
|
|
retainGapTop = 17.5; // mm behind the front wall at the top
|
|
retainHeight = 30; // rib height above the base floor
|
|
retainThick = 2.4; // rib wall thickness
|
|
retainWidth = 40; // Y span (a little wider than the speaker)
|
|
retainYc = 27; // Y centre (matches the speaker cutout)
|
|
retainFoot = 10; // how far the base flares back toward centre
|
|
retainFootH = 14; // height over which the flare tapers back in
|
|
|
|
module speakerRetainer()
|
|
{
|
|
xBot = frontInnerX - retainGapBot;
|
|
xTop = frontInnerX - retainGapTop;
|
|
zBot = basePlaneThickness;
|
|
zTop = basePlaneThickness + retainHeight;
|
|
|
|
// hookBaseInside() origin sits at the inner corner:
|
|
// global = hookCoord + [wallThickness, wallThickness, basePlaneThickness]
|
|
// X grows toward the speaker hole; the flared foot extends the other
|
|
// way (toward box centre) so it never touches the speaker. Each layer
|
|
// sits fully on the one below it, so it prints without support.
|
|
translate([-wallThickness, -wallThickness, -basePlaneThickness])
|
|
translate([0, retainYc + retainWidth/2, 0])
|
|
rotate([90, 0, 0])
|
|
linear_extrude(height = retainWidth)
|
|
polygon([[xBot + retainThick, zBot], // front face, floor
|
|
[xBot - retainFoot, zBot], // flared foot toe
|
|
[xTop, zBot + retainFootH], // foot tapers into back face
|
|
[xTop, zTop], // back face, top
|
|
[xTop + retainThick, zTop]]); // front face, top
|
|
}
|
|
|
|
module hookBaseInside()
|
|
{
|
|
speakerRetainer();
|
|
}
|
|
|
|
showOrientation = true;
|
|
YAPPgenerate();
|