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

@ -5,6 +5,8 @@ include <./common.scad>
echo("Vertical distance between 2 main rail holes: ", screwDiff);
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 recommended rack-mount depth: ", maxUnitDepth);

View File

@ -1,20 +1,55 @@
use <../tray.scad>
// Config variables
trayWidth = 140;
trayDepth = 88;
trayThickness = 3;
trayLipThickness = 3;
/*
Parametric rack-mount tray -
Dimensions can be adjusted using the variables below. You can also add mounting holes to fasten things that have
screw holes at the bottom.
pointHoleRadius = screwRadiusSlacked("m3");
pointHoleThickness = 2;
pointMountElevation = 1;
mountPoints = [ // [x,y,elevation,holeRadius,holeThickness]
[(27.5),34, pointMountElevation, pointHoleRadius, pointHoleThickness],
[(27.5)+79.5,34, pointMountElevation, pointHoleRadius, pointHoleThickness]
!!! Please also make sure that the correct rack frame preset is set in rackFrame.scad !!!
*/
// begin config ////////////////////////////////////////////////////////////////////////////////////////////////////////
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(u=1, trayWidth=trayWidth, trayDepth=trayDepth, trayThickness=trayThickness, mountPoints=mountPoints, mountScrewType=mountScrewType, lipThickness=trayLipThickness);
bottomScrewTray(
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.
// 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;
@ -23,9 +34,13 @@ module rackEarModule(frontThickness, sideThickness, frontWidth, sideDepth, u, ba
}
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() {
extraSpacing = 1;
translate(v= [rackMountScrewXDist+railScrewHoleToOuterEdge+extraSpacing,frontThickness,0])
translate(v= [rackMountScrewXDist+railScrewHoleToInnerEdge+extraSpacing,frontThickness,0])
cube(size = [sideThickness, eps, earHeight]);
backSegmentPlane();
@ -43,10 +58,10 @@ module rackEarModule(frontThickness, sideThickness, frontWidth, sideDepth, u, ba
module rackMountHoles() {
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])
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>
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;
backLipHeight = 1; // also applies to sides
module bottomScrewTray(u, trayWidth, trayDepth, trayThickness, mountPoints, mountPointElevation, mountPointType, frontThickness, sideThickness, frontLipHeight, backLipHeight, trayLeftPadding, sideSupport=true) {
rackEarSideThickness = 3;
rackEarFrontThickness = 3;
lipThickness = sideThickness;
screwDx = rackMountScrewWidth; // x dist between the mount holes
screwDz = uDiff * u;
@ -16,82 +18,66 @@ module bottomScrewTray(u, trayWidth, trayDepth, trayThickness, mountPoints, moun
plateLength = screwDx + 2*rackMountScrewXDist;
plateHeight = screwDz + 2*rackMountScrewZDist;
minScrewToTraySpacing = 8;
minScrewToTraySpacing = railScrewHoleToInnerEdge;
// TODO: toggle this based on left/right/middle alignment
leftScrewDistToTray = minScrewToTraySpacing + 2 + 10;
leftScrewDistToTray = minScrewToTraySpacing + trayLeftPadding;
leftScrewGlobalX = -leftScrewDistToTray;
rightScrewGlobalX = screwDx + leftScrewGlobalX;
points=mountPoints;
// check (tray width)+(configured extra space) fits within the rack
assert(trayWidth <= screwDx-(2*minScrewToTraySpacing + trayLeftPadding));
difference() {
applyMountHoles(points)
translate(v = [-rackEarSideThickness, -rackEarFrontThickness, -trayThickness])
applyMountHoles()
translate(v = [-sideThickness, -frontThickness, -trayThickness])
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() {
// base
cube(size = [trayWidth, trayDepth, trayThickness]);
// front lip
translate(v = [0, 0, trayThickness])
cube(size = [trayWidth, lipThickness, frontLipHeight]);
// back lip
translate(v = [0, trayDepth-lipThickness, trayThickness])
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])
rackEarModule(frontThickness = rackEarFrontThickness, sideThickness = rackEarSideThickness, frontWidth =
leftScrewDistToTray+rackMountScrewXDist+rackEarSideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight);
rackEarModule(frontThickness = frontThickness, sideThickness = sideThickness, frontWidth =
leftScrewDistToTray+rackMountScrewXDist+sideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight, support=sideSupport);
translate(v = [rightScrewGlobalX, 0, rackMountScrewZDist])
mirror(v = [1, 0, 0])
rackEarModule(frontThickness = rackEarFrontThickness, sideThickness = rackEarSideThickness, frontWidth =
rightScrewGlobalX-trayWidth+rackMountScrewXDist+rackEarSideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight);
rackEarModule(frontThickness = frontThickness, sideThickness = sideThickness, frontWidth =
rightScrewGlobalX-trayWidth+rackMountScrewXDist+sideThickness, sideDepth = trayDepth-lipThickness, u = u, backPlaneHeight=trayThickness+backLipHeight, support=sideSupport);
}
module applyMountHoles(points) {
module applyMountHoles() {
mountPointPosThickness = 2;
apply_pn() {
for (i = [0:len(points)-1]) {
p = points[i];
x = p[0];
y = p[1];
elevation = p[2];
hR = p[3];
hT = p[4];
for (i = [0:len(mountPoints)-1]) {
x = mountPoints[i][0];
y = mountPoints[i][1];
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];
x = p[0];
y = p[1];
hR = p[3];
hT = p[4];
translate(v=[x, y, 0])
cylinder(r=hR, h=inf50, center=true);
for (i = [0:len(mountPoints)-1]) {
x = mountPoints[i][0];
y = mountPoints[i][1];
translate(v=[x, y, -trayThickness])
mirror(v=[0,0,1])
counterSunkHead_N(mountPointType, inf, inf);
}
children(0);
}