work on connectingBar

This commit is contained in:
zhao
2023-01-02 23:55:26 -05:00
parent 1b923fa215
commit 5d4252b62d
7 changed files with 197 additions and 55 deletions

View File

@ -5,8 +5,7 @@
$fn=64; $fn=64;
eps=0.0001;
eps=0.01;
inf10 = 10; inf10 = 10;
inf50 = 50; inf50 = 50;

View File

@ -0,0 +1,85 @@
include <../math.scad>
include <./config.scad>
include <./screws.scad>
include <./mainRail.scad>
include <./helper/sphericalFilet.scad>
include <./helper/cylindricalFilet.scad>
// TODO: How do I nicely explain this?
railSlotSpacing = 4;
sideSpacing = 12;
barDepth = maxUnitDepth + 2*railSlotSpacing;
barWidth = railSlotSpacing + railTotalWidth + sideSpacing;
barHeight = 15;
barWallThickness = 3;
barRoundness = 12;
echo("Bar total depth: ", barDepth);
echo("Bar total width: ", barWidth);
module connectingBar() {
module _positive() {
minkowski() {
difference() {
sphericalFiletEdge(barWidth, barDepth, barHeight, barRoundness);
translate(v = [barWallThickness, 40, barWallThickness])
cylindricalFiletEdge(barWidth, barDepth-80, barHeight, barRoundness);
}
}
}
module _stackConn() {
translate(v=[0,0,0])
cube(size = [10, 10, 5]);
translate(v=[5,5,5])
cylinder(r=2, h=2);
}
module _sideConnector() {
//translate(v=[1.5, railTotalDepth - 4, -m3HeatSetInsertSlotHeightSlacked])
rotate(a=[0,90,0])
heatSetInsertSlot_N(rackFrameScrewType);
}
module _test() {
difference() {
_positive();
union() {
translate(v=[10,10,0])
_stackConn();
translate(v=[barWidth - (railTotalWidth + railSlotSpacing), railSlotSpacing, barHeight - railFootThickness])
railFeetSlot_N();
translate(v=[barWidth - m3HeatSetInsertSlotHeightSlacked + eps, 6, 7.5])
_sideConnector();
translate(v=[barWidth - m3HeatSetInsertSlotHeightSlacked + eps, 35, 7.5])
_sideConnector();
}
}
}
_test();
translate(v=[barWidth - m3HeatSetInsertSlotHeightSlacked + eps, 6, 7.5])
_sideConnector();
}
connectingBar();
intersection() {
connectingBar();
cube(size=[15,100,100]);
}

Binary file not shown.

View File

@ -0,0 +1,16 @@
module cylindricalFiletEdge(width, depth, height, roundness) {
rd = roundness;
intersection() {
minkowski() {
rotate(a = [90, 0, 0])
cylinder(r = rd, h = eps);
translate(v = [rd, 0, rd])
cube(size = [width, depth, height]);
}
cube(size = [width, depth, height]);
}
}

View File

@ -0,0 +1,15 @@
module sphericalFiletEdge(width, depth, height, roundness) {
rd = roundness;
intersection() {
minkowski() {
sphere(r = rd);
translate(v = [rd, rd, rd])
cube(size = [width*2, depth - 2*rd, height*2]);
}
cube(size = [width, depth, height]);
}
}

View File

@ -1,4 +1,5 @@
include <./config.scad> include <./config.scad>
include <../math.scad>
include <./screws.scad> include <./screws.scad>
/* Small horizontal planes at the top and bottom of the main rails. Used so we can fasten the rail to the frame /* Small horizontal planes at the top and bottom of the main rails. Used so we can fasten the rail to the frame
@ -7,13 +8,7 @@ railFootThickness = 3;
railTotalHeight = screwDiff * (numRailScrews + 1) + 2 * railFootThickness; railTotalHeight = screwDiff * (numRailScrews + 1) + 2 * railFootThickness;
mainRail();
echo("Total Rail Height = ", railTotalHeight);
module mainRail() {
// Distance between the middle of a screw mount and the rail's vertical edges // Distance between the middle of a screw mount and the rail's vertical edges
railScrewHoleToInnerEdge = 5; railScrewHoleToInnerEdge = 5;
railScrewHoleToOuterEdge = 5; railScrewHoleToOuterEdge = 5;
@ -24,8 +19,7 @@ module mainRail() {
railSideMountThickness = 2.5; railSideMountThickness = 2.5;
railOtherThickness = 2.5; railOtherThickness = 2.5;
// Extra spacing for screws.
// Extra spacing for the rack unit screws.
frontScrewSpacing = 8; frontScrewSpacing = 8;
sideSupportExtraSpace = 2; sideSupportExtraSpace = 2;
@ -35,19 +29,28 @@ module mainRail() {
frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge; frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge;
railTotalWidth = frontFaceWidth;
railTotalDepth = railFrontThickness+railOtherThickness+frontScrewSpacing+sideSupportDepth;
*mainRail();
echo("Total Rail Height: ", railTotalHeight);
module mainRail() {
union() { union() {
_frontRailSegment(); _frontRailSegment();
translate(v = [0, railFrontThickness, 0]) translate(v = [0, railFrontThickness, 0])
_connectingLBracketRailSegment(); _connectingLBracketRailSegment();
translate(v = [frontFaceWidth - sideSupportExtraSpace, railFrontThickness + railOtherThickness + frontScrewSpacing, translate(v = [frontFaceWidth-sideSupportExtraSpace, railFrontThickness+railOtherThickness+frontScrewSpacing, 0])
0])
rotate(a = [0, 0, 90]) rotate(a = [0, 0, 90])
_sideSupportSegment(); _sideSupportSegment();
translate(v = [0, railFrontThickness + railOtherThickness + frontScrewSpacing, 0]) { translate(v = [0, railFrontThickness + railOtherThickness + frontScrewSpacing, 0]) {
_railFeet(); _railFeet();
translate(v = [0, 0, railTotalHeight - railFootThickness]) translate(v = [0, 0, railTotalHeight - railFootThickness])
@ -68,7 +71,6 @@ module mainRail() {
} }
module _connectingLBracketRailSegment() { module _connectingLBracketRailSegment() {
difference() { difference() {
cube(size = [railOtherThickness, frontScrewSpacing + railOtherThickness, railTotalHeight]); cube(size = [railOtherThickness, frontScrewSpacing + railOtherThickness, railTotalHeight]);
@ -79,7 +81,7 @@ module mainRail() {
translate(v = [0, 4, railTotalHeight - (railFootThickness + screwDiff / 2)]) translate(v = [0, 4, railTotalHeight - (railFootThickness + screwDiff / 2)])
rotate(a = [0, 90, 0]) rotate(a = [0, 90, 0])
cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = 10, $fn = 32, center = true); cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = inf10, $fn = 32, center = true);
} }
} }
@ -90,32 +92,40 @@ module mainRail() {
module _sideSupportSegment() { module _sideSupportSegment() {
difference() { difference() {
cube(size = [sideSupportDepth, railSideMountThickness, railTotalHeight]); cube(size = [sideSupportDepth, railSideMountThickness, railTotalHeight]);
for (i = [1:numRailScrews]) { for (i = [1:numRailScrews]) {
translate(v = [sideSupportScrewHoleToFrontEdge, railFrontThickness / 2, i * screwDiff + railFootThickness]) translate(v = [sideSupportScrewHoleToFrontEdge, railFrontThickness / 2, i * screwDiff + railFootThickness])
rotate(a = [90, 0, 0]) rotate(a = [90, 0, 0])
cylinder(r = screwRadiusSlacked(mainRailSideMountScrewType), h = 10, $fn = 32); cylinder(r = screwRadiusSlacked(mainRailSideMountScrewType), h = inf10, $fn = 32);
} }
} }
} }
module _railFeet() { module _railFeet() {
difference() { difference() {
cube(size = [frontFaceWidth - sideSupportExtraSpace, sideSupportDepth, railFootThickness]); cube(size = [frontFaceWidth - sideSupportExtraSpace, sideSupportDepth, railFootThickness]);
hull() { hull() {
translate(v = [1.5, 5, 0]) translate(v = [1.5, 5, 0])
cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = 10, $fn = 32); cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = inf10, $fn = 32);
translate(v = [0, 5, 0]) translate(v = [0, 5, 0])
cube(size = [0.1, screwRadiusSlacked(rackFrameScrewType) * 2, 10], center = true); cube(size = [eps, screwRadiusSlacked(rackFrameScrewType) * 2, 10], center = true);
} }
} }
} }
} }
module railFeetSlot_N() {
union() {
cube(size = [railTotalWidth, railTotalDepth, railFootThickness]);
translate(v=[1.5, railTotalDepth - 4, -m3HeatSetInsertSlotHeightSlacked])
heatSetInsertSlot_N(rackFrameScrewType);
}
}

View File

@ -1,6 +1,7 @@
/* Some common screw dimensions and helper functions/modules */ /* Some common screw dimensions and helper functions/modules */
inf = 400; include <../math.scad>
include <../common.scad>
/********************************************************************************/ /********************************************************************************/
// M3 dimensions // M3 dimensions
@ -8,10 +9,20 @@ m3HoleRadiusSlack = 0.15;
m3Diameter = 3.0; m3Diameter = 3.0;
m3Radius = m3Diameter / 2.0; m3Radius = m3Diameter / 2.0;
m3RadiusSlacked = m3Radius + m3HoleRadiusSlack; m3RadiusSlacked = m3Radius + m3HoleRadiusSlack;
m3HexNutWidthAcrossFlats = 5.41; m3HexNutWidthAcrossFlats = 5.41;
m3HexNutWidthAcrossCorners = FtoG(m3HexNutWidthAcrossFlats); m3HexNutWidthAcrossCorners = FtoG(m3HexNutWidthAcrossFlats);
m3HexNutThickness = 2.18; m3HexNutThickness = 2.18;
m3HeatSetInsertSlotRadiusSlack = 0.0;
m3HeatSetInsertSlotHeightSlack = 0.5;
m3HeatSetInsertSlotRadius = 2.5;
m3HeatSetInsertSlotHeight = 6;
m3HeatSetInsertSlotRadiusSlacked = m3HeatSetInsertSlotRadius+m3HeatSetInsertSlotRadiusSlack;
m3HeatSetInsertSlotHeightSlacked = m3HeatSetInsertSlotHeight+m3HeatSetInsertSlotHeightSlack;
/********************************************************************************/ /********************************************************************************/
// M4 dimensions // M4 dimensions
m4HoleRadiusSlack = 0.15; m4HoleRadiusSlack = 0.15;
@ -23,6 +34,22 @@ m4HexNutWidthAcrossCorners = FtoG(m4HexNutWidthAcrossFlats);
m4HexNutThickness = 3.07; m4HexNutThickness = 3.07;
/********************************************************************************/ /********************************************************************************/
module heatSetInsertSlot_N(screwType) {
if (screwType == "m3") {
union() {
// actual slot for insert
cylinder(h = m3HeatSetInsertSlotHeightSlacked, r = m3HeatSetInsertSlotRadiusSlacked);
// extra space above slot to help with insertion
translate(v=[0, 0, m3HeatSetInsertSlotHeightSlacked])
cylinder(h = inf50, r = 1.3*m3HeatSetInsertSlotRadiusSlacked);
}
} else {
error("Unsupported screw type");
}
}
function screwRadiusSlacked(screwType) = function screwRadiusSlacked(screwType) =
(screwType == "m3") (screwType == "m3")
? m3RadiusSlacked ? m3RadiusSlacked
@ -30,45 +57,35 @@ function screwRadiusSlacked(screwType) =
? m4RadiusSlacked ? m4RadiusSlacked
: error("Unsupported screw type"); : error("Unsupported screw type");
module hexNutPocket_N(screwType) { module hexNutPocket_N(screwType) {
if (screwType == "m3") { if (screwType == "m3") {
hexNutPocketHelper_N(m3RadiusSlacked, hexNutPocketHelper_N(m3RadiusSlacked, m3HexNutWidthAcrossCorners / 2 + 0.1, m3HexNutThickness + 0.2);
m3HexNutWidthAcrossCorners / 2 + 0.1,
m3HexNutThickness + 0.2);
} else if (screwType == "m4") { } else if (screwType == "m4") {
hexNutPocketHelper_N(m4RadiusSlacked, hexNutPocketHelper_N(m4RadiusSlacked, m4HexNutWidthAcrossCorners / 2 + 0.1, m4HexNutThickness + 0.2);
m4HexNutWidthAcrossCorners / 2 + 0.1,
m4HexNutThickness + 0.2);
} else { } else {
error("Unsupported screw type"); error("Unsupported screw type");
} }
} }
module hexNutPocketHelper_N( module hexNutPocketHelper_N(innerRadius, widthAcrossCorners, thickness) {
innerRadius,
widthAcrossCorners,
thickness)
{
union() { union() {
hull() { hull() {
// hexagonal cylinder representing where the nut should fit // hexagonal cylinder representing where the nut should fit
cylinder(r = widthAcrossCorners, h = thickness, center = true, $fn = 6); cylinder(r = widthAcrossCorners, h = thickness, center = true, $fn = 6);
// negative volume for sliding in the nut // negative volume for sliding in the nut
translate(v = [inf, 0, 0]) translate(v = [inf50, 0, 0])
cylinder(r = widthAcrossCorners, h = thickness, center = true, $fn = 6); cylinder(r = widthAcrossCorners, h = thickness, center = true, $fn = 6);
} }
// negative volume for screw lead // negative volume for screw lead
translate(v = [0, 0, - 10]) translate(v = [0, 0, - 10])
cylinder(r = innerRadius, h = inf, $fn = 32); cylinder(r = innerRadius, h = inf50, $fn = 32);
hull() { hull() {
translate(v = [inf, 0, 0]) translate(v = [inf50, 0, 0])
cylinder(r = innerRadius, h = inf, $fn = 32); cylinder(r = innerRadius, h = inf50, $fn = 32);
cylinder(r = innerRadius, h = inf, $fn = 32); cylinder(r = innerRadius, h = inf50, $fn = 32);
} }
} }
} }