This commit is contained in:
zhao
2022-12-31 13:56:54 -05:00
parent d81b129686
commit d0c89d13c6
40 changed files with 586 additions and 388 deletions

32
cases/rack2/config.scad Normal file
View File

@ -0,0 +1,32 @@
/*
case-files v2
This file contains parameters used for declaring/generating a customized rack frame.
- All dimensions are in millimetres (mm) unless stated otherwise.
- A "_N" appended to a module is meant to denote that this module is a negative volume, and should only be used to
substract from other volumes.
*/
// Maximum width for rackmount units. Change this according your max expected enclosure width.
// Changing this will directly affect the required build volume.
maxUnitWidth = 200;
// Maximum (recommended) unit depth. There technically isn't a max unit depth because there's no physical bound on
// how far a rack unit can extrude back. This parameter basically controls the distance between the front of the front
// rails and the back of the back rails. Changing this will directly affect the required build volume.
maxUnitDepth = 200;
// Vertical distance between the midpoint of adjacent screws mounts. Affects build volume.
screwDiff = 10;
// Number screw slots on the main rail. Affects build volume.
numRailScrews = 20;
// Screw type used for rackmount units. See screws.scad.
railMainScrewType = "m4";
// Screw type used to affix side rails.
railSideMountScrewType = "m4";
// Screw type used for constructing the actual rack frame.
rackScrewType = "m3";

121
cases/rack2/mainRail.scad Normal file
View File

@ -0,0 +1,121 @@
include <./config.scad>
include <./screws.scad>
// Distance between the middle of a screw mount and the rail's vertical edges
railScrewHoleToInnerEdge = 5;
railScrewHoleToOuterEdge = 5;
// Distance between the midpoint of the rail screw holes.
rackMountScrewWidth = maxUnitWidth + 2*railScrewHoleToInnerEdge;
railFrontThickness = 6; // Make sure that the nuts for the chosen screw type can slot within the front face
railSideMountThickness = 2.5;
railOtherThickness = 2.5;
// Extra spacing for the rack unit screws.
frontScrewSpacing = 8;
/* Small horizontal planes at the top and bottom of the main rails. Used so we can fasten the rail to the frame
Note that this value is also used for a depression at the bottom/top of the frame for aligning the rail */
railFootThickness = 3;
railTotalHeight = screwDiff * (numRailScrews+1) + 2*railFootThickness;
sideSupportExtraSpace = 2;
sideSupportScrewHoleToFrontEdge = 5;
sideSupportScrewHoleToBackEdge = 4.5;
sideSupportDepth = sideSupportScrewHoleToBackEdge + sideSupportScrewHoleToFrontEdge;
frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge;
module _frontRailSegment() {
difference() {
cube(size=[frontFaceWidth, railFrontThickness, railTotalHeight]);
for (i=[1:numRailScrews]) {
translate(v=[railScrewHoleToOuterEdge, railFrontThickness/2, i*screwDiff + railFootThickness])
rotate(a=[90,0,0])
m4HexNutPocketNegative();
}
}
}
module _connectingLBracketRailSegment() {
difference() {
cube(size = [railOtherThickness, frontScrewSpacing + railOtherThickness, railTotalHeight]);
union () {
translate(v=[0,4,railFootThickness + screwDiff / 2])
rotate(a=[0,90,0])
cylinder(r=m3RadiusSlacked, h = 10, $fn=32, center=true);
translate(v=[0,4,railTotalHeight-(railFootThickness + screwDiff / 2)])
rotate(a=[0,90,0])
cylinder(r=m3RadiusSlacked, h = 10, $fn=32, center=true);
}
}
translate(v=[0, frontScrewSpacing + railOtherThickness, 0])
rotate(a=[0,0,270])
cube(size=[railOtherThickness, frontFaceWidth - sideSupportExtraSpace, railTotalHeight]);
}
module _sideSupportSegment() {
difference() {
cube(size=[sideSupportDepth, railSideMountThickness, railTotalHeight]);
for (i=[1:numRailScrews]) {
translate(v=[sideSupportScrewHoleToFrontEdge, railFrontThickness/2, i*screwDiff + railFootThickness])
rotate(a=[90,0,0])
cylinder(r=m4RadiusSlacked, h=10, $fn=32);
}
}
}
module _railFeet() {
difference() {
cube(size = [frontFaceWidth - sideSupportExtraSpace, sideSupportDepth, railFootThickness]);
hull() {
translate(v = [1.5, 5, 0])
cylinder(r = m3RadiusSlacked, h = 10, $fn = 32);
translate(v = [0, 5, 0])
cube(size=[0.1, m3RadiusSlacked*2, 10], center=true);
}
}
}
module mainRail() {
union() {
_frontRailSegment();
translate(v = [0, railFrontThickness, 0])
_connectingLBracketRailSegment();
translate(v = [frontFaceWidth-sideSupportExtraSpace, railFrontThickness + railOtherThickness + frontScrewSpacing, 0])
rotate(a = [0, 0, 90])
_sideSupportSegment();
translate(v = [0, railFrontThickness + railOtherThickness + frontScrewSpacing, 0]) {
_railFeet();
translate(v = [0, 0, railTotalHeight-railFootThickness])
_railFeet();
}
}
}
mainRail();
echo("Total Rail Height = ", railTotalHeight);

BIN
cases/rack2/mainRail.stl Normal file

Binary file not shown.

113
cases/rack2/screws.scad Normal file
View File

@ -0,0 +1,113 @@
/* Some common screw dimensions */
inf = 400; // basically infinity
/********************************************************************************/
// M3 dimensions
m3HoleRadiusSlack = 0.15;
m3Diameter = 3.0;
m3Radius = m3Diameter/2.0;
m3RadiusSlacked = m3Radius + m3HoleRadiusSlack;
// legacy TODO: replace
m3ptr = m3RadiusSlacked;
// NUTS!
m3HexNutWidthAcrossFlats = 5.41;
m3HexNutWidthAcrossCorners = FtoG(m3HexNutWidthAcrossFlats);
m3HexNutThickness = 2.18;
module m3HexNutPocketNegative() {
hexNutPocketNegative(m3RadiusSlacked,
m3HexNutWidthAcrossCorners/2 + 0.1,
m3HexNutThickness + 0.2);
}
// TODO: remove test
*difference() {
cube(size=[8,12,5], center=true);
rotate(a=[0,0,20])
m3HexNutPocketNegative();
}
*m3HexNutPocketNegative();
/********************************************************************************/
// M4 dimensions
m4HoleRadiusSlack = 0.15;
m4Diameter = 4.0;
m4Radius = m4Diameter/2.0;
m4RadiusSlacked = m4Radius + m4HoleRadiusSlack;
m4HexNutWidthAcrossFlats = 6.89;
m4HexNutWidthAcrossCorners = FtoG(m4HexNutWidthAcrossFlats);
m4HexNutThickness = 3.07;
module m4HexNutPocketNegative() {
hexNutPocketNegative(m4RadiusSlacked,
m4HexNutWidthAcrossCorners/2 + 0.1,
m4HexNutThickness + 0.2);
}
// TODO: remove test
*difference() {
translate(v=[0,1,0])
cube(size=[10,12,6], center=true);
rotate(a=[0,0,20])
m4HexNutPocketNegative();
}
*m4HexNutPocketNegative();
/********************************************************************************/
// Convert a regular hexagon widthAcrossFlats to widthAcrossCorners
function FtoG(widthAcrossFlats) = widthAcrossFlats * (2/sqrt(3));
// Convert a regular hexagon widthAcrossCorners to widthAcrossFlats
function GtoF(widthAcrossCorners) = widthAcrossCorners * (sqrt(3)/2);
module hexNutPocketNegative(
innerRadius,
widthAcrossCorners,
thickness)
{
union() {
hull() {
// hexagonal cylinder representing where the nut should fit
cylinder(r=widthAcrossCorners, h=thickness, center=true, $fn=6);
// negative volume for sliding in the nut
translate(v=[inf,0,0])
cylinder(r=widthAcrossCorners, h=thickness, center=true, $fn=6);
}
// negative volume for screw lead
translate(v=[0,0,-10])
cylinder(r=innerRadius, h = inf, $fn=32);
hull() {
translate(v=[inf,0,0])
cylinder(r=innerRadius, h = inf, $fn=32);
cylinder(r=innerRadius, h = inf, $fn=32);
}
}
}