diff --git a/helper/filet.scad b/helper/filet.scad index e69de29..efb1920 100644 --- a/helper/filet.scad +++ b/helper/filet.scad @@ -0,0 +1,42 @@ +include <./halfspace.scad> +include <./math.scad> + +// Some modules for simple subtractive filets + +module cylindricalFiletNegative(p0, p1, n, r) { + l = norm(p1-p0); + + align_to(p0=p0, p1=p1, p2=p0-n) + rotate(a=[45,0,0]) + rotate(a=[0,90,0]) + zFiletNegative(length = l, r = r); +} + +module zFiletNegative(length, r) { + + p1 = [0,0,0]; + p2 = [0,0,length]; + n1 = [-1,-1,0] / norm([-1,-1,0]); + dr = sqrt(2*r^2); + + difference() { + + hull() { + translate(v=[0,0,0]) + cube(size=[r,r,r]); + + translate(v = p2-[0,0,0.1]) + cube(size=[r,r,0.1]); + + } + + hull() { + translate(v = p1-n1*dr) + cylinder(r = r, h=0.0001, $fn = 32); + + + translate(v = p2-n1*dr) + cylinder(r = r, h=0.0001, $fn = 32); + } + } +} \ No newline at end of file diff --git a/helper/halfspace.scad b/helper/halfspace.scad index 7cf2bd4..90e10a1 100644 --- a/helper/halfspace.scad +++ b/helper/halfspace.scad @@ -10,16 +10,17 @@ module halfspace(vpos, p) { cube(size=[inf, inf, inf], center=true); } else { translate(p) - align(a=ref, b = vpos) + alignPlanar(a=ref, b = vpos) translate(v = [0, 0, -inf/2]) cube(size = [inf, inf, inf], center = true); } - module align(a,b) { - rot_axis = cross(a,b); - angle = acos(a*b/(norm(a)*norm(b))); +} - rotate(v=rot_axis, a=angle) - children(0); - } +module alignPlanar(a,b) { + rot_axis = cross(a,b); + angle = acos(a*b/(norm(a)*norm(b))); + + rotate(v=rot_axis, a=angle) + children(0); } \ No newline at end of file diff --git a/helper/math.scad b/helper/math.scad index aaf0b23..402682c 100644 --- a/helper/math.scad +++ b/helper/math.scad @@ -24,4 +24,28 @@ module mirror4XY(p, dx, dy) { children(0); } +// Generate a 4x4 matrix that causes a change of basis +// such that the origin is at point p0, the x axis is aligned +// from p0 to p1 and point p2 is in the first quadrant. +// Copied and pasted from https://trmm.net/Basis/ +module align_to(p0,p1,p2) { + + x = unit(p1-p0); + yp = unit(p2-p0); + z = unit(cross(x,yp)); + y = unit(cross(z,x)); + + echo(p0,p1,p2); + echo(x,y,z); + + multmatrix([ + [x[0], y[0], z[0], p0[0]], + [x[1], y[1], z[1], p0[1]], + [x[2], y[2], z[2], p0[2]], + [ 0, 0, 0, 1] + ]) + children(); +} + +function unit(v) = v/norm(v); function lerp(a, b, t) = (b * t + a * (1 - t)); diff --git a/rack/assemblyGuide.scad b/rack/assemblyGuide.scad index 91850c4..0480e10 100644 --- a/rack/assemblyGuide.scad +++ b/rack/assemblyGuide.scad @@ -40,7 +40,7 @@ module assemblyInstructions () { // Final builds: // render() - // finalSingle(); + finalSingle(); // finalDouble(); // Features: diff --git a/rack/mainRail.scad b/rack/mainRail.scad index e2172be..f330cee 100644 --- a/rack/mainRail.scad +++ b/rack/mainRail.scad @@ -1,5 +1,6 @@ include <./config.scad> include <../helper/screws.scad> +include <../helper/filet.scad> include <../helper/slack.scad> include <../helper/math.scad> include <../helper/halfspace.scad> @@ -8,7 +9,7 @@ include <../helper/matrix.scad> include <./connector/connectors.scad> -*mainRail(); +mainRail(); module mainRail() { @@ -18,12 +19,15 @@ module mainRail() { mainRailBase(); module mainRailBase() { - union() { - frontRailSegment(); - translate(v = [railSideMountThickness, railFrontThickness, 0]) - rotate(a = [0, 0, 90]) - sideSupportSegment(); + difference() { + union() { + frontRailSegment(); + + translate(v = [railSideMountThickness, railFrontThickness, 0]) + rotate(a = [0, 0, 90]) + sideSupportSegment(); + } } module frontRailSegment() { @@ -31,7 +35,7 @@ module mainRail() { cube(size = [frontFaceWidth, railFrontThickness, railTotalHeight]); for (i = [1:numRailScrews]) { - translate(v = [railScrewHoleToOuterEdge, railFrontThickness / 2, i * screwDiff + railFootThickness]) + translate(v = [railScrewHoleToOuterEdge, railFrontThickness/2, i*screwDiff+railFootThickness]) rotate(a = [90, 0, 0]) hexNutPocket_N(mainRailScrewType); } @@ -61,6 +65,9 @@ module mainRail() { halfspace(vpos = [-1, -1, 0], p = [b, b, 0]); halfspace(vpos = [-1, 0, -1], p = [b, 0, b]); halfspace(vpos = [-1, 0, 1], p = [b, 0, railTotalHeight-b]); + + cylindricalFiletNegative(p0=[frontFaceWidth, 0, 0], p1=[frontFaceWidth, 0, railTotalHeight], n=[1,-1,0], r=1); + cylindricalFiletNegative(p0=[frontFaceWidth, railFrontThickness, railFootThickness+4], p1=[frontFaceWidth, railFrontThickness, railTotalHeight-(railFootThickness+4)], n=[1,1,0], r=1); } children(0); diff --git a/rack/xBar.scad b/rack/xBar.scad index 3b6a3a2..b4a3a26 100644 --- a/rack/xBar.scad +++ b/rack/xBar.scad @@ -1,4 +1,5 @@ include <../helper/cylindricalFilet.scad> +include <../helper/filet.scad> include <../helper/screws.scad> include <../helper/matrix.scad> @@ -20,14 +21,31 @@ module xBar() { difference() { cylindricalFiletEdge(xBarY, xBarX, xBarHeight, xBarRoundness); - translate(v = [xBarWallThickness, xBarSideThickness, xBarWallThickness]) - cylindricalFiletEdge(xBarY, xBarX-2*xBarSideThickness, xBarHeight, xBarRoundness-xBarWallThickness); + union() { + translate(v = [xBarWallThickness, xBarSideThickness, xBarWallThickness]) + cylindricalFiletEdge(xBarY, xBarX-2*xBarSideThickness, xBarHeight, xBarRoundness-xBarWallThickness); + + connectorWallFiletNegative(); + + multmatrix(xBarMirrorOtherCornerTrans) + connectorWallFiletNegative(); + } } // Shave off bottom corners to reduce elephant's foot at where xBar and YBar join halfspace(vpos = [0, 1, 1], p = [0, 0.75, 0]); halfspace(vpos = [0, -1, 1], p = [0, xBarX-0.75, 0]); } + + + module connectorWallFiletNegative() { + cylindricalFiletNegative( + p0=[xBarWallThickness, xBarSideThickness, xBarHeight], + p1=[xBarY, xBarSideThickness, xBarHeight], + n=[0, 1, 1], r=2 + ); + } + } } diff --git a/stl/micro/rack/eval_P.stl b/stl/micro/rack/eval_P.stl index 9d9b2d6..df3da81 100644 Binary files a/stl/micro/rack/eval_P.stl and b/stl/micro/rack/eval_P.stl differ diff --git a/stl/micro/rack/mainRail_P.stl b/stl/micro/rack/mainRail_P.stl index b31c64b..60f062c 100644 Binary files a/stl/micro/rack/mainRail_P.stl and b/stl/micro/rack/mainRail_P.stl differ diff --git a/stl/micro/rack/xBar_P.stl b/stl/micro/rack/xBar_P.stl index 65688d1..6d1c944 100644 Binary files a/stl/micro/rack/xBar_P.stl and b/stl/micro/rack/xBar_P.stl differ diff --git a/stl/micro/rack/xyPlate_P.stl b/stl/micro/rack/xyPlate_P.stl index c033b53..b52ff21 100644 Binary files a/stl/micro/rack/xyPlate_P.stl and b/stl/micro/rack/xyPlate_P.stl differ diff --git a/stl/micro/rack/yBar_P.stl b/stl/micro/rack/yBar_P.stl index 8d3256b..a53af83 100644 Binary files a/stl/micro/rack/yBar_P.stl and b/stl/micro/rack/yBar_P.stl differ diff --git a/stl/mini/rack/eval_P.stl b/stl/mini/rack/eval_P.stl index 988db9f..3f02683 100644 Binary files a/stl/mini/rack/eval_P.stl and b/stl/mini/rack/eval_P.stl differ diff --git a/stl/mini/rack/mainRail_P.stl b/stl/mini/rack/mainRail_P.stl index 954b17e..10fb95b 100644 Binary files a/stl/mini/rack/mainRail_P.stl and b/stl/mini/rack/mainRail_P.stl differ diff --git a/stl/mini/rack/sideWallLeft_P.stl b/stl/mini/rack/sideWallLeft_P.stl index 29e20b3..5c96586 100644 Binary files a/stl/mini/rack/sideWallLeft_P.stl and b/stl/mini/rack/sideWallLeft_P.stl differ diff --git a/stl/mini/rack/sideWallRight_P.stl b/stl/mini/rack/sideWallRight_P.stl index 610dafa..5888ece 100644 Binary files a/stl/mini/rack/sideWallRight_P.stl and b/stl/mini/rack/sideWallRight_P.stl differ diff --git a/stl/mini/rack/xBar_P.stl b/stl/mini/rack/xBar_P.stl index ff4bfb4..5382cd3 100644 Binary files a/stl/mini/rack/xBar_P.stl and b/stl/mini/rack/xBar_P.stl differ diff --git a/stl/mini/rack/xyPlate_P.stl b/stl/mini/rack/xyPlate_P.stl index c7bed3b..776dead 100644 Binary files a/stl/mini/rack/xyPlate_P.stl and b/stl/mini/rack/xyPlate_P.stl differ diff --git a/stl/mini/rack/yBar_P.stl b/stl/mini/rack/yBar_P.stl index 0f43a52..4d49e0f 100644 Binary files a/stl/mini/rack/yBar_P.stl and b/stl/mini/rack/yBar_P.stl differ diff --git a/stl/nano/rack/eval_P.stl b/stl/nano/rack/eval_P.stl index 1d44f8f..99f88c6 100644 Binary files a/stl/nano/rack/eval_P.stl and b/stl/nano/rack/eval_P.stl differ diff --git a/stl/nano/rack/mainRail_P.stl b/stl/nano/rack/mainRail_P.stl index e1ced13..a640718 100644 Binary files a/stl/nano/rack/mainRail_P.stl and b/stl/nano/rack/mainRail_P.stl differ diff --git a/stl/nano/rack/xBar_P.stl b/stl/nano/rack/xBar_P.stl index 25f1354..1aaa0d5 100644 Binary files a/stl/nano/rack/xBar_P.stl and b/stl/nano/rack/xBar_P.stl differ diff --git a/stl/nano/rack/xyPlate_P.stl b/stl/nano/rack/xyPlate_P.stl index 4c24a26..e5efdf7 100644 Binary files a/stl/nano/rack/xyPlate_P.stl and b/stl/nano/rack/xyPlate_P.stl differ diff --git a/stl/nano/rack/yBar_P.stl b/stl/nano/rack/yBar_P.stl index edf32b7..00f4fd6 100644 Binary files a/stl/nano/rack/yBar_P.stl and b/stl/nano/rack/yBar_P.stl differ