wip - add matrix transformations
This commit is contained in:
110
helper/matrix.scad
Normal file
110
helper/matrix.scad
Normal 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)]];
|
||||
|
||||
@ -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
78
rack/assemblyGuide.scad
Normal 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() {
|
||||
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
include <../helper/common.scad>
|
||||
include <../helper/slack.scad>
|
||||
include <../helper/halfspace.scad>
|
||||
include <../helper/screws.scad>
|
||||
include <./config.scad>
|
||||
include <./sharedVariables.scad>
|
||||
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>
|
||||
|
||||
_mountX = 12;
|
||||
_mountY = 14;
|
||||
@ -27,14 +31,15 @@ _heatSetY = _mountY - _innerYFaceToScrew;
|
||||
basePlateScrewMountToYBarXZFace = _heatSetY + joinCornerDepth; // Distance to the nearest YBar XZ face
|
||||
basePlateScrewMountToYBarYZFace = (yBarWidth+_heatSetX) - yBarBasePlateConnectorWidth;
|
||||
|
||||
module yBarBasePlateMount_P() {
|
||||
module onYBarBasePlateConnectorPositive() {
|
||||
translate(v=[0,0,yBarWallThickness])
|
||||
intersection() {
|
||||
cube(size = [_mountX, _mountY, _mountZ]);
|
||||
halfspace(vpos=[0, -1, -1], p=[0, _mountY-1, _mountZ-1]);
|
||||
}
|
||||
}
|
||||
|
||||
module yBarBasePlateMount_N() {
|
||||
module onYBarBasePlateConnectorNegative() {
|
||||
|
||||
translate(v=[_heatSetX, _heatSetY, m3HeatSetInsertSlotHeightSlacked + _baseConnRecession])
|
||||
mirror(v=[0,0,1])
|
||||
@ -48,9 +53,9 @@ module yBarBasePlateMount_N() {
|
||||
roundCutSlice(radius = _baseConnY/2 + radiusXYSlack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module roundCutSlice(radius, length=inf50) {
|
||||
|
||||
module roundCutSlice(radius, length=inf50) {
|
||||
|
||||
hull() {
|
||||
cylinder(r = radius, h = eps);
|
||||
@ -58,4 +63,6 @@ module roundCutSlice(radius, length=inf50) {
|
||||
translate(v = [length, -radius, 0])
|
||||
cube(size = [eps, radius*2, eps]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,46 +1,77 @@
|
||||
/*
|
||||
Connector factory
|
||||
*/
|
||||
include <../helper/screws.scad>
|
||||
include <../helper/slack.scad>
|
||||
include <../helper/dovetail.scad>
|
||||
include <../helper/halfspace.scad>
|
||||
include <./config.scad>
|
||||
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 <../config.scad>
|
||||
|
||||
include <./xBarYBarConnectors.scad>
|
||||
include <./mainRailYBarConnectors.scad>
|
||||
include <./sideModuleYBarConnectors.scad>
|
||||
include <./stackYBarConnectors.scad>
|
||||
include <./basePlateYBarConnectors.scad>
|
||||
|
||||
// WIP
|
||||
|
||||
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
|
||||
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) {
|
||||
|
||||
if (on == "yBar" && to == "xBar") {
|
||||
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) {
|
||||
@ -51,44 +82,14 @@ module connectorNegative(on, to) {
|
||||
onXBarToYBarNegative();
|
||||
} else if (on == "yBar" && to == "sideModule") {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
37
rack/connector/mainRailYBarConnectors.scad
Normal file
37
rack/connector/mainRailYBarConnectors.scad
Normal 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);
|
||||
}
|
||||
19
rack/connector/sideModuleYBarConnectors.scad
Normal file
19
rack/connector/sideModuleYBarConnectors.scad
Normal 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);
|
||||
}
|
||||
@ -1,9 +1,13 @@
|
||||
include <../helper/math.scad>
|
||||
include <../helper/common.scad>
|
||||
include <../helper/magnet.scad>
|
||||
include <../helper/screws.scad>
|
||||
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 <./config.scad>
|
||||
include <../sharedVariables.scad>
|
||||
|
||||
include <../config.scad>
|
||||
|
||||
connectorYEdgeToYBarYEdge = 5;
|
||||
connectorXEdgeToYBarXEdge = 5;
|
||||
@ -21,8 +25,6 @@ connectorRectSocketSlack = 0.2;
|
||||
|
||||
connectorBottomToScrew = 6;
|
||||
|
||||
*stackConnectorBottom();
|
||||
|
||||
module stackConnectorBase(rectSlack, topSlack=0.0) {
|
||||
|
||||
wSlacked = connectorRectWidth + rectSlack;
|
||||
@ -56,7 +58,7 @@ module stackConnectorBase(rectSlack, topSlack=0.0) {
|
||||
}
|
||||
|
||||
|
||||
module stackConnectorSocket_N() {
|
||||
module onYBarStackConnectorNegative() {
|
||||
|
||||
wSlacked = connectorRectWidth + connectorRectSocketSlack;
|
||||
dSlacked = connectorRectDepth + connectorRectSocketSlack;
|
||||
@ -89,6 +91,7 @@ module stackConnectorSocket_N() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module stackConnectorPlug() {
|
||||
|
||||
difference() {
|
||||
10
rack/connector/transformations.scad
Normal file
10
rack/connector/transformations.scad
Normal 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;
|
||||
71
rack/connector/xBarYBarConnectors.scad
Normal file
71
rack/connector/xBarYBarConnectors.scad
Normal 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]);
|
||||
@ -4,35 +4,26 @@ include <../helper/slack.scad>
|
||||
include <../helper/math.scad>
|
||||
include <../helper/halfspace.scad>
|
||||
include <./sharedVariables.scad>
|
||||
include <../helper/matrix.scad>
|
||||
|
||||
*mainRail();
|
||||
include <./connector/connectors.scad>
|
||||
|
||||
//mainRail();
|
||||
|
||||
module mainRail() {
|
||||
|
||||
b = 0.5; // 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]);
|
||||
}
|
||||
applyBevels()
|
||||
applyConnector(on="mainRail", to="yBar", trans=yBarConnectorTrans)
|
||||
applyConnector(on="mainRail", to="yBar", trans=mirrorOtherSideTrans * yBarConnectorTrans)
|
||||
mainRailBase();
|
||||
|
||||
module mainRailSharp() {
|
||||
module mainRailBase() {
|
||||
union() {
|
||||
frontRailSegment();
|
||||
|
||||
translate(v = [railSideMountThickness, railFrontThickness, 0])
|
||||
rotate(a = [0, 0, 90])
|
||||
sideSupportSegment();
|
||||
|
||||
translate(v = [0, railFrontThickness, 0]) {
|
||||
translate(v = [railSideMountThickness, 0, 0])
|
||||
railFeet();
|
||||
translate(v = [railSideMountThickness, 0, railTotalHeight])
|
||||
mirror(v=[0,0,1])
|
||||
railFeet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module frontRailSegment() {
|
||||
@ -59,26 +50,23 @@ module mainRail() {
|
||||
}
|
||||
}
|
||||
|
||||
module railFeet() {
|
||||
difference() {
|
||||
cube(size = [frontFaceWidth - railSideMountThickness, sideSupportDepth, railFootThickness]);
|
||||
|
||||
translate(v = [5, 4, railFootThickness])
|
||||
counterSunkHead_N(rackFrameScrewType, screwExtension=inf10, headExtension=inf10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module railFeetSlot_N() {
|
||||
yBarConnectorTrans = identity;
|
||||
|
||||
slotSlack = xySlack;
|
||||
slotZSlack = zSlack;
|
||||
mirrorOtherSideTrans = translate(v = [0, 0, railTotalHeight]) * mirror(v=[0,0,1]);
|
||||
|
||||
module applyBevels() {
|
||||
b = 0.5; // bevel value
|
||||
apply_n() {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
include <../helper/cylindricalFilet.scad>
|
||||
include <../helper/screws.scad>
|
||||
include <../helper/matrix.scad>
|
||||
|
||||
include <./config.scad>
|
||||
include <./xyBarConnector.scad>
|
||||
include <./sharedVariables.scad>
|
||||
// Temporary
|
||||
include <./yBar.scad>
|
||||
include <./connector/connectors.scad>
|
||||
|
||||
*xBar();
|
||||
|
||||
module xBar() {
|
||||
|
||||
applyYBarConnector()
|
||||
applyConnector(on="xBar", to="yBar", trans=xBarMirrorOtherCornerTrans * xBarYBarConnectorTrans)
|
||||
applyConnector(on="xBar", to="yBar", trans=xBarYBarConnectorTrans)
|
||||
xBarBase();
|
||||
|
||||
module xBarBase() {
|
||||
@ -29,24 +30,8 @@ module xBar() {
|
||||
}
|
||||
}
|
||||
|
||||
module mirrorOtherCorner() {
|
||||
children(0);
|
||||
|
||||
translate(v = [0, xBarX, 0])
|
||||
mirror(v = [0, 1, 0]) {
|
||||
children(0);
|
||||
}
|
||||
}
|
||||
|
||||
module applyYBarConnector() {
|
||||
apply_n() {
|
||||
|
||||
mirrorOtherCorner()
|
||||
rotate(a=[0,0,-90])
|
||||
yBarConnectorFromX_N();
|
||||
|
||||
children(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
xBarYBarConnectorTrans = rotate(a=[0,0,-90]);
|
||||
|
||||
xBarMirrorOtherCornerTrans = translate(v = [0, xBarX, 0]) * mirror(v = [0, 1, 0]);
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
include <../helper/math.scad>
|
||||
include <../helper/matrix.scad>
|
||||
include <../helper/sphericalFilet.scad>
|
||||
include <../helper/cylindricalFilet.scad>
|
||||
include <../helper/screws.scad>
|
||||
@ -6,10 +7,9 @@ include <../helper/magnet.scad>
|
||||
include <./config.scad>
|
||||
include <./mainRail.scad>
|
||||
|
||||
include <./connector/connectors.scad>
|
||||
|
||||
// Connectors
|
||||
include <./stackConnector.scad>
|
||||
include <./xyBarConnector.scad>
|
||||
include <./yBarBasePlateConnector.scad>
|
||||
include <./side/yBarSideWallConnector.scad>
|
||||
include <./sharedVariables.scad>
|
||||
|
||||
@ -17,11 +17,11 @@ include <./sharedVariables.scad>
|
||||
|
||||
module yBar() {
|
||||
|
||||
applyBasePlateConnector()
|
||||
applyStackConnector()
|
||||
applySideWallConnector()
|
||||
applyRailConnector()
|
||||
applyXBarConnector()
|
||||
applyOnYBarBothCorners(to="basePlate", trans=yBarBasePlateConnectorTrans)
|
||||
applyOnYBarBothCorners(to="stackConnector", trans=yBarStackConnectorTrans)
|
||||
applyOnYBarBothCorners(to="sideModule", trans=yBarSideModuleConnectorTrans)
|
||||
applyOnYBarBothCorners(to="mainRail", trans=yBarMainRailConnectorTrans)
|
||||
applyOnYBarBothCorners(to="xBar", trans=yBarXBarConnectorTrans)
|
||||
yBarBase();
|
||||
|
||||
module yBarBase() {
|
||||
@ -37,78 +37,28 @@ module yBar() {
|
||||
}
|
||||
}
|
||||
|
||||
module applyBasePlateConnector() {
|
||||
apply_pn() {
|
||||
mirrorOtherCorner() {
|
||||
translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, yBarWallThickness])
|
||||
yBarBasePlateMount_P();
|
||||
}
|
||||
|
||||
mirrorOtherCorner() {
|
||||
translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, 0])
|
||||
yBarBasePlateMount_N();
|
||||
}
|
||||
|
||||
// Helper module to apply connectors to both corners
|
||||
module applyOnYBarBothCorners(to, trans) {
|
||||
applyConnector(on="yBar", to=to, trans=trans)
|
||||
applyConnector(on="yBar", to=to, trans=yBarMirrorOtherCornerTrans * trans)
|
||||
children(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module applyStackConnector() {
|
||||
apply_n() {
|
||||
mirrorOtherCorner()
|
||||
translate(v = [connectorXEdgeToYBarXEdge, connectorYEdgeToYBarYEdge, 0])
|
||||
stackConnectorSocket_N();
|
||||
yBarMirrorOtherCornerTrans = translate(v = [0, yBarDepth, 0]) * mirror(v = [0, 1, 0]);
|
||||
|
||||
children(0);
|
||||
}
|
||||
}
|
||||
yBarBasePlateConnectorTrans = translate(v = [yBarWidth-yBarBasePlateConnectorWidth, joinCornerDepth, 0]);
|
||||
|
||||
module applySideWallConnector() {
|
||||
apply_n() {
|
||||
mirrorOtherCorner()
|
||||
translate(v = [
|
||||
yBarStackConnectorTrans = translate(v = [connectorXEdgeToYBarXEdge, connectorYEdgeToYBarYEdge, 0]);
|
||||
|
||||
yBarSideModuleConnectorTrans = translate(v = [
|
||||
yBarWidth-(railTotalWidth+railSlotToInnerYEdge+railSlotToSideWallSlot+sideWallConnectorSlotWidth),
|
||||
sideWallSlotToXZ,
|
||||
yBarHeight
|
||||
])
|
||||
yBarSideWallConnector_N();
|
||||
yBarHeight]);
|
||||
|
||||
children(0);
|
||||
}
|
||||
}
|
||||
yBarMainRailConnectorTrans = translate(v = [
|
||||
yBarWidth-(railTotalWidth+railSlotToInnerYEdge),
|
||||
railSlotToXZ,
|
||||
yBarHeight-railFootThickness]);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
yBarXBarConnectorTrans = translate(v = [yBarWidth+eps, 0, 0]);
|
||||
|
||||
Reference in New Issue
Block a user