add to xBar, also refactor

This commit is contained in:
zhao
2023-01-13 00:58:46 -05:00
parent 933b2d9d73
commit ba1dc567b7
9 changed files with 204 additions and 32 deletions

View File

@ -5,10 +5,7 @@ include <./common.scad>
module halfspace(vpos, p) {
translate(p)
align(a=[0,0,1], b=vpos)
align(a=[0,0,-1], b=vpos)
translate(v=[0,0,-inf/2])
cube(size=[inf, inf, inf], center=true);
}
halfspace(vpos=[1,1,1], p=[10,10,10]);

View File

@ -13,8 +13,19 @@ function mirror4XY(midpoint, offsetX, offsetY) =
module align(a,b) {
echo("a", a);
echo("b", b);
rot_axis = cross(a,b);
if (rot_axis == 0) {
error("Can't align - provided vectors are parallel");
}
echo("rot_axis", rot_axis);
angle = acos(a*b/(norm(a)*norm(b)));
echo("angle", angle)
rotate(v=rot_axis, a=angle)
children(0);

View File

@ -32,3 +32,6 @@ mainRailSideMountScrewType = "m4";
rackFrameScrewType = "m3";
// Currently, only m3 screws are supported here (tolerance issues)
assert(rackFrameScrewType == "m3");
// Fillet radius
baseRoundness = 5;

View File

@ -2,3 +2,5 @@
// multiple components.
// TODO
include <./config.scad>

View File

@ -1,6 +1,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 */
@ -29,11 +30,28 @@ frontFaceWidth = railScrewHoleToInnerEdge + railScrewHoleToOuterEdge;
railTotalWidth = frontFaceWidth;
railTotalDepth = railFrontThickness+sideSupportDepth;
*mainRail();
echo("Total Rail Height: ", railTotalHeight);
// Also known as the z-bar :)
module mainRail() {
mainRail();
module mainRail() {
b = 0.75; // bevel value
intersection() {
mainRailSharp();
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]);
}
}
module mainRailSharp() {
union() {
_frontRailSegment();
@ -50,6 +68,7 @@ module mainRail() {
_railFeet();
}
}
}
module _frontRailSegment() {
difference() {

View File

@ -2,13 +2,24 @@ include <../helper/sphericalFilet.scad>
include <../helper/cylindricalFilet.scad>
include <../helper/screws.scad>
include <./config.scad>
include <./derivedConfig.scad>
include <./xyBarConnector.scad>
include <./xBarBasePlateConnector.scad>
// Temporary
include <./yBar.scad>
include <./mainRail.scad>
xBarDepth = maxUnitWidth - 2*(railSlotSpacing + railScrewHoleToInnerEdge);
xBarDepth = 180;
xBarWidth = 32;
xBarHeight = 15;
xBarWallThickness = 3;
xBarRoundness = 5;
xBarWallThickness = 2;
xBarRoundness = baseRoundness;
//echo(xBarDepth);
module xBar() {
@ -24,11 +35,55 @@ module xBar() {
}
module xBar() {
module mirrorOtherCorner() {
children(0);
// TODO rename xBarDepth to xBarLength/xBarWidth
translate(v = [xBarDepth, 0, 0])
mirror(v = [1, 0, 0]) {
children(0);
}
}
// TODO refactor - probably better off mirroring the side faces and hulling the shell
difference() {
union() {
intersection () {
positive();
halfspace(vpos = [1, 0, 1], p = [0.5, 0, 0]);
halfspace(vpos = [-1, 0, 1], p = [xBarDepth-0.5, 0, 0]);
}
yBarConnectorFromXLug();
mirrorOtherCorner()
yBarConnectorFromXLug();
}
union() {
yBarConnectorFromX_N();
mirrorOtherCorner()
yBarConnectorFromX_N();
}
}
// TODO change me?
translate(v=[0,xBarWidth,0])
basePlateMount();
translate(v=[xBarDepth,xBarWidth,0])
mirror(v=[1,0,0])
basePlateMount();
}
xBar();
}
translate(v=[-30,0,0])
*yBar();
xBar();
//xBar();

View File

@ -0,0 +1,53 @@
include <../helper/common.scad>
include <../helper/screws.scad>
include <./config.scad>
module basePlateMount() {
screwHoleToBase = 6;
mountHeight = 10;
mountWidth = 10;
mountThickness = 2;
module support() {
r = 4;
difference () {
translate(v = [0, mountThickness, r/2])
rotate(a = [90, 0, 0])
rotate(a = [0, 0, 90])
cylinder(h = mountThickness, r = r, $fn = 3);
cube(size=[inf10, inf10, inf10]);
}
//translate([-r/2, -2,0])
//cube(size=[r/2, 0.1, 0.1]);
}
module positive() {
cube(size = [mountWidth, mountThickness, mountHeight]);
translate(v=[mountWidth,0,0])
mirror(v=[1,0,0])
hull() {
support();
}
}
module basePlateMount() {
translate(v=[0,-mountThickness,0])
difference() {
positive();
translate(v = [mountWidth/2, inf50/2, screwHoleToBase])
rotate(a = [90, 0, 0])
cylinder(h = inf50, r = screwRadiusSlacked(rackFrameScrewType));
}
}
basePlateMount();
}

View File

@ -1,8 +1,8 @@
include <../helper/screws.scad>
include <../helper/halfspace.scad>
include <./config.scad>
module frontBarConnector_N() {
module xBarConnectorFromY_N() {
y1 = 6;
y2 = 27;
z = 6;
@ -20,3 +20,35 @@ module frontBarConnector_N() {
rotate(a = [0, 45, 0])
cube(size = [3, 10, 6], center = true);
}
module yBarConnectorFromX_N() {
y1 = 6;
y2 = 27;
z = 6;
translate(v = [-inf50/2, y1, z])
rotate(a = [0, 90, 0])
cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = inf50, $fn = 32);
translate(v = [-inf50/2, y2, z])
rotate(a = [0, 90, 0])
cylinder(r = screwRadiusSlacked(rackFrameScrewType), h = inf50, $fn = 32);
}
// TODO: figure out nice abstraction to apply both positive and negative mods
module yBarConnectorFromXLug() {
y1 = 6;
y2 = 27;
z = 6;
intersection() {
// TODO fix this up, no center=true
translate(v = [-1, y1+(y2-y1)/2, 0])
rotate(a = [0, 45, 0])
scale(v=[0.90,0.90,0.95])
cube(size = [3, 10, 6], center = true);
mirror(v=[0,0,1])
halfspace(vpos=[0,0,1], p=[0,0,0]);
}
}

View File

@ -22,7 +22,7 @@ yBarWidth = railSlotSpacing + railTotalWidth + sideSpacing;
yBarHeight = 15;
yBarWallThickness = 3;
yBarRoundness = 5;
yBarRoundness = baseRoundness;
echo("Bar total depth: ", yBarDepth);
echo("Bar total width: ", yBarWidth);
@ -48,7 +48,7 @@ module yBar() {
railFeetSlot_N();
translate(v = [yBarWidth+eps, 0, 0])
frontBarConnector_N();
xBarConnectorFromY_N();
translate(v = [yBarWidth-(railTotalWidth+railSlotSpacing)-9, railSlotSpacing, yBarHeight])
sideWallConnector_N();