From a30f14ecb21e09fdb42f1318854ea132eec1b456 Mon Sep 17 00:00:00 2001 From: zhao Date: Mon, 16 Jan 2023 22:36:55 -0500 Subject: [PATCH] refactor yBar to include better variables --- rack/mainRail.scad | 4 ++-- rack/sideWallConnector.scad | 1 + rack/yBar.scad | 26 ++++++++++++++------------ rack/yBarBasePlateConnector.scad | 3 +++ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/rack/mainRail.scad b/rack/mainRail.scad index 825e377..e19fed2 100644 --- a/rack/mainRail.scad +++ b/rack/mainRail.scad @@ -14,7 +14,7 @@ railSideMountThickness = 2.5; // Distance between the middle of a screw mount and the rail's vertical edges railScrewHoleToInnerEdge = 5; -railScrewHoleToOuterEdge = 7; +railScrewHoleToOuterEdge = 9; // Distance between the midpoint of the rail screw holes. rackMountScrewWidth = maxUnitWidth + 2 * railScrewHoleToInnerEdge; @@ -30,7 +30,7 @@ frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge; railTotalWidth = frontFaceWidth; railTotalDepth = railFrontThickness+sideSupportDepth; -mainRail(); +*mainRail(); echo("Total Rail Height: ", railTotalHeight); diff --git a/rack/sideWallConnector.scad b/rack/sideWallConnector.scad index 88fad4c..55c7f77 100644 --- a/rack/sideWallConnector.scad +++ b/rack/sideWallConnector.scad @@ -1,6 +1,7 @@ include <./config.scad> include <../helper/screws.scad> +sideWallConnectorSlotWidth = 7; module sideWallConnector_N() { lugW = 7; diff --git a/rack/yBar.scad b/rack/yBar.scad index ae9b99d..722e289 100644 --- a/rack/yBar.scad +++ b/rack/yBar.scad @@ -13,15 +13,16 @@ include <./xyBarConnector.scad> include <./sideWallConnector.scad> include <./yBarBasePlateConnector.scad> -// TODO clean up -// TODO: How do I nicely explain this? -railSlotSpacing = 3; -sideSpacing = 12; +railSlotToInnerYEdge = 2; +railSlotToXZ = 3; +railSlotToSideWallSlot = 0; +sideWallSlotToOuterYEdge = 3; +sideWallSlotToXZ = 3; -yBarDepth = maxUnitDepth + 2*railSlotSpacing; -yBarWidth = railSlotSpacing + railTotalWidth + sideSpacing; +yBarDepth = maxUnitDepth + 2*railSlotToInnerYEdge; +yBarWidth = railSlotToInnerYEdge + railTotalWidth+ railSlotToSideWallSlot + + sideWallSlotToOuterYEdge + sideWallConnectorSlotWidth; yBarHeight = 15; - yBarWallThickness = 3; yBarRoundness = baseRoundness; @@ -29,8 +30,9 @@ joinCornerDepth = 32; echo("Bar total depth: ", yBarDepth); echo("Bar total width: ", yBarWidth); +echo("Bar total height: ", yBarHeight); -*yBar(); +yBar(); module yBar() { @@ -57,12 +59,12 @@ module yBar() { module applyBasePlateConnector() { apply_pn() { mirrorOtherCorner() { - translate(v = [yBarWidth-12, joinCornerDepth, yBarWallThickness]) // why do we need 0.01 here??? + translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, yBarWallThickness]) yBarBasePlateMount_P(); } mirrorOtherCorner() { - translate(v = [yBarWidth-12, joinCornerDepth, 0]) + translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, 0]) yBarBasePlateMount_N(); } @@ -83,7 +85,7 @@ module yBar() { module applySideWallConnector() { apply_n() { mirrorOtherCorner() - translate(v = [yBarWidth-(railTotalWidth+railSlotSpacing)-9, railSlotSpacing, yBarHeight]) + translate(v = [yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth), sideWallSlotToXZ, yBarHeight]) sideWallConnector_N(); children(0); @@ -93,7 +95,7 @@ module yBar() { module applyRailConnector() { apply_n() { mirrorOtherCorner() - translate(v = [yBarWidth-(railTotalWidth+railSlotSpacing), railSlotSpacing, yBarHeight-railFootThickness]) + translate(v = [yBarWidth-(railTotalWidth+railSlotToInnerYEdge), railSlotToXZ, yBarHeight-railFootThickness]) railFeetSlot_N(); children(0); diff --git a/rack/yBarBasePlateConnector.scad b/rack/yBarBasePlateConnector.scad index 6ff3dcd..543dbd4 100644 --- a/rack/yBarBasePlateConnector.scad +++ b/rack/yBarBasePlateConnector.scad @@ -7,6 +7,9 @@ _mountX = 12; _mountY = 14; _mountZ = 10; +// Needed for yBar to align this connector to its inner Y edge +yBarBasePlateConnectorWidth = _mountX; + // x and y faces of the yBarBasePlateMount_P block _innerXFaceToScrew = 6; _innerYFaceToScrew = 8;