wip - add matrix transformations

This commit is contained in:
zhao
2023-04-30 15:15:19 -04:00
parent c454ab074a
commit f1dbd714e1
14 changed files with 502 additions and 307 deletions

110
helper/matrix.scad Normal file
View File

@ -0,0 +1,110 @@
// Common matrix transformations
identity = [
[1,0,0,0],
[0,1,0,0],
[0,0,1,0],
[0,0,0,1],
];
function scale(v) = [
[v[0],0,0,0],
[0,v[1],0,0],
[0,0,v[2],0],
[0,0,0,1]
];
function rotatex(a) = [
[1,0,0,0],
[0,cos(a),-sin(a),0],
[0,sin(a),cos(a),0],
[0,0,0,1]
];
function rotatey(a) = [
[cos(a),0,sin(a),0],
[0,1,0,0],
[-sin(a),0,cos(a),0],
[0,0,0,1]
];
function rotatez(a) = [
[cos(a),-sin(a),0,0],
[sin(a),cos(a),0,0],
[0,0,1,0],
[0,0,0,1]
];
function rotate(a,v) =
(v == undef)
? rotatez(a[2])*rotatey(a[1])*rotatex(a[0])
: rotateanv(a,v/sqrt(v*v));
function translate(v) = [
[1,0,0,v[0]],
[0,1,0,v[1]],
[0,0,1,v[2]],
[0,0,0,1]
];
function mirrorabc(a,b,c) = [
[1-2*a*a,-2*a*b,-2*a*c,0],
[-2*a*b,1-2*b*b,-2*b*c,0],
[-2*a*c,-2*b*c,1-2*c*c,0],
[0,0,0,1]
];
function mirrornv(nv) = mirrorabc(nv[0],nv[1],nv[2]);
function mirror(v) = mirrornv(v/sqrt(v*v));
// taken from https://github.com/openscad/openscad/issues/1040#issuecomment-233208606
function det4x4(a) =
a[0][0]*a[1][1]*a[2][2]*a[3][3] + a[0][0]*a[1][2]*a[2][3]*a[3][1] + a[0][0]*a[1][3]*a[2][1]*a[3][2]
+ a[0][1]*a[1][0]*a[2][3]*a[3][2] + a[0][1]*a[1][2]*a[2][0]*a[3][3] + a[0][1]*a[1][3]*a[2][2]*a[3][0]
+ a[0][2]*a[1][0]*a[2][1]*a[3][3] + a[0][2]*a[1][1]*a[2][3]*a[3][0] + a[0][2]*a[1][3]*a[2][0]*a[3][1]
+ a[0][3]*a[1][0]*a[2][2]*a[3][1] + a[0][3]*a[1][1]*a[2][0]*a[3][2] + a[0][3]*a[1][2]*a[2][1]*a[3][0]
- a[0][0]*a[1][1]*a[2][3]*a[3][2] - a[0][0]*a[1][2]*a[2][1]*a[3][3] - a[0][0]*a[1][3]*a[2][2]*a[3][1]
- a[0][1]*a[1][0]*a[2][2]*a[3][3] - a[0][1]*a[1][2]*a[2][3]*a[3][0] - a[0][1]*a[1][3]*a[2][0]*a[3][2]
- a[0][2]*a[1][0]*a[2][3]*a[3][1] - a[0][2]*a[1][1]*a[2][0]*a[3][3] - a[0][2]*a[1][3]*a[2][1]*a[3][0]
- a[0][3]*a[1][0]*a[2][1]*a[3][2] - a[0][3]*a[1][1]*a[2][2]*a[3][0] - a[0][3]*a[1][2]*a[2][0]*a[3][1];
function invb00(a) = a[1][1]*a[2][2]*a[3][3] + a[1][2]*a[2][3]*a[3][1] + a[1][3]*a[2][1]*a[3][2] - a[1][1]*a[2][3]*a[3][2] - a[1][2]*a[2][1]*a[3][3] - a[1][3]*a[2][2]*a[3][1];
function invb01(a) = a[0][1]*a[2][3]*a[3][2] + a[0][2]*a[2][1]*a[3][3] + a[0][3]*a[2][2]*a[3][1] - a[0][1]*a[2][2]*a[3][3] - a[0][2]*a[2][3]*a[3][1] - a[0][3]*a[2][1]*a[3][2];
function invb02(a) = a[0][1]*a[1][2]*a[3][3] + a[0][2]*a[1][3]*a[3][1] + a[0][3]*a[1][1]*a[3][2] - a[0][1]*a[1][3]*a[3][2] - a[0][2]*a[1][1]*a[3][3] - a[0][3]*a[1][2]*a[3][1];
function invb03(a) = a[0][1]*a[1][3]*a[2][2] + a[0][2]*a[1][1]*a[2][3] + a[0][3]*a[1][2]*a[2][1] - a[0][1]*a[1][2]*a[2][3] - a[0][2]*a[1][3]*a[2][1] - a[0][3]*a[1][1]*a[2][2];
function invb10(a) = a[1][0]*a[2][3]*a[3][2] + a[1][2]*a[2][0]*a[3][3] + a[1][3]*a[2][2]*a[3][0] - a[1][0]*a[2][2]*a[3][3] - a[1][2]*a[2][3]*a[3][0] - a[1][3]*a[2][0]*a[3][2];
function invb11(a) = a[0][0]*a[2][2]*a[3][3] + a[0][2]*a[2][3]*a[3][0] + a[0][3]*a[2][0]*a[3][2] - a[0][0]*a[2][3]*a[3][2] - a[0][2]*a[2][0]*a[3][3] - a[0][3]*a[2][2]*a[3][0];
function invb12(a) = a[0][0]*a[1][3]*a[3][2] + a[0][2]*a[1][0]*a[3][3] + a[0][3]*a[1][2]*a[3][0] - a[0][0]*a[1][2]*a[3][3] - a[0][2]*a[1][3]*a[3][0] - a[0][3]*a[1][0]*a[3][2];
function invb13(a) = a[0][0]*a[1][2]*a[2][3] + a[0][2]*a[1][3]*a[2][0] + a[0][3]*a[1][0]*a[2][2] - a[0][0]*a[1][3]*a[2][2] - a[0][2]*a[1][0]*a[2][3] - a[0][3]*a[1][2]*a[2][0];
function invb20(a) = a[1][0]*a[2][1]*a[3][3] + a[1][1]*a[2][3]*a[3][0] + a[1][3]*a[2][0]*a[3][1] - a[1][0]*a[2][3]*a[3][1] - a[1][1]*a[2][0]*a[3][3] - a[1][3]*a[2][1]*a[3][0];
function invb21(a) = a[0][0]*a[2][3]*a[3][1] + a[0][1]*a[2][0]*a[3][3] + a[0][3]*a[2][1]*a[3][0] - a[0][0]*a[2][1]*a[3][3] - a[0][1]*a[2][3]*a[3][0] - a[0][3]*a[2][0]*a[3][1];
function invb22(a) = a[0][0]*a[1][1]*a[3][3] + a[0][1]*a[1][3]*a[3][0] + a[0][3]*a[1][0]*a[3][1] - a[0][0]*a[1][3]*a[3][1] - a[0][1]*a[1][0]*a[3][3] - a[0][3]*a[1][1]*a[3][0];
function invb23(a) = a[0][0]*a[1][3]*a[2][1] + a[0][1]*a[1][0]*a[2][3] + a[0][3]*a[1][1]*a[2][0] - a[0][0]*a[1][1]*a[2][3] - a[0][1]*a[1][3]*a[2][0] - a[0][3]*a[1][0]*a[2][1];
function invb30(a) = a[1][0]*a[2][2]*a[3][1] + a[1][1]*a[2][0]*a[3][2] + a[1][2]*a[2][1]*a[3][0] - a[1][0]*a[2][1]*a[3][2] - a[1][1]*a[2][2]*a[3][0] - a[1][2]*a[2][0]*a[3][1];
function invb31(a) = a[0][0]*a[2][1]*a[3][2] + a[0][1]*a[2][2]*a[3][0] + a[0][2]*a[2][0]*a[3][1] - a[0][0]*a[2][2]*a[3][1] - a[0][1]*a[2][0]*a[3][2] - a[0][2]*a[2][1]*a[3][0];
function invb32(a) = a[0][0]*a[1][2]*a[3][1] + a[0][1]*a[1][0]*a[3][2] + a[0][2]*a[1][1]*a[3][0] - a[0][0]*a[1][1]*a[3][2] - a[0][1]*a[1][2]*a[3][0] - a[0][2]*a[1][0]*a[3][1];
function invb33(a) = a[0][0]*a[1][1]*a[2][2] + a[0][1]*a[1][2]*a[2][0] + a[0][2]*a[1][0]*a[2][1] - a[0][0]*a[1][2]*a[2][1] - a[0][1]*a[1][0]*a[2][2] - a[0][2]*a[1][1]*a[2][0];
function inv4x4(a)= (1/det4x4(a))*[
[invb00(a),invb01(a),invb02(a),invb03(a)],
[invb10(a),invb11(a),invb12(a),invb13(a)],
[invb20(a),invb21(a),invb22(a),invb23(a)],
[invb30(a),invb31(a),invb32(a),invb33(a)]];

View File

@ -1,7 +0,0 @@
include <../helper/math.scad>
include <./config.scad>
include <./mainRail.scad>
include <./yBar.scad>
include <./xBar.scad>
// TODO

78
rack/assemblyGuide.scad Normal file
View File

@ -0,0 +1,78 @@
include <../helper/math.scad>
include <./config.scad>
include <./mainRail.scad>
include <./yBar.scad>
include <./xBar.scad>
attachXBarWithYBar();
module attachXBarWithYBar() {
// assemble x-y bar trays
yBar();
xBarSpaceToYBarSpace =
yBarXBarConnectorTrans *
xBarConnectorToYBarConnectorTrans *
inv4x4(xBarYBarConnectorTrans);
yBarSpaceToXBarSpace =
xBarYBarConnectorTrans *
yBarConnectorToXBarConnectorTrans *
inv4x4(yBarXBarConnectorTrans);
multmatrix(
xBarSpaceToYBarSpace *
xBarMirrorOtherCornerTrans *
yBarSpaceToXBarSpace
)
yBar();
multmatrix(
translate(v=[0,0,20]) *
xBarSpaceToYBarSpace
)
xBar();
multmatrix(
translate(v=[0,0,20]) *
yBarMirrorOtherCornerTrans *
xBarSpaceToYBarSpace
)
xBar();
}
module screwXBarAndYBar() {
// screw to connect x and y bars
}
module attachSideConnectorModulesToYBars() {
// attach side connector modules to y bars
}
module insertDowelsIntoSideWall() {
}
module connectXYTraysWithMainRailAndSideWall() {
}
module screwMainRailAndYBar() {
}
module attachFeet() {
}
module attachTops() {
}

View File

@ -1,9 +1,13 @@
include <../helper/common.scad> include <../../helper/screws.scad>
include <../helper/slack.scad> include <../../helper/common.scad>
include <../helper/halfspace.scad> include <../../helper/matrix.scad>
include <../helper/screws.scad> include <../../helper/slack.scad>
include <./config.scad> include <../../helper/dovetail.scad>
include <./sharedVariables.scad> include <../../helper/halfspace.scad>
include <../sharedVariables.scad>
include <../config.scad>
_mountX = 12; _mountX = 12;
_mountY = 14; _mountY = 14;
@ -27,14 +31,15 @@ _heatSetY = _mountY - _innerYFaceToScrew;
basePlateScrewMountToYBarXZFace = _heatSetY + joinCornerDepth; // Distance to the nearest YBar XZ face basePlateScrewMountToYBarXZFace = _heatSetY + joinCornerDepth; // Distance to the nearest YBar XZ face
basePlateScrewMountToYBarYZFace = (yBarWidth+_heatSetX) - yBarBasePlateConnectorWidth; basePlateScrewMountToYBarYZFace = (yBarWidth+_heatSetX) - yBarBasePlateConnectorWidth;
module yBarBasePlateMount_P() { module onYBarBasePlateConnectorPositive() {
translate(v=[0,0,yBarWallThickness])
intersection() { intersection() {
cube(size = [_mountX, _mountY, _mountZ]); cube(size = [_mountX, _mountY, _mountZ]);
halfspace(vpos=[0, -1, -1], p=[0, _mountY-1, _mountZ-1]); halfspace(vpos=[0, -1, -1], p=[0, _mountY-1, _mountZ-1]);
} }
} }
module yBarBasePlateMount_N() { module onYBarBasePlateConnectorNegative() {
translate(v=[_heatSetX, _heatSetY, m3HeatSetInsertSlotHeightSlacked + _baseConnRecession]) translate(v=[_heatSetX, _heatSetY, m3HeatSetInsertSlotHeightSlacked + _baseConnRecession])
mirror(v=[0,0,1]) mirror(v=[0,0,1])
@ -48,14 +53,16 @@ module yBarBasePlateMount_N() {
roundCutSlice(radius = _baseConnY/2 + radiusXYSlack); roundCutSlice(radius = _baseConnY/2 + radiusXYSlack);
} }
}
module roundCutSlice(radius, length=inf50) {
hull() { module roundCutSlice(radius, length=inf50) {
cylinder(r = radius, h = eps);
translate(v = [length, -radius, 0]) hull() {
cube(size = [eps, radius*2, eps]); cylinder(r = radius, h = eps);
translate(v = [length, -radius, 0])
cube(size = [eps, radius*2, eps]);
}
} }
} }

View File

@ -1,46 +1,77 @@
/* /*
Connector factory Connector factory
*/ */
include <../helper/screws.scad> include <../../helper/screws.scad>
include <../helper/slack.scad> include <../../helper/common.scad>
include <../helper/dovetail.scad> include <../../helper/matrix.scad>
include <../helper/halfspace.scad> include <../../helper/slack.scad>
include <./config.scad> include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../config.scad>
include <./xBarYBarConnectors.scad>
include <./mainRailYBarConnectors.scad>
include <./sideModuleYBarConnectors.scad>
include <./stackYBarConnectors.scad>
include <./basePlateYBarConnectors.scad>
// WIP // WIP
partList = ["yBar", "xBar", "mainRail", "xyPlate", "sideModule"]; partList = ["yBar", "xBar", "mainRail", "xyPlate", "sideModule"];
mirror(v=[1,0,0])
*connectorDebug(on="xBar", to="yBar", trans=identity);
*connectorDebug(on="yBar", to="xBar", trans=identity);
// Default is to apply the positive first // Default is to apply the positive first
module applyConnector(on,to, trans) { module applyConnector(on, to, trans) {
//apply_pn() { apply_pn() {
multmatrix(trans)
connectorPositive(on=on, to=to);
//} multmatrix(trans)
connectorNegative(on=on, to=to);
children(0);
}
}
module connectorDebug(on, to, trans) {
color([0,1,0])
multmatrix(trans)
connectorPositive(on=on, to=to);
color([1,0,0])
multmatrix(trans)
connectorNegative(on=on, to=to);
}
module applyConnectorDebug(on,to,trans) {
echo("on: ", on, "-- to:", to);
apply_p() {
multmatrix(trans)
connectorDebug(on=on,to=to,trans=trans);
children(0);
}
} }
module connectorPositive(on, to) { module connectorPositive(on, to) {
if (on == "yBar" && to == "xBar") { if (on == "yBar" && to == "xBar") {
onYBarToXBarPositive(); onYBarToXBarPositive();
} else if (on == "yBar" && to == "basePlate") {
onYBarBasePlateConnectorPositive();
} else if (on == "mainRail" && to == "yBar") {
onMainRailYBarConnectorPositive();
} }
module onYBarToXBarPositive() {
rotate(a=[0,0,-90])
dovetail(
topWidth = 15,
bottomWidth = 12,
height = 2,
length = yBarHeight,
headExtension = 1,
baseExtension = 2,
frontFaceLength = 2,
frontFaceScale = 0.95,
backFaceLength = 5,
backFaceScale = 1.2);
}
} }
module connectorNegative(on, to) { module connectorNegative(on, to) {
@ -51,44 +82,14 @@ module connectorNegative(on, to) {
onXBarToYBarNegative(); onXBarToYBarNegative();
} else if (on == "yBar" && to == "sideModule") { } else if (on == "yBar" && to == "sideModule") {
onYBarSideModuleNegative(); onYBarSideModuleNegative();
} else if (on == "yBar" && to == "mainRail") {
onYBarToMainRailNegative();
} else if (on == "yBar" && to == "stackConnector") {
onYBarStackConnectorNegative();
} else if (on == "yBar" && to == "basePlate") {
onYBarBasePlateConnectorNegative();
} else if (on == "mainRail" && to == "yBar") {
onMainRailYBarConnectorNegative();
} }
module onYBarToXBarNegative() {
y = 27;
z = 6;
translate(v = [-m3HeatSetInsertSlotHeightSlacked, y, z])
rotate(a = [0, 90, 0])
heatSetInsertSlot_N(rackFrameScrewType);
}
module onXBarToYBarNegative() {
y = 27;
z = 6;
slack = xySlack;
translate(v=[-0.5,14,0])
mirror(v=[1,0,0])
rotate(a=[0,0,-90])
dovetail(topWidth = 15+slack, bottomWidth = 12+slack, height = 2+slack, length = yBarHeight,
headExtension = 1, baseExtension = 2, frontFaceLength = 0.5, frontFaceScale = 1.05,
backFaceLength = 5, backFaceScale = 1.2);
// TODO clean this up
translate(v = [-6, y, z])
rotate(a = [0, -90, 0])
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
}
module onYBarSideModuleNegative() {
translate(v = [-xySlack/2, -xySlack/2, -sideWallConnLugDepression])
cube(size = [sideWallConnW+xySlack, sideWallConnD+xySlack, sideWallConnLugDepression]);
translate(v = [yBarScrewHoleToOuterYEdge, yBarScrewHoleToFrontXEdge, -(m3HeatSetInsertSlotHeightSlacked+sideWallConnLugDepression)])
heatSetInsertSlot_N(rackFrameScrewType);
}
} }

View File

@ -0,0 +1,37 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../sharedVariables.scad>
include <../config.scad>
module onYBarToMainRailNegative() {
slotSlack = xySlack;
slotZSlack = zSlack;
union() {
translate(v=[-slotZSlack/2, -slotSlack/2,0])
cube(size = [railTotalWidth+slotZSlack, railTotalDepth + slotSlack, railFootThickness]);
translate(v = [railSideMountThickness + 5, railFrontThickness + 4 , -m3HeatSetInsertSlotHeightSlacked])
heatSetInsertSlot_N(rackFrameScrewType);
}
}
module onMainRailYBarConnectorPositive() {
cube(size = [frontFaceWidth, sideSupportDepth+railFrontThickness, railFootThickness]);
}
module onMainRailYBarConnectorNegative() {
translate(v = [5+railSideMountThickness, 4+railFrontThickness, railFootThickness])
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
}

View File

@ -0,0 +1,19 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../sharedVariables.scad>
include <../config.scad>
module onYBarSideModuleNegative() {
translate(v = [-xySlack/2, -xySlack/2, -sideWallConnLugDepression])
cube(size = [sideWallConnW+xySlack, sideWallConnD+xySlack, sideWallConnLugDepression]);
translate(v = [yBarScrewHoleToOuterYEdge, yBarScrewHoleToFrontXEdge, -(m3HeatSetInsertSlotHeightSlacked+sideWallConnLugDepression)])
heatSetInsertSlot_N(rackFrameScrewType);
}

View File

@ -1,9 +1,13 @@
include <../helper/math.scad> include <../../helper/screws.scad>
include <../helper/common.scad> include <../../helper/common.scad>
include <../helper/magnet.scad> include <../../helper/matrix.scad>
include <../helper/screws.scad> include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <./config.scad> include <../sharedVariables.scad>
include <../config.scad>
connectorYEdgeToYBarYEdge = 5; connectorYEdgeToYBarYEdge = 5;
connectorXEdgeToYBarXEdge = 5; connectorXEdgeToYBarXEdge = 5;
@ -21,8 +25,6 @@ connectorRectSocketSlack = 0.2;
connectorBottomToScrew = 6; connectorBottomToScrew = 6;
*stackConnectorBottom();
module stackConnectorBase(rectSlack, topSlack=0.0) { module stackConnectorBase(rectSlack, topSlack=0.0) {
wSlacked = connectorRectWidth + rectSlack; wSlacked = connectorRectWidth + rectSlack;
@ -56,7 +58,7 @@ module stackConnectorBase(rectSlack, topSlack=0.0) {
} }
module stackConnectorSocket_N() { module onYBarStackConnectorNegative() {
wSlacked = connectorRectWidth + connectorRectSocketSlack; wSlacked = connectorRectWidth + connectorRectSocketSlack;
dSlacked = connectorRectDepth + connectorRectSocketSlack; dSlacked = connectorRectDepth + connectorRectSocketSlack;
@ -89,6 +91,7 @@ module stackConnectorSocket_N() {
} }
} }
module stackConnectorPlug() { module stackConnectorPlug() {
difference() { difference() {
@ -122,4 +125,4 @@ module stackConnectorBottom() {
stackConnectorPlug(); stackConnectorPlug();
translate(v=[0,0,-height]) translate(v=[0,0,-height])
cube(size=[connectorRectWidth+connectorRectPlugSlack, connectorRectDepth+connectorRectPlugSlack, height]); cube(size=[connectorRectWidth+connectorRectPlugSlack, connectorRectDepth+connectorRectPlugSlack, height]);
} }

View File

@ -0,0 +1,10 @@
// Spatial transformations between various parts' local spaces
include <./connectors.scad>
function transform(from, to) =
(from == "yBar" && to == "xBar")
? identity
: (from == "xBar" && to == "yBar")
? identity
: identity;

View File

@ -0,0 +1,71 @@
include <../../helper/screws.scad>
include <../../helper/common.scad>
include <../../helper/matrix.scad>
include <../../helper/slack.scad>
include <../../helper/dovetail.scad>
include <../../helper/halfspace.scad>
include <../sharedVariables.scad>
include <../config.scad>
// On xBar
module onXBarToYBarNegative() {
y = 27;
z = 6;
slack = xBarYBarDovetailSlack;
translate(v=[-slack,14,0])
mirror(v=[1,0,0])
rotate(a=[0,0,-90])
dovetail(
topWidth = 15+slack,
bottomWidth = 12+slack,
height = 2+slack,
length = yBarHeight,
headExtension = 1,
baseExtension = 2,
frontFaceLength = 0.5,
frontFaceScale = 1.05,
backFaceLength = 5,
backFaceScale = 1.2
);
// TODO clean this up
translate(v = [-xBarSideThickness, y, z])
rotate(a = [0, -90, 0])
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
}
// On yBar
module onYBarToXBarNegative() {
y = 27;
z = 6;
translate(v = [-m3HeatSetInsertSlotHeightSlacked, y, z])
rotate(a = [0, 90, 0])
heatSetInsertSlot_N(rackFrameScrewType);
}
module onYBarToXBarPositive() {
translate(v=[xBarYBarDovetailSlack, 14,0]) // TODO: variable for the 14
rotate(a=[0,0,-90])
dovetail(
topWidth = 15-xySlack, // figure out why we need this
bottomWidth = 12,
height = 2,
length = yBarHeight,
headExtension = 1,
baseExtension = 2,
frontFaceLength = 2,
frontFaceScale = 0.95,
backFaceLength = 5,
backFaceScale = 1.2
);
}
xBarConnectorToYBarConnectorTrans = mirror(v=[1,0,0]);
yBarConnectorToXBarConnectorTrans = mirror(v=[-1,0,0]);

View File

@ -4,81 +4,69 @@ include <../helper/slack.scad>
include <../helper/math.scad> include <../helper/math.scad>
include <../helper/halfspace.scad> include <../helper/halfspace.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
include <../helper/matrix.scad>
*mainRail(); include <./connector/connectors.scad>
//mainRail();
module mainRail() { module mainRail() {
b = 0.5; // bevel value applyBevels()
intersection() { applyConnector(on="mainRail", to="yBar", trans=yBarConnectorTrans)
mainRailSharp(); applyConnector(on="mainRail", to="yBar", trans=mirrorOtherSideTrans * yBarConnectorTrans)
halfspace(vpos=[1,1,0], p=[b,b,0]); mainRailBase();
halfspace(vpos=[1,0,1], p=[b,0,b]);
halfspace(vpos=[1,0,-1], p=[b,0,railTotalHeight-b]);
}
module mainRailSharp() { module mainRailBase() {
union() { union() {
frontRailSegment(); frontRailSegment();
translate(v = [railSideMountThickness, railFrontThickness, 0]) translate(v = [railSideMountThickness, railFrontThickness, 0])
rotate(a = [0, 0, 90]) rotate(a = [0, 0, 90])
sideSupportSegment(); sideSupportSegment();
}
translate(v = [0, railFrontThickness, 0]) { module frontRailSegment() {
translate(v = [railSideMountThickness, 0, 0]) difference() {
railFeet(); cube(size = [frontFaceWidth, railFrontThickness, railTotalHeight]);
translate(v = [railSideMountThickness, 0, railTotalHeight])
mirror(v=[0,0,1]) for (i = [1:numRailScrews]) {
railFeet(); translate(v = [railScrewHoleToOuterEdge, railFrontThickness / 2, i * screwDiff + railFootThickness])
rotate(a = [90, 0, 0])
hexNutPocket_N(mainRailScrewType);
}
} }
} }
}
module frontRailSegment() { module sideSupportSegment() {
difference() { difference() {
cube(size = [frontFaceWidth, railFrontThickness, railTotalHeight]); cube(size = [sideSupportDepth, railSideMountThickness, railTotalHeight]);
for (i = [1:numRailScrews]) { for (i = [1:numRailScrews]) {
translate(v = [railScrewHoleToOuterEdge, railFrontThickness / 2, i * screwDiff + railFootThickness]) translate(v = [frontScrewSpacing, railFrontThickness/2, i*screwDiff+railFootThickness])
rotate(a = [90, 0, 0]) rotate(a = [90, 0, 0])
hexNutPocket_N(mainRailScrewType); cylinder(r = screwRadiusSlacked(mainRailSideMountScrewType), h = inf10, $fn = 32);
}
} }
} }
} }
module sideSupportSegment() { yBarConnectorTrans = identity;
difference() {
cube(size = [sideSupportDepth, railSideMountThickness, railTotalHeight]); mirrorOtherSideTrans = translate(v = [0, 0, railTotalHeight]) * mirror(v=[0,0,1]);
for (i = [1:numRailScrews]) { module applyBevels() {
translate(v = [frontScrewSpacing, railFrontThickness/2, i*screwDiff+railFootThickness]) b = 0.5; // bevel value
rotate(a = [90, 0, 0]) apply_n() {
cylinder(r = screwRadiusSlacked(mainRailSideMountScrewType), h = inf10, $fn = 32); union() {
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]);
} }
children(0);
} }
} }
module railFeet() {
difference() {
cube(size = [frontFaceWidth - railSideMountThickness, sideSupportDepth, railFootThickness]);
translate(v = [5, 4, railFootThickness])
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
}
}
}
module railFeetSlot_N() {
slotSlack = xySlack;
slotZSlack = zSlack;
union() {
translate(v=[-slotZSlack/2, -slotSlack/2,0])
cube(size = [railTotalWidth+slotZSlack, railTotalDepth + slotSlack, railFootThickness]);
translate(v = [railSideMountThickness + 5, railFrontThickness + 4 , -m3HeatSetInsertSlotHeightSlacked])
heatSetInsertSlot_N(rackFrameScrewType);
}
} }

View File

@ -1,16 +1,17 @@
include <../helper/cylindricalFilet.scad> include <../helper/cylindricalFilet.scad>
include <../helper/screws.scad> include <../helper/screws.scad>
include <../helper/matrix.scad>
include <./config.scad> include <./config.scad>
include <./xyBarConnector.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
// Temporary include <./connector/connectors.scad>
include <./yBar.scad>
*xBar(); *xBar();
module xBar() { module xBar() {
applyYBarConnector() applyConnector(on="xBar", to="yBar", trans=xBarMirrorOtherCornerTrans * xBarYBarConnectorTrans)
applyConnector(on="xBar", to="yBar", trans=xBarYBarConnectorTrans)
xBarBase(); xBarBase();
module xBarBase() { module xBarBase() {
@ -29,24 +30,8 @@ module xBar() {
} }
} }
module mirrorOtherCorner() { }
children(0);
translate(v = [0, xBarX, 0]) xBarYBarConnectorTrans = rotate(a=[0,0,-90]);
mirror(v = [0, 1, 0]) {
children(0);
}
}
module applyYBarConnector() { xBarMirrorOtherCornerTrans = translate(v = [0, xBarX, 0]) * mirror(v = [0, 1, 0]);
apply_n() {
mirrorOtherCorner()
rotate(a=[0,0,-90])
yBarConnectorFromX_N();
children(0);
}
}
}

View File

@ -1,57 +0,0 @@
include <../helper/screws.scad>
include <../helper/slack.scad>
include <../helper/dovetail.scad>
include <../helper/halfspace.scad>
include <./config.scad>
module xBarConnectorFromY_N() {
y = 27;
z = 6;
translate(v = [-m3HeatSetInsertSlotHeightSlacked, y, z])
rotate(a = [0, 90, 0])
heatSetInsertSlot_N(rackFrameScrewType);
}
module xBarConnectorFromY_P() {
rotate(a=[0,0,-90])
dovetail(
topWidth = 15,
bottomWidth = 12,
height = 2,
length = yBarHeight,
headExtension = 1,
baseExtension = 2,
frontFaceLength = 2,
frontFaceScale = 0.95,
backFaceLength = 5,
backFaceScale = 1.2);
}
module yBarConnectorFromX_N() {
y = 27;
z = 6;
slack = xBarYBarDovetailSlack;
translate(v=[-0.5,14,0])
mirror(v=[1,0,0])
rotate(a=[0,0,-90])
dovetail(
topWidth = 15+slack,
bottomWidth = 12+slack,
height = 2+slack,
length = yBarHeight,
headExtension = 1,
baseExtension = 2,
frontFaceLength = 0.5,
frontFaceScale = 1.05,
backFaceLength = 5,
backFaceScale = 1.2);
// TODO clean this up
translate(v = [-xBarSideThickness, y, z])
rotate(a = [0, -90, 0])
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
}

View File

@ -1,4 +1,5 @@
include <../helper/math.scad> include <../helper/math.scad>
include <../helper/matrix.scad>
include <../helper/sphericalFilet.scad> include <../helper/sphericalFilet.scad>
include <../helper/cylindricalFilet.scad> include <../helper/cylindricalFilet.scad>
include <../helper/screws.scad> include <../helper/screws.scad>
@ -6,10 +7,9 @@ include <../helper/magnet.scad>
include <./config.scad> include <./config.scad>
include <./mainRail.scad> include <./mainRail.scad>
include <./connector/connectors.scad>
// Connectors // Connectors
include <./stackConnector.scad>
include <./xyBarConnector.scad>
include <./yBarBasePlateConnector.scad>
include <./side/yBarSideWallConnector.scad> include <./side/yBarSideWallConnector.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
@ -17,11 +17,11 @@ include <./sharedVariables.scad>
module yBar() { module yBar() {
applyBasePlateConnector() applyOnYBarBothCorners(to="basePlate", trans=yBarBasePlateConnectorTrans)
applyStackConnector() applyOnYBarBothCorners(to="stackConnector", trans=yBarStackConnectorTrans)
applySideWallConnector() applyOnYBarBothCorners(to="sideModule", trans=yBarSideModuleConnectorTrans)
applyRailConnector() applyOnYBarBothCorners(to="mainRail", trans=yBarMainRailConnectorTrans)
applyXBarConnector() applyOnYBarBothCorners(to="xBar", trans=yBarXBarConnectorTrans)
yBarBase(); yBarBase();
module yBarBase() { module yBarBase() {
@ -37,78 +37,28 @@ module yBar() {
} }
} }
module applyBasePlateConnector() { // Helper module to apply connectors to both corners
apply_pn() { module applyOnYBarBothCorners(to, trans) {
mirrorOtherCorner() { applyConnector(on="yBar", to=to, trans=trans)
translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, yBarWallThickness]) applyConnector(on="yBar", to=to, trans=yBarMirrorOtherCornerTrans * trans)
yBarBasePlateMount_P();
}
mirrorOtherCorner() {
translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, 0])
yBarBasePlateMount_N();
}
children(0);
}
}
module applyStackConnector() {
apply_n() {
mirrorOtherCorner()
translate(v = [connectorXEdgeToYBarXEdge, connectorYEdgeToYBarYEdge, 0])
stackConnectorSocket_N();
children(0);
}
}
module applySideWallConnector() {
apply_n() {
mirrorOtherCorner()
translate(v = [
yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth),
sideWallSlotToXZ,
yBarHeight
])
yBarSideWallConnector_N();
children(0);
}
}
module applyRailConnector() {
apply_n() {
mirrorOtherCorner()
translate(v = [yBarWidth-(railTotalWidth+railSlotToInnerYEdge), railSlotToXZ, yBarHeight-railFootThickness])
railFeetSlot_N();
children(0);
}
}
module applyXBarConnector() {
apply_pn() {
mirrorOtherCorner()
translate(v=[yBarWidth + 0.5,14,0])
xBarConnectorFromY_P();
mirrorOtherCorner()
translate(v = [yBarWidth+eps, 0, 0])
xBarConnectorFromY_N();
children(0);
}
}
module mirrorOtherCorner() {
children(0);
translate(v = [0, yBarDepth, 0])
mirror(v = [0, 1, 0])
children(0); children(0);
} }
} }
yBarMirrorOtherCornerTrans = translate(v = [0, yBarDepth, 0]) * mirror(v = [0, 1, 0]);
yBarBasePlateConnectorTrans = translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, 0]);
yBarStackConnectorTrans = translate(v = [connectorXEdgeToYBarXEdge, connectorYEdgeToYBarYEdge, 0]);
yBarSideModuleConnectorTrans = translate(v = [
yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth),
sideWallSlotToXZ,
yBarHeight]);
yBarMainRailConnectorTrans = translate(v = [
yBarWidth-(railTotalWidth+railSlotToInnerYEdge),
railSlotToXZ,
yBarHeight-railFootThickness]);
yBarXBarConnectorTrans = translate(v = [yBarWidth+eps, 0, 0]);