parametrize screw/hex nut types
This commit is contained in:
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
||||
@ -23,10 +23,12 @@ screwDiff = 10;
|
||||
numRailScrews = 20;
|
||||
|
||||
// Screw type used for rackmount units. See screws.scad.
|
||||
railMainScrewType = "m4";
|
||||
mainRailScrewType = "m4";
|
||||
|
||||
// Screw type used to affix side rails.
|
||||
railSideMountScrewType = "m4";
|
||||
mainRailSideMountScrewType = "m4";
|
||||
|
||||
// Screw type used for constructing the actual rack frame.
|
||||
rackScrewType = "m3";
|
||||
rackFrameScrewType = "m3";
|
||||
// Currently, only m3 screws are supported here (tolerance issues)
|
||||
assert(rackFrameScrewType == "m3");
|
||||
|
||||
@ -1,7 +1,19 @@
|
||||
include <./config.scad>
|
||||
include <./screws.scad>
|
||||
|
||||
/* 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;
|
||||
|
||||
mainRail();
|
||||
echo("Total Rail Height = ", railTotalHeight);
|
||||
|
||||
module mainRail() {
|
||||
|
||||
// Distance between the middle of a screw mount and the rail's vertical edges
|
||||
|
||||
railScrewHoleToInnerEdge = 5;
|
||||
railScrewHoleToOuterEdge = 5;
|
||||
|
||||
@ -16,13 +28,6 @@ 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;
|
||||
@ -30,6 +35,25 @@ sideSupportDepth = sideSupportScrewHoleToBackEdge + sideSupportScrewHoleToFrontE
|
||||
|
||||
frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
module _frontRailSegment() {
|
||||
difference() {
|
||||
@ -38,7 +62,7 @@ module _frontRailSegment() {
|
||||
for (i = [1:numRailScrews]) {
|
||||
translate(v = [railScrewHoleToOuterEdge, railFrontThickness / 2, i * screwDiff + railFootThickness])
|
||||
rotate(a = [90, 0, 0])
|
||||
m4HexNutPocketNegative();
|
||||
hexNutPocket_N(mainRailScrewType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -51,11 +75,11 @@ module _connectingLBracketRailSegment() {
|
||||
union() {
|
||||
translate(v = [0, 4, railFootThickness + screwDiff / 2])
|
||||
rotate(a = [0, 90, 0])
|
||||
cylinder(r=m3RadiusSlacked, h = 10, $fn=32, center=true);
|
||||
cylinder(r = screwRadiusSlacked(rackFrameScrewType), 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);
|
||||
cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = 10, $fn = 32, center = true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +97,7 @@ module _sideSupportSegment() {
|
||||
for (i = [1:numRailScrews]) {
|
||||
translate(v = [sideSupportScrewHoleToFrontEdge, railFrontThickness / 2, i * screwDiff + railFootThickness])
|
||||
rotate(a = [90, 0, 0])
|
||||
cylinder(r=m4RadiusSlacked, h=10, $fn=32);
|
||||
cylinder(r = screwRadiusSlacked(mainRailSideMountScrewType), h = 10, $fn = 32);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,36 +110,12 @@ module _railFeet() {
|
||||
|
||||
hull() {
|
||||
translate(v = [1.5, 5, 0])
|
||||
cylinder(r = m3RadiusSlacked, h = 10, $fn = 32);
|
||||
cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = 10, $fn = 32);
|
||||
|
||||
translate(v = [0, 5, 0])
|
||||
cube(size=[0.1, m3RadiusSlacked*2, 10], center=true);
|
||||
cube(size = [0.1, screwRadiusSlacked(rackFrameScrewType) * 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);
|
||||
|
||||
@ -1,93 +1,55 @@
|
||||
/* Some common screw dimensions and helper functions/modules */
|
||||
|
||||
/* Some common screw dimensions */
|
||||
|
||||
|
||||
inf = 400; // basically infinity
|
||||
inf = 400;
|
||||
|
||||
/********************************************************************************/
|
||||
// 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,
|
||||
/********************************************************************************/
|
||||
function screwRadiusSlacked(screwType) =
|
||||
(screwType == "m3")
|
||||
? m3RadiusSlacked
|
||||
: (screwType == "m4")
|
||||
? m4RadiusSlacked
|
||||
: error("Unsupported screw type");
|
||||
|
||||
|
||||
module hexNutPocket_N(screwType) {
|
||||
if (screwType == "m3") {
|
||||
hexNutPocketHelper_N(m3RadiusSlacked,
|
||||
m3HexNutWidthAcrossCorners / 2 + 0.1,
|
||||
m3HexNutThickness + 0.2);
|
||||
} else if (screwType == "m4") {
|
||||
hexNutPocketHelper_N(m4RadiusSlacked,
|
||||
m4HexNutWidthAcrossCorners / 2 + 0.1,
|
||||
m4HexNutThickness + 0.2);
|
||||
} else {
|
||||
error("Unsupported screw type");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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(
|
||||
module hexNutPocketHelper_N(
|
||||
innerRadius,
|
||||
widthAcrossCorners,
|
||||
thickness)
|
||||
{
|
||||
|
||||
union() {
|
||||
|
||||
hull() {
|
||||
@ -111,3 +73,8 @@ module hexNutPocketNegative(
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user