Files
rackstack/rack/side/sideWallBase.scad
2023-03-05 12:24:59 -05:00

110 lines
2.8 KiB
OpenSCAD

include <../../helper/math.scad>
include <../../helper/halfspace.scad>
include <../../misc/magnet.scad>
include <../config.scad>
include <./sideWallMagnetMount.scad>
include <./sideWallVariables.scad>
include <../sharedVariables.scad>
include <./magnetModule.scad>
include <./hingeModule.scad>
echo("Side Wall Height", sideWallZ);
echo("Side Wall Depth", sideWallY);
*sideWallBase();
module sideWallBase() {
applyHingeConnector()
applyMagnetConnector()
applyHandle()
sideWallBase();
module sideWallBase() {
module roundThingHelper(x,y,z,r) {
translate(v=[r, r, 0])
minkowski() {
cube(size = [x-r, y - 2*r, z]);
sphere(r = r);
}
}
intersection() {
difference() {
roundThingHelper(sideWallX,sideWallY,sideWallZ, baseRoundness);
translate(v=[sideWallThickness, sideWallThickness,0])
roundThingHelper(sideWallX,sideWallY - 2*sideWallThickness, sideWallZ, baseRoundness);
}
halfspace(vpos=[-1,0,0], p=[sideWallX,0,0]);
halfspace(vpos=[0,0,-1], p=[0,0,sideWallZ]);
halfspace(vpos=[0,0,1], p=[0,0,0]);
}
}
module applyHingeConnector() {
hingeHoleShellR = hingeHoleR+1;
apply_pn() {
hull() {
hingeShell();
hingeBacksideProjectionPlane();
}
union() {
hingeHole();
// Trim parts of the wall for rotational clearance
halfspace(p=[sideWallX-5, sideWallY, 0], vpos=[1,1.5,0]);
}
children(0);
}
module hingeShell() {
translate(v = [sideWallX-hingePoleDx, sideWallY-(sideWallThickness+hingePoleDy), 0])
cylinder(r = hingeHoleShellR, h = sideWallZ);
}
// XZ plane in line with the back of the case. Project the hinge pole shell onto this to fill any weird
// geometries from the curves of the side wall
module hingeBacksideProjectionPlane() {
translate(v=[sideWallX-hingePoleDx - hingeHoleShellR,sideWallY,0])
cube(size=[2*hingeHoleShellR, eps, sideWallZ]);
}
module hingeHole() {
translate(v = [sideWallX-hingePoleDx, sideWallY-(sideWallThickness+hingePoleDy), 0])
cylinder(r = hingeHoleR, h = sideWallZ);
}
}
// TODO: add correct magnet translations, also remove random variables
module applyMagnetConnector() {
apply_p() {
union() {
translate(v = [sideWallThickness, magnetMountToYBarFront, magnetMountToYBarTop - sideWallZHingeTotalClearance])
sideWallMagnetMountRotated();
translate(v = [sideWallThickness, magnetMountToYBarFront, sideWallZ - (magnetMountToYBarTop- sideWallZHingeTotalClearance)])
sideWallMagnetMountRotated();
}
children(0);
}
module sideWallMagnetMountRotated() {
rotate(a=[0,90,0])
sideWallMagnetMount();
}
}
module applyHandle() {
children(0);
}
}