diff --git a/rack-mount/enclosed-box/boxHelper.scad b/rack-mount/enclosed-box/boxHelper.scad new file mode 100644 index 0000000..3ada72e --- /dev/null +++ b/rack-mount/enclosed-box/boxHelper.scad @@ -0,0 +1,53 @@ +include <../../rack/sharedVariables.scad> +include <../common.scad> + +use <../sideRail.scad> +use <../frontBoxHolder.scad> + +/* + (WIP) Enclosed box mounting system: + Helper file to use semi-enclosed side rails and a front plate to mount a box. + This system does not require any mounting holes for the enclosed box. + + !!! Please also make sure that the correct rack frame preset is set in rackFrame.scad !!! +*/ + +// begin config //////////////////////////////////////////////////////////////////////////////////////////////////////// + +boxWidth = 160; +boxHeight = 27; +boxDepth = 100; + + +railDefaultThickness = 1.2; + +zOrientation = "middle"; + +// Does not affect any part dimensions. Set this to true to visualize how a box wound be mounted. +visualize = true; + +// end config ////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#cube(size=[boxWidth, boxDepth, boxHeight]); + +sideSupportRailBase(top=true, defaultThickness=railDefaultThickness, supportedZ=boxHeight, supportedY=boxDepth, supportedX=boxWidth, zOrientation=zOrientation); + +translate(v=[boxWidth,0,0]) +mirror(v=[1,0,0]) +sideSupportRailBase(top=true, defaultThickness=railDefaultThickness, supportedZ=boxHeight, supportedY=boxDepth, supportedX=boxWidth, zOrientation=zOrientation); + +translate(v=[0,0,10]) +rotate(a=[-90,0,0]) +*frontBoxHolder( +u=2, +plateThickness=3, +cutoutOffsetX=(rackMountScrewWidth-147)/2, +cutoutOffsetY=4.25, +cutoutX=147, +cutoutY=21.5, +support=true, +supportedZ=boxHeight, +supportWidth=120, +supportDepth=5, +supportRailBaseThickness=1.75 +); diff --git a/rack-mount/print/sideSupportRail_P1.scad b/rack-mount/print/sideSupportRail_P1.scad index 65c8aac..7708a6c 100644 --- a/rack-mount/print/sideSupportRail_P1.scad +++ b/rack-mount/print/sideSupportRail_P1.scad @@ -1,3 +1,3 @@ use <../sideRail.scad> -sideSupportRailBase(u=2, double=true, top=true, baseThickness=1.5, sideThickness=4, backThickness=2, supportedZ=27.2, supportedY=101.5, supportedX=159); \ No newline at end of file +sideSupportRailBase(top=true, defaultThickness=1.4, supportedZ=27.2, supportedY=101.5, supportedX=159); \ No newline at end of file diff --git a/rack-mount/print/sideSupportRail_P2.scad b/rack-mount/print/sideSupportRail_P2.scad index 366ab2d..3236205 100644 --- a/rack-mount/print/sideSupportRail_P2.scad +++ b/rack-mount/print/sideSupportRail_P2.scad @@ -1,4 +1,4 @@ use <../sideRail.scad> mirror(v=[1,0,0]) -sideSupportRailBase(u=2, double=true, top=true, baseThickness=1.5, sideThickness=4, backThickness=2, supportedZ=27.2, supportedY=101.5, supportedX=159); \ No newline at end of file +sideSupportRailBase(top=true, defaultThickness=1.4, supportedZ=27.2, supportedY=101.5, supportedX=159); \ No newline at end of file diff --git a/rack-mount/print/tray_P.scad b/rack-mount/print/tray_P.scad index 3e4adee..34b3327 100644 --- a/rack-mount/print/tray_P.scad +++ b/rack-mount/print/tray_P.scad @@ -1,7 +1,7 @@ use <../tray.scad> /* - Parametric rack-mount tray - + 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. diff --git a/rack-mount/sideRail.scad b/rack-mount/sideRail.scad index 4dd2416..1feeb5c 100644 --- a/rack-mount/sideRail.scad +++ b/rack-mount/sideRail.scad @@ -3,115 +3,144 @@ include <../config/common.scad> include <../rack/sharedVariables.scad> include <./common.scad> -sideSupportRailBase(u=2, double=true, top=true, baseThickness=1.5, sideThickness=4, backThickness=2, supportedZ=27.2, supportedY=101.5, supportedX=159); +//sideSupportRailBase(top=true, defaultThickness=1.5, supportedZ=27.2, supportedY=101.5, supportedX=159); // distance between front and back main rail screw mounts sideRailScrewMountDist = yBarDepth - 2*(frontScrewSpacing + railFrontThickness + railSlotToXZ); -module sideSupportRailBase(u=2, double=true, top=true, baseThickness=2, sideThickness=2, backThickness=2, supportedZ=27.5, supportedY=101.5, supportedX=159) { +module sideSupportRailBase(top=true, supportedZ, supportedY, supportedX, zOrientation="middle", defaultThickness=2) { - // TODO simplify this mountBlockHeight = 10; mountBlockDepth = 10; screwMountGlobalDz = screwDiff / 2.0; // vertical distance between local origin and main rail screw mount sideRailScrewToMainRailFrontDx = frontScrewSpacing+railFrontThickness; - railLength = max(sideRailScrewMountDist + sideRailScrewToMainRailFrontDx + mountBlockDepth/2, supportedY+backThickness); - railBaseThickness = baseThickness; - railSideThickness = sideThickness; + railLength = max(sideRailScrewMountDist + sideRailScrewToMainRailFrontDx + mountBlockDepth/2, supportedY+defaultThickness); + railBaseThickness = defaultThickness; // default thickness value + railSideThickness = 4; + railBackThickness = 3; railBaseWidth = 15; - railSideHeight = supportedZ + railBaseThickness*2 + overhangSlack; + // Minimum U to enclose box, while also have a minimum defaultThickness for top and bottom. + minU = max(1, ceil((supportedZ + 2*railBaseThickness) / uDiff)-1); + railBottomThickness = + (zOrientation == "middle") + ? (((minU+1) * uDiff) - supportedZ)/2 + : (zOrientation == "bottom") + ? railBaseThickness + : railBaseThickness; + + assert(supportedX <= maxUnitWidth); + assert (zOrientation == "middle" || zOrientation == "bottom", "Z-Orientation not supported"); + assert(railBottomThickness >= railBaseThickness); + + railSideHeight = supportedZ + railBaseThickness + railBottomThickness + overhangSlack; frontMountPad = (sideRailScrewToMainRailFrontDx-mountBlockDepth/2)-xySlack; + translate(v=[-railSideThickness, 0, -railBottomThickness]) applyMainRailMounts() sideSupportRailBase(); - echo(frontScrewSpacing); - echo(sideRailScrewToMainRailFrontDx); - module applyMainRailMounts() { - mountBlockExtension = (railSupportsDx - supportedX)/2 - railSideThickness; - assert(mountBlockExtension >= 10); - apply_p() { - union() { - translate(v = [0, frontMountPad, 0]) - mountBlockColumn(mountBlockExtension=mountBlockExtension, u=u); - translate(v=[0,frontMountPad+sideRailScrewMountDist, 0]) - mountBlockColumn(mountBlockExtension=mountBlockExtension, u=u); - } + mountBlockExtension = (railSupportsDx - supportedX)/2 - railSideThickness; + minHexNutPocketToXYDist = mountBlockHeight/2; + minHexNutPocketToXZDist = mountBlockDepth/2; + minHexNutPocketToYZDist = 4; + screwU = floor((railSideHeight) / uDiff)-1; + + apply_pn() { + mountBlockPositive(); + mountBlockNegative(); children(0); } - } - module mountBlockColumn(mountBlockExtension, u) { + module mountBlockPositive() { + translate(v = [0, frontMountPad, 0]) + singleMountBlockPositive(); + translate(v=[0,frontMountPad+sideRailScrewMountDist, 0]) + singleMountBlockPositive(); + } - difference() { + module mountBlockNegative() { + translate(v = [0, frontMountPad, 0]) + singleMountBlockNegative(); + translate(v=[0,frontMountPad+sideRailScrewMountDist, 0]) + singleMountBlockNegative(); + } + + module singleMountBlockPositive() { translate(v = [-mountBlockExtension, 0, 0]) - cube(size = [mountBlockExtension, mountBlockDepth, railSideHeight]); + cube(size = [mountBlockExtension, mountBlockDepth, railSideHeight]); + } - union() { + module singleMountBlockNegative() { + nutPocket(); + + translate(v = [0, 0, uDiff*screwU]) nutPocket(); - if (double) { - translate(v=[0,0,uDiff * u]) // screwMountToGlobalZ - nutPocket(); - } - + module nutPocket() { + translate(v=[-mountBlockExtension+minHexNutPocketToYZDist, minHexNutPocketToXZDist, minHexNutPocketToXYDist]) + rotate(a=[-90,0,90]) + hexNutPocket_N(rackFrameScrewType, openSide=false, backSpace=min((railSideThickness-1)+mountBlockExtension-minHexNutPocketToYZDist,15)); } } - - module nutPocket() { - translate(v=[-mountBlockExtension/2,mountBlockDepth/2,mountBlockHeight/2]) // screwMountToGlobalZ - rotate(a=[90,0,0]) - rotate(a=[0,90,0]) - hexNutPocket_N(rackFrameScrewType, openSide=false); - } - } + module sideSupportRailBase() { - backThickness = 3; difference () { union() { - cube(size = [railBaseWidth, railLength, railBaseThickness]); + cube(size = [railBaseWidth, railLength, railBottomThickness]); cube(size = [railSideThickness, railLength, railSideHeight]); // back support - translate(v = [0, max(railLength-backThickness, supportedY), 0]) - cube(size = [railBaseWidth, backThickness, railSideHeight]); + translate(v = [0, max(railLength-railBackThickness, supportedY), 0]) + cube(size = [railBaseWidth, railBackThickness, railSideHeight]); // back support for box translate(v = [0, supportedY, 0]) - cube(size = [railBaseWidth, backThickness, railSideHeight]); + cube(size = [railBaseWidth, railBackThickness, railSideHeight]); // top support if (top) { - translate(v = [0, 0, railSideHeight-baseThickness]) + translate(v = [0, 0, railSideHeight-railBaseThickness]) cube(size = [railBaseWidth, railLength, railBaseThickness]); } - } + union() { distanceFromSeparator = 3; - r = 5; + r = 4; - boxDy = frontMountPad+r+mountBlockDepth+distanceFromSeparator; - boxDz = baseThickness+distanceFromSeparator+r; - translate(v=[0,boxDy,boxDz]) - minkowski() { - cube(size = [sideThickness, supportedY-(boxDy+distanceFromSeparator+r), railSideHeight-2*boxDz]); - sphere(r=r); - } - translate(v=[0,supportedY+distanceFromSeparator+r+backThickness,boxDz]) - minkowski() { - cube(size = [sideThickness, 25, railSideHeight-2*boxDz]); - sphere(r=r); + ventDy1 = frontMountPad+mountBlockDepth+distanceFromSeparator; + ventY1 = min(supportedY-(ventDy1+distanceFromSeparator), sideRailScrewMountDist-(2*distanceFromSeparator+mountBlockDepth)); + + ventDy2 = max(ventDy1, supportedY+railBackThickness+distanceFromSeparator); + ventY2 = max(0, railLength - (ventDy2 + distanceFromSeparator + mountBlockDepth)); + + ventDz = railBottomThickness+distanceFromSeparator+r; + ventZ = railSideHeight-(ventDz+distanceFromSeparator+r+railBaseThickness); + + if (ventY1 > 2*r) { + translate(v = [0, ventDy1+r, ventDz]) + minkowski() { + cube(size = [inf, ventY1-2*r, ventZ]); + sphere(r = r); + } } - cylindricalFiletNegative(p0=[railBaseWidth,0,0],p1=[railBaseWidth,0,inf], n=[1,-1,0],r=4); + if (ventY2 > 2*r) { + translate(v = [0, ventDy2+r, ventDz]) + minkowski() { + cube(size = [inf, ventY2-2*r, ventZ]); + sphere(r = r); + } + } + + cylindricalFiletNegative(p0=[railBaseWidth,0,0],p1=[railBaseWidth,0,inf], n=[1,-1,0],r=r); } } }