improve tray part

This commit is contained in:
zhao
2023-08-26 17:23:53 -04:00
parent cd9a29848e
commit a717ef15e8
56 changed files with 125 additions and 72 deletions

View File

@ -10,10 +10,10 @@ _profileConfigs = [
["numRailScrews", 10] ["numRailScrews", 10]
]], ]],
*/ */
["default", [ ["default", [ // Default config. Will be overwritten by any other profiles
["maxUnitWidth", 180], ["maxUnitWidth", 180],
["maxUnitDepth", 180], ["maxUnitDepth", 180],
["numRailScrews", 18], ["numRailScrews", 12],
["screwDiff", 10], ["screwDiff", 10],
["mainRailScrewType", "m4"], ["mainRailScrewType", "m4"],
["mainRailSideMountScrewType", "m4"], ["mainRailSideMountScrewType", "m4"],

View File

@ -32,6 +32,10 @@ m4HoleRadiusSlack = 0.15;
m4Diameter = 4.0; m4Diameter = 4.0;
m4Radius = m4Diameter / 2.0; m4Radius = m4Diameter / 2.0;
m4RadiusSlacked = m4Radius + m4HoleRadiusSlack; m4RadiusSlacked = m4Radius + m4HoleRadiusSlack;
m4CounterSunkHeadRadius = 4;
m4CounterSunkHeadLength = 2.3;
m4HexNutWidthAcrossFlats = 6.89; m4HexNutWidthAcrossFlats = 6.89;
m4HexNutWidthAcrossCorners = FtoG(m4HexNutWidthAcrossFlats); m4HexNutWidthAcrossCorners = FtoG(m4HexNutWidthAcrossFlats);
m4HexNutThickness = 3.07; m4HexNutThickness = 3.07;
@ -81,7 +85,7 @@ function hexNutThickness(screwType) =
module counterSunkHead_N(screwType, screwExtension=0, headExtension=0) { module counterSunkHead_N(screwType, screwExtension=0, headExtension=0) {
if (screwType == "m3") { if (screwType == "m3") {
translate(v=[0,0,-m3CounterSunkHeadLength]) translate(v = [0, 0, -m3CounterSunkHeadLength])
union() { union() {
cylinder(r1 = m3RadiusSlacked, r2 = m3CounterSunkHeadRadius, h = m3CounterSunkHeadLength); cylinder(r1 = m3RadiusSlacked, r2 = m3CounterSunkHeadRadius, h = m3CounterSunkHeadLength);
@ -91,6 +95,17 @@ module counterSunkHead_N(screwType, screwExtension=0, headExtension=0) {
translate(v = [0, 0, m3CounterSunkHeadLength]) translate(v = [0, 0, m3CounterSunkHeadLength])
cylinder(r = m3CounterSunkHeadRadius, h = headExtension); cylinder(r = m3CounterSunkHeadRadius, h = headExtension);
} }
} else if (screwType == "m4") {
translate(v = [0, 0, -m4CounterSunkHeadLength])
union() {
cylinder(r1 = m4RadiusSlacked, r2 = m4CounterSunkHeadRadius, h = m4CounterSunkHeadLength);
translate(v = [0, 0, -screwExtension])
cylinder(r = m4RadiusSlacked, h = screwExtension);
translate(v = [0, 0, m4CounterSunkHeadLength])
cylinder(r = m4CounterSunkHeadRadius, h = headExtension);
}
} else { } else {
error("Unsupported screw type"); error("Unsupported screw type");
} }

View File

@ -5,6 +5,8 @@ include <./common.scad>
echo("Vertical distance between 2 main rail holes: ", screwDiff); echo("Vertical distance between 2 main rail holes: ", screwDiff);
echo("Horizontal distance between 2 opposing main rail holes: ", rackMountScrewWidth); echo("Horizontal distance between 2 opposing main rail holes: ", rackMountScrewWidth);
echo("Distance between main rail screw, and main rail inner edge:", railScrewHoleToInnerEdge);
echo("Max supported rack-mount width: ", maxUnitWidth); echo("Max supported rack-mount width: ", maxUnitWidth);
echo("Max recommended rack-mount depth: ", maxUnitDepth); echo("Max recommended rack-mount depth: ", maxUnitDepth);

View File

@ -1,20 +1,55 @@
use <../tray.scad> use <../tray.scad>
// Config variables /*
trayWidth = 140; Parametric rack-mount tray -
trayDepth = 88; Dimensions can be adjusted using the variables below. You can also add mounting holes to fasten things that have
trayThickness = 3; screw holes at the bottom.
trayLipThickness = 3;
pointHoleRadius = screwRadiusSlacked("m3"); !!! Please also make sure that the correct rack frame preset is set in rackFrame.scad !!!
pointHoleThickness = 2; */
pointMountElevation = 1;
mountPoints = [ // [x,y,elevation,holeRadius,holeThickness] // begin config ////////////////////////////////////////////////////////////////////////////////////////////////////////
[(27.5),34, pointMountElevation, pointHoleRadius, pointHoleThickness],
[(27.5)+79.5,34, pointMountElevation, pointHoleRadius, pointHoleThickness] trayU = 2;
baseWidth = 145;
baseDepth = 100;
baseThickness = 3; // tray bottom thickness
frontThickness = 3; // front plate thickness
sideThickness = 3;
backLipHeight = 2;
frontLipHeight = 2;
sideSupport = true;
trayLeftPadding = 10; // extra space between the left rail and tray. configure this to move the tray left/right.
mountPointType = "m3";
mountPointElevation = 1; // basically standoff height
// add/config standoff coordinates here. Format is [[x,y]]
mountPoints = [
[30,10],
[30+75,10],
[30,10+75],
[30+75,10+75],
]; ];
// end config //////////////////////////////////////////////////////////////////////////////////////////////////////////
mountScrewType = "m3";
// Rack mount tray that supports screws on the bottom of the rack-mount item bottomScrewTray(
bottomScrewTray(u=1, trayWidth=trayWidth, trayDepth=trayDepth, trayThickness=trayThickness, mountPoints=mountPoints, mountScrewType=mountScrewType, lipThickness=trayLipThickness); u=trayU,
trayWidth=baseWidth,
trayDepth=baseDepth,
trayThickness=baseThickness,
frontLipHeight=frontLipHeight,
backLipHeight=backLipHeight,
mountPoints=mountPoints,
frontThickness=frontThickness,
sideThickness=sideThickness,
mountPointElevation=mountPointElevation,
mountPointType=mountPointType,
sideSupport=sideSupport,
trayLeftPadding=trayLeftPadding
);

View File

@ -3,9 +3,20 @@ include <./common.scad>
// Rack ear modules. // Rack ear modules.
// To be used either by itself if the item supports it, or within another module // To be used either by itself if the item supports it, or within another module
rackEarModule(frontThickness=3,sideThickness=3,frontWidth=30, sideDepth=50, u=4, support=true); rackEarModule(u=4, frontThickness=3, sideThickness=3, frontWidth=20, sideDepth=50, backPlaneHeight, support=true);
module rackEarModule(frontThickness, sideThickness, frontWidth, sideDepth, u, backPlaneHeight=3, support=true) { module rackEarModule(
u,
frontThickness,
sideThickness,
frontWidth,
sideDepth,
backPlaneHeight,
support=true
) {
// check frontWidth is wide enough
assert(frontWidth-sideThickness >= rackMountScrewXDist+railScrewHoleToInnerEdge);
earHeight = u*uDiff + 2*rackMountScrewZDist; earHeight = u*uDiff + 2*rackMountScrewZDist;
@ -23,9 +34,13 @@ module rackEarModule(frontThickness, sideThickness, frontWidth, sideDepth, u, ba
} }
if (support) { if (support) {
defaultExtraSpacing = 1;
extraSpacing = frontWidth-(rackMountScrewXDist+railScrewHoleToInnerEdge+sideThickness) > defaultExtraSpacing
? defaultExtraSpacing
: 0; // don't include extra spacing for support, if tray itself is too large
hull() { hull() {
extraSpacing = 1; translate(v= [rackMountScrewXDist+railScrewHoleToInnerEdge+extraSpacing,frontThickness,0])
translate(v= [rackMountScrewXDist+railScrewHoleToOuterEdge+extraSpacing,frontThickness,0])
cube(size = [sideThickness, eps, earHeight]); cube(size = [sideThickness, eps, earHeight]);
backSegmentPlane(); backSegmentPlane();
@ -43,10 +58,10 @@ module rackEarModule(frontThickness, sideThickness, frontWidth, sideDepth, u, ba
module rackMountHoles() { module rackMountHoles() {
rotate(a=[90,0,0]) rotate(a=[90,0,0])
cylinder(r=screwRadiusSlacked(mainRailScrewType), h=frontThickness*2, center=true); cylinder(r=screwRadiusSlacked(mainRailScrewType), h=inf, center=true);
translate(v=[0,0,u*uDiff]) translate(v=[0,0,u*uDiff])
rotate(a=[90,0,0]) rotate(a=[90,0,0])
cylinder(r=screwRadiusSlacked(mainRailScrewType), h=frontThickness*2, center=true); cylinder(r=screwRadiusSlacked(mainRailScrewType), h=inf, center=true);
} }
} }

View File

@ -1,14 +1,16 @@
include <./common.scad> include <./common.scad>
use <./rackEars.scad> use <./rackEars.scad>
/*
Parametric rack-mount tray -
Please see print/tray_P.scad for configuring/printing
module bottomScrewTray(u, trayWidth, trayDepth, trayThickness, mountPoints, mountScrewType, lipThickness=3) { Please also make sure that the correct rack frame preset is set in rackFrame.scad.
*/
frontLipHeight = 2; module bottomScrewTray(u, trayWidth, trayDepth, trayThickness, mountPoints, mountPointElevation, mountPointType, frontThickness, sideThickness, frontLipHeight, backLipHeight, trayLeftPadding, sideSupport=true) {
backLipHeight = 1; // also applies to sides
rackEarSideThickness = 3; lipThickness = sideThickness;
rackEarFrontThickness = 3;
screwDx = rackMountScrewWidth; // x dist between the mount holes screwDx = rackMountScrewWidth; // x dist between the mount holes
screwDz = uDiff * u; screwDz = uDiff * u;
@ -16,82 +18,66 @@ module bottomScrewTray(u, trayWidth, trayDepth, trayThickness, mountPoints, moun
plateLength = screwDx + 2*rackMountScrewXDist; plateLength = screwDx + 2*rackMountScrewXDist;
plateHeight = screwDz + 2*rackMountScrewZDist; plateHeight = screwDz + 2*rackMountScrewZDist;
minScrewToTraySpacing = 8; minScrewToTraySpacing = railScrewHoleToInnerEdge;
// TODO: toggle this based on left/right/middle alignment leftScrewDistToTray = minScrewToTraySpacing + trayLeftPadding;
leftScrewDistToTray = minScrewToTraySpacing + 2 + 10;
leftScrewGlobalX = -leftScrewDistToTray; leftScrewGlobalX = -leftScrewDistToTray;
rightScrewGlobalX = screwDx + leftScrewGlobalX; rightScrewGlobalX = screwDx + leftScrewGlobalX;
points=mountPoints; // check (tray width)+(configured extra space) fits within the rack
assert(trayWidth <= screwDx-(2*minScrewToTraySpacing + trayLeftPadding));
difference() { difference() {
applyMountHoles(points) applyMountHoles()
translate(v = [-rackEarSideThickness, -rackEarFrontThickness, -trayThickness]) translate(v = [-sideThickness, -frontThickness, -trayThickness])
body(); body();
// hack
*union() {
translate(v = [-20, 18, 15])
rotate(a = [0, 90, 0])
cylinder(r = 10, h = inf);
translate(v = [-20, 40, 13])
rotate(a = [0, 90, 0])
cylinder(r = 7, h = inf);
}
} }
module body() { module body() {
// base
cube(size = [trayWidth, trayDepth, trayThickness]); cube(size = [trayWidth, trayDepth, trayThickness]);
// front lip
translate(v = [0, 0, trayThickness]) translate(v = [0, 0, trayThickness])
cube(size = [trayWidth, lipThickness, frontLipHeight]); cube(size = [trayWidth, lipThickness, frontLipHeight]);
// back lip
translate(v = [0, trayDepth-lipThickness, trayThickness]) translate(v = [0, trayDepth-lipThickness, trayThickness])
cube(size = [trayWidth, lipThickness, backLipHeight]); cube(size = [trayWidth, lipThickness, backLipHeight]);
translate(v = [0, 0, trayThickness])
cube(size = [lipThickness, trayDepth, backLipHeight]);
translate(v = [trayWidth-lipThickness, 0, trayThickness])
cube(size = [lipThickness, trayDepth, backLipHeight]);
translate(v = [leftScrewGlobalX, 0, rackMountScrewZDist]) translate(v = [leftScrewGlobalX, 0, rackMountScrewZDist])
rackEarModule(frontThickness = rackEarFrontThickness, sideThickness = rackEarSideThickness, frontWidth = rackEarModule(frontThickness = frontThickness, sideThickness = sideThickness, frontWidth =
leftScrewDistToTray+rackMountScrewXDist+rackEarSideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight); leftScrewDistToTray+rackMountScrewXDist+sideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight, support=sideSupport);
translate(v = [rightScrewGlobalX, 0, rackMountScrewZDist]) translate(v = [rightScrewGlobalX, 0, rackMountScrewZDist])
mirror(v = [1, 0, 0]) mirror(v = [1, 0, 0])
rackEarModule(frontThickness = rackEarFrontThickness, sideThickness = rackEarSideThickness, frontWidth = rackEarModule(frontThickness = frontThickness, sideThickness = sideThickness, frontWidth =
rightScrewGlobalX-trayWidth+rackMountScrewXDist+rackEarSideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight); rightScrewGlobalX-trayWidth+rackMountScrewXDist+sideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight, support=sideSupport);
} }
module applyMountHoles(points) { module applyMountHoles() {
mountPointPosThickness = 2;
apply_pn() { apply_pn() {
for (i = [0:len(points)-1]) { for (i = [0:len(mountPoints)-1]) {
p = points[i]; x = mountPoints[i][0];
x = p[0]; y = mountPoints[i][1];
y = p[1];
elevation = p[2];
hR = p[3];
hT = p[4];
translate(v=[x, y, 0]) translate(v=[x, y, 0])
cylinder(r=hR+hT, h=elevation); cylinder(r=screwRadiusSlacked(mountPointType)+mountPointPosThickness, h=mountPointElevation);
} }
for (i = [0:len(points)-1]) {
p = points[i]; for (i = [0:len(mountPoints)-1]) {
x = p[0]; x = mountPoints[i][0];
y = p[1]; y = mountPoints[i][1];
hR = p[3];
hT = p[4]; translate(v=[x, y, -trayThickness])
translate(v=[x, y, 0]) mirror(v=[0,0,1])
cylinder(r=hR, h=inf50, center=true); counterSunkHead_N(mountPointType, inf, inf);
} }
children(0); children(0);
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File