diff --git a/TODO.md b/TODO.md index 041a2b7..020b826 100644 --- a/TODO.md +++ b/TODO.md @@ -9,7 +9,8 @@ - Start working on actual cases ### Ideas - +- Clean up `sharedVariables.scad`!!! +- Start using matrices for transformations. Enforce strict local/global hierarchy of matrix transformations. - Instead of using names like 'mainRailSlotToInnerYZFace', experiment with a central distance/dimension directory. Like: ```openscad // Define identifiers: diff --git a/rack/mainRail.scad b/rack/mainRail.scad index 99fb96d..1ce49e0 100644 --- a/rack/mainRail.scad +++ b/rack/mainRail.scad @@ -2,33 +2,7 @@ include <./config.scad> include <../helper/screws.scad> include <../helper/math.scad> include <../helper/halfspace.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; - -railFrontThickness = 6; // Make sure that the nuts for the chosen screw type can slot within the front face -railSideMountThickness = 2.5; - -// Distance between the middle of a screw mount and the rail's vertical edges -railScrewHoleToInnerEdge = 5; -railScrewHoleToOuterEdge = 7; - -// Distance between the midpoint of the rail screw holes. -rackMountScrewWidth = maxUnitWidth + 2 * railScrewHoleToInnerEdge; - -// Extra spacing for screws. -frontScrewSpacing = 15; - -sideSupportScrewHoleToBackEdge = 4; -sideSupportDepth = sideSupportScrewHoleToBackEdge + frontScrewSpacing; - -frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge; - -railTotalWidth = frontFaceWidth; -railTotalDepth = railFrontThickness+sideSupportDepth; +include <./sharedVariables.scad> *mainRail(); diff --git a/rack/sharedVariables.scad b/rack/sharedVariables.scad index bae3d70..90479ce 100644 --- a/rack/sharedVariables.scad +++ b/rack/sharedVariables.scad @@ -1,4 +1,53 @@ +// Main rail variables: + +/* 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; + +railFrontThickness = 6; // Make sure that the nuts for the chosen screw type can slot within the front face +railSideMountThickness = 2.5; + +// Distance between the middle of a screw mount and the rail's vertical edges +railScrewHoleToInnerEdge = 5; +railScrewHoleToOuterEdge = 7; + +// Distance between the midpoint of the rail screw holes. +rackMountScrewWidth = maxUnitWidth + 2 * railScrewHoleToInnerEdge; + +// Extra spacing for screws. +frontScrewSpacing = 15; + +sideSupportScrewHoleToBackEdge = 4; +sideSupportDepth = sideSupportScrewHoleToBackEdge + frontScrewSpacing; + +frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge; + +railTotalWidth = frontFaceWidth; +railTotalDepth = railFrontThickness+sideSupportDepth; + + +// Side Wall variables: sideWallThickness = 2.5; sideWallSlotToOuterYEdge = 3; -sideWallSlotToOuterXEdge = 3; // TODO rename to variables found in ybar; \ No newline at end of file +sideWallSlotToOuterXEdge = 3; // TODO rename to variables found in ybar; +sideWallConnectorSlotWidth = 7; + + +// Y Bar variables: +railSlotToXZ = 3; +sideWallSlotToXZ = 3; + +railSlotToInnerYEdge = 2; +railSlotToSideWallSlot = 2; + +yBarWidth = railSlotToInnerYEdge + railTotalWidth+ railSlotToSideWallSlot + + sideWallSlotToOuterYEdge + sideWallConnectorSlotWidth; +yBarDepth = maxUnitDepth + 2*railSlotToInnerYEdge; +yBarHeight = 15; +yBarWallThickness = 3; +yBarRoundness = baseRoundness; + +joinCornerDepth = 32; diff --git a/rack/sideWall.scad b/rack/sideWall.scad index e4d6746..b80921a 100644 --- a/rack/sideWall.scad +++ b/rack/sideWall.scad @@ -2,30 +2,35 @@ include <../helper/math.scad> include <../helper/halfspace.scad> include <../misc/magnet.scad> include <./config.scad> -include <./yBar.scad> -include <./sideWallConnector.scad> +include <./mainRail.scad> + include <./sharedVariables.scad> +include <./sideWallConnector.scad> -sideWallZ = 110; -sideWallY = 110; -sideWallX = 12; sideWallZGapClearance = 0.2; +sideWallZ = railTotalHeight - 2*(railFootThickness + sideWallZGapClearance); +sideWallY = yBarDepth; -// make these global -hingePoleToInnerSideWallX = (hingePoleToConnectorOuterYZFace + sideWallSlotToOuterYEdge) - sideWallThickness; -hingePoleToInnerSideWallY = (hingePoleToConnectorOuterXZFace + sideWallSlotToOuterXEdge) - sideWallThickness; +sideWallXGapClearance = 0.2; +sideWallX = (yBarWidth-(railTotalWidth+railSlotToInnerYEdge)) - sideWallXGapClearance; +hingePoleDx = hingePoleToConnectorOuterYZFace + sideWallSlotToOuterYEdge; +hingePoleDy = hingePoleToConnectorOuterXZFace + sideWallSlotToOuterXEdge; + +echo("Side Wall Height", sideWallZ); +echo("Side Wall Depth", sideWallY); module sideWall() { applyHingeConnector() applyMagnetConnector() + applyEpicVentilation() + applyHingeHandle() sideWallBase(); - module sideWallBase() { module roundThingHelper(x,y,z,r) { @@ -50,54 +55,80 @@ module sideWall() { } } - module applyHingeConnector() { - hingeHolePositiveRad = hingeHoleR+1; - - module hingeProjectConstructionPlane() { - translate(v=[sideWallX-(sideWallThickness+hingePoleToInnerSideWallX) - hingeHolePositiveRad,sideWallY,0]) - cube(size=[2*hingeHolePositiveRad, eps, sideWallZ]); - } + hingeHoleShellR = hingeHoleR+1; apply_pn() { - hull() { - translate(v = [sideWallX-(sideWallThickness+hingePoleToInnerSideWallX), sideWallY-(sideWallThickness+ - hingePoleToInnerSideWallY), 0]) - cylinder(r = hingeHoleR+1, h = sideWallZ); - - hingeProjectConstructionPlane(); + hingeShell(); + hingeBacksideProjectionPlane(); } union() { - translate(v = [sideWallX-(sideWallThickness+hingePoleToInnerSideWallX), sideWallY-(sideWallThickness+ - hingePoleToInnerSideWallY), 0]) - cylinder(r = hingeHoleR, h = sideWallZ); - - // TODO annoying constant - halfspace(p=[sideWallX-3.3, sideWallY, 0], vpos=[1,1,0]); + hingeHole(); + // Trim parts of the wall for rotational clearance + halfspace(p=[sideWallX-5, sideWallY, 0], vpos=[1,1.5,0]); } children(0); } + + module hingeShell() { + translate(v = [sideWallX-hingePoleDx, sideWallY-(sideWallThickness+hingePoleDy), 0]) + cylinder(r = hingeHoleShellR, h = sideWallZ); + } + + // XZ plane in line with the back of the case. Project the hinge pole shell onto this to fill any weird + // geometries from the curves of the side wall + module hingeBacksideProjectionPlane() { + translate(v=[sideWallX-hingePoleDx - hingeHoleShellR,sideWallY,0]) + cube(size=[2*hingeHoleShellR, eps, sideWallZ]); + } + + module hingeHole() { + translate(v = [sideWallX-hingePoleDx, sideWallY-(sideWallThickness+hingePoleDy), 0]) + cylinder(r = hingeHoleR, h = sideWallZ); + } } + // TODO: add correct magnet translations, also remove random variables module applyMagnetConnector() { apply_p() { + union() { + translate(v = [sideWallThickness, magnetMountToYBarFront + 2, magnetMountToYBarTop+1]) + sideMagnetMount(); - translate(v=[sideWallThickness,10,10]) - rotate(a=[0,90,0]) - sideWallConnectorMagnetSide(); + translate(v = [sideWallThickness, magnetMountToYBarFront + 2, sideWallZ - (magnetMountToYBarTop + 1)]) + sideMagnetMount(); + } children(0); } + + + module sideMagnetMount() { + rotate(a=[0,90,0]) + sideWallConnectorMagnetSide(); + } } module applyEpicVentilation() { + children(0); + } + module applyHingeHandle() { + children(0); } } + sideWall(); +translate(v=[10,sideWallSlotToXZ,-2]) +mirror(v=[1,0,0]) +sideWallConnectorMagnet(); + +translate(v=[3,100,0]) +mirror(v=[0,1,0]) +sideWallConnectorHinge(); \ No newline at end of file diff --git a/rack/sideWallConnector.scad b/rack/sideWallConnector.scad index df3261b..a18bfb4 100644 --- a/rack/sideWallConnector.scad +++ b/rack/sideWallConnector.scad @@ -4,7 +4,6 @@ include <../helper/halfspace.scad> include <../misc/magnet.scad> include <./sharedVariables.scad> -sideWallConnectorSlotWidth = 7; sideWallConnW = 7; sideWallConnD = 20; @@ -15,10 +14,13 @@ yBarScrewHoleToOuterYEdge = 3.5; yBarScrewHoleToFrontXEdge = 16; magnetFaceToSideWallConnOuterYEdge = 2; -magnetMountExtraRadius = magnetRSlacked + 1; +magnetMountShellRadius = magnetRSlacked + 1; innerSideWallToYBarMagnetConn = magnetFaceToSideWallConnOuterYEdge + sideWallSlotToOuterYEdge - sideWallThickness; +magnetMountToYBarTop = magnetMountShellRadius; +magnetMountToYBarFront = magnetMountShellRadius + sideWallSlotToXZ; + hingePoleR = 2; hingePoleH = 5; hingeHoleR = hingePoleR + 0.2; @@ -67,27 +69,40 @@ module sideWallConnectorMagnet() { } } - // TODO: clean up + module applyMagnetMount() { - apply_p() { - difference() { - hull() { - translate(v = [0, 4, magnetMountExtraRadius+sideWallConnH]) - rotate(a = [0, 90, 0]) - cylinder(r = magnetMountExtraRadius, h = sideWallConnW-magnetFaceToSideWallConnOuterYEdge); - translate(v = [0, 0, sideWallConnH]) - cube(size = [sideWallConnW-magnetFaceToSideWallConnOuterYEdge, 2*magnetMountExtraRadius, eps]); - } - - translate(v = [sideWallConnW-(magnetFaceToSideWallConnOuterYEdge+magnetHSlacked), 4, 6]) - rotate(a = [0, 90, 0]) - cylinder(r = magnetRSlacked, h = magnetHSlacked); - } + magnetMountDx = magnetMountShellRadius; + magnetMountDy = magnetMountShellRadius + 2; + magnetMountDz = magnetMountShellRadius + sideWallConnLugDepression +1; + apply_pn() { + magnetMountShell(); + magnetMountHole(); children(0); } + + module magnetMountShell() { + hull() { + translate(v = [0, magnetMountDy, magnetMountDz]) + rotate(a = [0, 90, 0]) + cylinder(r = magnetMountShellRadius, h = sideWallConnW-magnetFaceToSideWallConnOuterYEdge); + + translate(v = [0, 2, sideWallConnH]) + cube(size = [sideWallConnW-magnetFaceToSideWallConnOuterYEdge, 2*magnetMountShellRadius, eps]); + } + } + + module magnetMountHole() { + translate(v = [sideWallConnW-(magnetFaceToSideWallConnOuterYEdge+magnetHSlacked), + magnetMountDy, + magnetMountDz]) + rotate(a = [0, 90, 0]) + cylinder(r = magnetRSlacked, h = magnetHSlacked); + } } + + } module sideWallConnectorHinge() { @@ -134,7 +149,7 @@ module sideWallConnectorHinge() { module sideWallConnectorMagnetSide() { // oriented so that the xy face is the side wall's inner face difference() { - cylinder(r1=magnetMountExtraRadius+2 ,r2 = magnetMountExtraRadius, h = innerSideWallToYBarMagnetConn); + cylinder(r1=magnetMountShellRadius + 0.5,r2 = magnetMountShellRadius, h = innerSideWallToYBarMagnetConn); translate(v=[0, 0, innerSideWallToYBarMagnetConn-magnetHSlacked]) cylinder(r = magnetRSlacked, h = magnetHSlacked); diff --git a/rack/yBar.scad b/rack/yBar.scad index cea6e58..950c727 100644 --- a/rack/yBar.scad +++ b/rack/yBar.scad @@ -3,7 +3,6 @@ include <../helper/sphericalFilet.scad> include <../helper/cylindricalFilet.scad> include <../helper/screws.scad> include <../misc/magnet.scad> - include <./config.scad> include <./mainRail.scad> @@ -13,19 +12,8 @@ include <./xyBarConnector.scad> include <./sideWallConnector.scad> include <./yBarBasePlateConnector.scad> -railSlotToInnerYEdge = 2; -railSlotToXZ = 3; -railSlotToSideWallSlot = 2; -sideWallSlotToXZ = 3; +include <./sharedVariables.scad> -yBarDepth = maxUnitDepth + 2*railSlotToInnerYEdge; -yBarWidth = railSlotToInnerYEdge + railTotalWidth+ railSlotToSideWallSlot - + sideWallSlotToOuterYEdge + sideWallConnectorSlotWidth; -yBarHeight = 15; -yBarWallThickness = 3; -yBarRoundness = baseRoundness; - -joinCornerDepth = 32; echo("Bar total depth: ", yBarDepth); echo("Bar total width: ", yBarWidth);