introduce script to generate assembly animation. still needs cleanup

This commit is contained in:
zhao
2023-08-11 19:19:03 -04:00
parent 9f5c0570c2
commit f896c04022
61 changed files with 845 additions and 178 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@
!/stl/mini/ !/stl/mini/
!/stl/micro/ !/stl/micro/
!/stl/nano/ !/stl/nano/
/assembly-guide/gifs/tmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -22,7 +22,7 @@ _profileConfigs = [
["micro", [ ["micro", [
["maxUnitWidth", 180], ["maxUnitWidth", 180],
["maxUnitDepth", 180], ["maxUnitDepth", 180],
["numRailScrews", 18] ["numRailScrews", 12]
]], ]],
["mini", [ ["mini", [
["maxUnitWidth", 205], ["maxUnitWidth", 205],

View File

@ -2,6 +2,7 @@
$fn=64; $fn=64;
eps=0.001; eps=0.001;
rh=1; // preview render helper :)
inf10 = 10; inf10 = 10;
inf50 = 50; inf50 = 50;
inf1000 = 1000; inf1000 = 1000;

View File

@ -3,14 +3,29 @@
name="anim" name="anim"
# Check if an argument is provided and update the variable if so # TODO provide through script
png_dir="./assembly-guide/gifs/tmp"
target_dir="./assembly-guide/gifs"
if [ -n "$1" ]; then if [ -n "$1" ]; then
name="$1" name="$1"
fi fi
if [ -n "$2" ]; then
png_dir="$2"
fi
if [ -n "$3" ]; then
target_dir="$3"
fi
echo "Current directory: $(pwd)"
filename_without_extension="${name%.*}" filename_without_extension="${name%.*}"
# needs tomorrow night openscad theme # needs tomorrow night openscad theme
convert -resize 20% -delay 6 -loop 0 -transparent "#1d1f21" -dispose previous frame000*.png "$filename_without_extension".gif # convert -resize 20% -delay 6 -loop 0 -transparent "#1d1f21" -dispose previous frame000*.png "$filename_without_extension".gif
gifsicle -O3 --colors=64 --scale 0.5 -i "$filename_without_extension".gif -o "$filename_without_extension".gif convert -resize 20% -delay 6 -loop 0 -dispose previous "$png_dir"/"$filename_without_extension"000*.png "$target_dir"/"$filename_without_extension".gif
gifsicle -O3 --colors=64 --scale 0.5 -i "$target_dir"/"$filename_without_extension".gif -o "$target_dir"/"$filename_without_extension".gif

View File

@ -4,7 +4,7 @@ include <../rack/sharedVariables.scad>
use <./plateBase.scad> use <./plateBase.scad>
patchPanel(slots=2); *patchPanel(slots=2);
module patchPanel (slots=8) { module patchPanel (slots=8) {
difference() { difference() {

View File

@ -1,7 +1,7 @@
include <./common.scad> include <./common.scad>
plateBase(U=2, plateThickness=3, screwType="m4", filletR=2); *plateBase(U=2, plateThickness=3, screwType="m4", filletR=2);
module plateBase(U, plateThickness, screwType, screwToXEdge=4.5, screwToYEdge=4.5, filletR=2) { module plateBase(U, plateThickness, screwType, screwToXEdge=4.5, screwToYEdge=4.5, filletR=2) {

View File

@ -0,0 +1,25 @@
include <./common.scad>
$vpt = [21,-15,20];
$vpr = [65,0,40];
$vpd = 50;
$vpf = 22.50;
addMagnetsToMagnetModules(at=$t);
module addMagnetsToMagnetModules(at=0) {
t = lerp(a=8,b=0,t=at);
if (!plasticMask) {
magnetModule();
}
function insertMagnetTrans(t=0) =
translate(v=[sideWallConnW-(magnetFaceToSideWallConnOuterYEdge+magnetHSlacked) + t,
magnetModuleMagnetMountDy,
magnetModuleMagnetMountDz]) *
rotate(a=[0,90,0]);
multmatrix(insertMagnetTrans(t=t))
magnet();
}

View File

@ -0,0 +1,26 @@
include <./common.scad>
$vpt = [40,44,70];
$vpr = [77,0,40];
$vpd = 370;
$vpf = 22.50;
addMagnetsToSideWall(at=$t);
module addMagnetsToSideWall(at=0) {
t = lerp(a=8,b=0,t=at);
if (!plasticMask) {
sideWallLeft();
}
function insertMagnetTrans(t=0) =
translate(v=[sideWallThickness+t, magnetMountToYBarFront, magnetMountToYBarTop-sideWallZHingeTotalClearance]) *
rotate(a=[0,90,0]);
multmatrix(insertMagnetTrans(t=t))
magnet();
multmatrix(translate(v=[0,0,sideWallZ - 2*(magnetMountToYBarTop- sideWallZHingeTotalClearance)]) * insertMagnetTrans(t=t))
magnet();
}

View File

@ -0,0 +1,59 @@
include <./common.scad>
use <./screwXBarAndYBar.scad>
use <./addMagnetsToMagnetModules.scad>
$vpt = [116,90,18];
$vpr = [56,0,42];
$vpd = 550;
$vpf = 22.50;
attachSideConnectorModulesToYBars(at=$t);
module attachSideConnectorModulesToYBars(at=0) {
elevation = lerp(a=8, b=0, t=at);
// side module to front corner ybar
function sideModuleTrans(t=0) =
translate(v=[sideWallConnW,0,t-sideWallConnLugDepression])
* yBarSideModuleConnectorTrans
* mirror(v=[1,0,0]); // mirror for magnetModule
screwXBarAndYBar(at=1);
multmatrix(sideModuleTrans(elevation))
union() {
addMagnetsToMagnetModules(at=1);
translate(v=[yBarScrewHoleToOuterYEdge,yBarScrewHoleToFrontXEdge,sideWallConnLugDepression + 2*elevation])
caseScrewA();
}
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * sideModuleTrans(elevation))
union() {
addMagnetsToMagnetModules(at=1);
translate(v=[yBarScrewHoleToOuterYEdge,yBarScrewHoleToFrontXEdge,sideWallConnLugDepression + 2*elevation])
caseScrewA();
}
multmatrix(yBarMirrorOtherCornerTrans * sideModuleTrans(elevation))
union() {
if (!plasticMask) {
hingeModule();
}
translate(v=[yBarScrewHoleToOuterYEdge,yBarScrewHoleToFrontXEdge,sideWallConnLugDepression + 2*elevation])
caseScrewA();
}
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * yBarMirrorOtherCornerTrans * sideModuleTrans(elevation))
union() {
if (!plasticMask) {
hingeModule();
}
translate(v=[yBarScrewHoleToOuterYEdge,yBarScrewHoleToFrontXEdge,sideWallConnLugDepression + 2*elevation])
caseScrewA();
}
}

View File

@ -0,0 +1,29 @@
include <./common.scad>
use <./slideHexNutsIntoYBar.scad>
$vpt = [116,90,18];
$vpr = [56,0,42];
$vpd = 550;
$vpf = 22.50;
attachXBarWithYBar(at=$t);
module attachXBarWithYBar(at=0) {
t = lerp(a=20, b=0, t=at);
// assemble x-y bar trays
multmatrix(translate(v = [0, 0, t]))
slideHexNutsIntoYBar(at=1);
multmatrix(translate(v = [0, 0, t])*xBarSpaceToYBarSpace*xBarMirrorOtherCornerTrans*yBarSpaceToXBarSpace)
slideHexNutsIntoYBar(at=1);
if (!plasticMask) {
multmatrix(xBarSpaceToYBarSpace)
xBar();
multmatrix(yBarMirrorOtherCornerTrans*xBarSpaceToYBarSpace)
xBar();
}
}

View File

@ -0,0 +1,50 @@
include <./common.scad>
use <./slideHexNutsIntoYBarXYPlate.scad>
$vpt = [96,110,70];
$vpr = [68,0,36];
$vpd = 700;
$vpf = 22.50;
attachXYPlates(at=$t);
module attachXYPlates(at=0,r=0) {
t = lerp(a=10,b=0,t=at);
// TODO fix xyPlate transformations
function xyPlateToYBarTrans() = translate(v=[6,6,0]) * yBarBasePlateConnectorTrans;
slideHexNutsIntoYBarXYPlate(at=1);
multmatrix(xyPlateToYBarTrans())
xyPlateWithScrews(t=t);
multmatrix(upperXYTrayTrans * xyPlateToYBarTrans())
xyPlateWithScrews(t=t);
module xyPlateWithScrews(t=0) {
module screw(t=0) {
translate(v=[0,0,-t])
mirror(v=[0,0,1])
caseScrewA();
}
if (!plasticMask) {
translate(v = [0, 0, -t])
xyPlate();
}
screw(t=2*t);
translate(v=[xyPlateConnDx, 0,0])
screw(t=2*t);
translate(v=[0, xyPlateConnDy,0])
screw(t=2*t);
translate(v=[xyPlateConnDx, xyPlateConnDy,0])
screw(t=2*t);
}
}

View File

@ -0,0 +1,36 @@
include <./common.scad>
use <./attachSideConnectorModulesToYBars.scad>
use <./propUpBottomXYTraywithSideWalls.scad>
$vpt = [71,123,88];
$vpr = [44,0,47];
$vpd = 450;
$vpf = 22.50;
attachXYTrays(at=$t);
module attachXYTrays(at=0,r=0) {
t1 = lerp(a=12, b=0, t=min(1, 2*at));
t2 = lerp(a=16, b=0, t=max(0, 2*at - 1));
module singleScrew() {
translate(v = [mainRailSlideHexOnYBarDx, mainRailSlideHexOnYBarDy, -5])
rotate(a=[-45,0,0])
translate(v=[0,0,14 + t2]) // length of caseScrewB
caseScrewA();
}
translate(v=[0,0,t1])
multmatrix(upperXYTrayTrans) {
attachSideConnectorModulesToYBars(at=1);
if (at >= 1/2) {
mirrorAllTrayCornersFromYBarSpace()
multmatrix(yBarMainRailConnectorTrans)
singleScrew();
}
}
propUpBottomXYTraywithSideWalls(at=1,r=r);
}

106
rack/assembly/common.scad Normal file
View File

@ -0,0 +1,106 @@
include <../../helper/common.scad>
include <../../config/common.scad>
include <../mainRail.scad>
include <../yBar.scad>
include <../xBar.scad>
include <../side/magnetModule.scad>
include <../side/hingeModule.scad>
include <../side/sideWallRight.scad>
include <../side/sideWallLeft.scad>
include <../stackEnds.scad>
include <../xyPlate.scad>
screwMask = false;
plasticMask = false;
sideSupportRailMask = true;
xBarSpaceToYBarSpace =
yBarXBarConnectorTrans *
xBarConnectorToYBarConnectorTrans *
inv4x4(xBarYBarConnectorTrans);
yBarSpaceToXBarSpace =
xBarYBarConnectorTrans *
yBarConnectorToXBarConnectorTrans *
inv4x4(yBarXBarConnectorTrans);
upperXYTrayTrans =
yBarMainRailConnectorTrans *
mirrorMainRailOtherSideTrans *
inv4x4(yBarMainRailConnectorTrans);
function feetToYBarTrans(t=0) =
translate(v=[connectorRectWidth/2,connectorRectDepth/2,-t]) *
yBarStackConnectorTrans *
mirror(v=[0,1,0]);
function stackConnectorTrans(t=0) =
upperXYTrayTrans *
yBarStackConnectorTrans;
module mirrorAllTrayCornersFromYBarSpace() {
children(0);
multmatrix(yBarMirrorOtherCornerTrans)
children(0);
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * yBarMirrorOtherCornerTrans)
children(0);
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * yBarMirrorOtherCornerTrans * yBarMirrorOtherCornerTrans)
children(0);
}
secondStackTrans = upperXYTrayTrans * mirror(v=[0,0,1]);
module caseScrewA() {
if (!screwMask) {
color([1, 1, 1]) {
difference() {
scale(v = [0.9, 0.9, 0.9])
counterSunkHead_N(rackFrameScrewType, screwExtension = 10, headExtension = 0.5);
cylinder($fn = 6, r = 1.5);
}
}
}
}
module caseScrewB() {
if (!screwMask) {
color([1, 1, 1]) {
difference() {
scale(v = [0.9, 0.9, 0.9])
counterSunkHead_N(rackFrameScrewType, screwExtension = 14, headExtension = 0.5);
cylinder($fn = 6, r = 1.5);
}
}
}
}
module hingeDowel() {
if (!screwMask) {
color([0, 1, 1])
cylinder(h = dowelPinH, r = dowelPinR);
}
}
module magnet() {
if (!screwMask) {
color([1, 1, 1])
cylinder(r = magnetR, h = magnetH);
}
}
module arrow(length) {
color([1,0,1]) {
translate(v = [0, 0, length-2])
cylinder(r1 = 2, r2 = 0.2, h = 2);
cylinder(r = 1, h = length-2);
}
}

View File

@ -0,0 +1,47 @@
include <./common.scad>
use <./attachSideConnectorModulesToYBars.scad>
$vpt = [96,110,70];
$vpr = [68,0,36];
$vpd = 700;
$vpf = 22.50;
connectXYTrayWithMainRails(at=$t);
module connectXYTrayWithMainRails(at=0) {
attachSideConnectorModulesToYBars(at=1);
function mainRailTrans() =
yBarMainRailConnectorTrans;
module railAndScrew(at) {
t1 = lerp(a=12, b=0, t=min(1, 2*at));
t2 = lerp(a=16, b=0, t=max(0, 2*at - 1));
if (!plasticMask) {
translate(v=[0,0,t1])
mainRail();
}
if (at >= 1/2) {
multmatrix(
translate(v = [mainRailSlideHexOnYBarDx, mainRailSlideHexOnYBarDy, -5])*
rotate(a = [-45, 0, 0]))
translate(v = [0, 0, 14 + t2]) // length of caseScrewB
caseScrewB();
}
}
multmatrix(mainRailTrans())
railAndScrew(at=at);
multmatrix(yBarMirrorOtherCornerTrans * mainRailTrans())
railAndScrew(at=at);
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * mainRailTrans())
railAndScrew(at=at);
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * yBarMirrorOtherCornerTrans * mainRailTrans())
railAndScrew(at=at);
}

View File

@ -1,47 +1,43 @@
include <../helper/common.scad> include <./common.scad>
include <../config/common.scad>
include <./mainRail.scad>
include <./yBar.scad>
include <./xBar.scad>
include <./side/magnetModule.scad>
include <./side/hingeModule.scad>
include <./side/sideWallRight.scad>
include <./side/sideWallLeft.scad>
include <./stackEnds.scad>
include <./xyPlate.scad>
include <../rack-mount/side-rail/dualMount.scad> $vpt = [23,22,20];
$vpr = [57,0,46];
$vpd = 60;
// TODO: this is completly broken. fix this and figure out a nice way to run this with cli commands // TODO: this is completly broken. fix this and figure out a nice way to run this with cli commands
assemblyInstructions(); assemblyInstructions(stepNum=0);
module assemblyInstructions () { module assemblyInstructions (stepNum=1) {
screwMask = false; screwMask = false;
plasticMask = false; plasticMask = false;
sideSupportRailMask = true; sideSupportRailMask = true;
// Instruction List (in order) module pickStep(stepNum) {
// render() children(stepNum);
// addHeatSetInsertsYBar(at=$t); }
// addMagnetsToMagnetModules(at=$t);
// addMagnetsToSideWall(at=$t); pickStep(stepNum=stepNum) {
// attachXBarWithYBar(at=$t); slideHexNutsIntoYBar(at = $t); // moved
// screwXBarAndYBar(at=$t); addMagnetsToMagnetModules(at = $t); // moved
// attachSideConnectorModulesToYBars(at=$t); addMagnetsToSideWall(at = $t); // moved
// connectXYTrayWithMainRails(at=1); attachXBarWithYBar(at = $t); // moved
// insertDowelsIntoSideWall(at=$t); screwXBarAndYBar(at=$t); // moved
// propUpBottomXYTraywithSideWalls(at=$t); attachSideConnectorModulesToYBars(at=$t); // moved
// attachXYTrays(at=$t); connectXYTrayWithMainRails(at=1); // moved
// slideHexNutToFeet(at=$t); insertDowelsIntoSideWall(at=$t); // moved
// insertFeet(at=$t); propUpBottomXYTraywithSideWalls(at=$t); // moved
// screwFeet(at=$t); attachXYTrays(at=$t); // moved
// attachXYPlates(at=$t); slideHexNutToFeet(at=$t);
insertFeet(at=$t); // moved
screwFeet(at=$t); // moved
attachXYPlates(at=$t); // moved
}
// Final builds: // Final builds:
// render() // render()
finalSingle(); // finalSingle();
// finalDouble(); // finalDouble();
// Features: // Features:
@ -51,7 +47,9 @@ module assemblyInstructions () {
// sideSwivel(at=$t); // sideSwivel(at=$t);
module addHeatSetInsertsYBar(at=0) { module slideHexNutsIntoYBar(at=0) {
t = lerp(a=10,b=0.35,t=at); // non zero b for exposing the heatset gears for diagramming t = lerp(a=10,b=0.35,t=at); // non zero b for exposing the heatset gears for diagramming
if (!plasticMask) { if (!plasticMask) {
@ -65,7 +63,7 @@ module assemblyInstructions () {
yBarSideModuleConnectorTrans; yBarSideModuleConnectorTrans;
function mainRailHeatSetTrans(t=0) = function mainRailHeatSetTrans(t=0) =
translate(v=[mainRailHeatSetOnYBarDx,mainRailHeatSetOnYBarDy,t-heatSetHeight]) * translate(v=[mainRailSlideHexOnYBarDx,mainRailSlideHexOnYBarDy,t-heatSetHeight]) *
yBarMainRailConnectorTrans; yBarMainRailConnectorTrans;
function xBarHeatSetTrans(t=0) = function xBarHeatSetTrans(t=0) =
@ -134,10 +132,10 @@ module assemblyInstructions () {
// assemble x-y bar trays // assemble x-y bar trays
multmatrix(translate(v = [0, 0, t])) multmatrix(translate(v = [0, 0, t]))
addHeatSetInsertsYBar(at=1); slideHexNutsIntoYBar(at=1);
multmatrix(translate(v = [0, 0, t])*xBarSpaceToYBarSpace*xBarMirrorOtherCornerTrans*yBarSpaceToXBarSpace) multmatrix(translate(v = [0, 0, t])*xBarSpaceToYBarSpace*xBarMirrorOtherCornerTrans*yBarSpaceToXBarSpace)
addHeatSetInsertsYBar(at=1); slideHexNutsIntoYBar(at=1);
if (!plasticMask) { if (!plasticMask) {
multmatrix(xBarSpaceToYBarSpace) multmatrix(xBarSpaceToYBarSpace)
@ -156,10 +154,10 @@ module assemblyInstructions () {
translate(v=[27,xBarSideThickness + extension,6]) * rotate(a=[270,0,0]); translate(v=[27,xBarSideThickness + extension,6]) * rotate(a=[270,0,0]);
// screw to connect x and y bars // screw to connect x and y bars
addHeatSetInsertsYBar(at=1); slideHexNutsIntoYBar(at=1);
multmatrix(xBarSpaceToYBarSpace*xBarMirrorOtherCornerTrans*yBarSpaceToXBarSpace) multmatrix(xBarSpaceToYBarSpace*xBarMirrorOtherCornerTrans*yBarSpaceToXBarSpace)
addHeatSetInsertsYBar(at=1); slideHexNutsIntoYBar(at=1);
multmatrix(xBarSpaceToYBarSpace) multmatrix(xBarSpaceToYBarSpace)
union() { union() {
@ -554,94 +552,5 @@ module assemblyInstructions () {
finalSingle(r=r); finalSingle(r=r);
} }
xBarSpaceToYBarSpace =
yBarXBarConnectorTrans *
xBarConnectorToYBarConnectorTrans *
inv4x4(xBarYBarConnectorTrans);
yBarSpaceToXBarSpace =
xBarYBarConnectorTrans *
yBarConnectorToXBarConnectorTrans *
inv4x4(yBarXBarConnectorTrans);
upperXYTrayTrans =
yBarMainRailConnectorTrans *
mirrorMainRailOtherSideTrans *
inv4x4(yBarMainRailConnectorTrans);
function feetToYBarTrans(t=0) =
translate(v=[connectorRectWidth/2,connectorRectDepth/2,-t]) *
yBarStackConnectorTrans *
mirror(v=[0,1,0]);
function stackConnectorTrans(t=0) =
upperXYTrayTrans *
yBarStackConnectorTrans;
module mirrorAllTrayCornersFromYBarSpace() {
children(0);
multmatrix(yBarMirrorOtherCornerTrans)
children(0);
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * yBarMirrorOtherCornerTrans)
children(0);
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * yBarMirrorOtherCornerTrans * yBarMirrorOtherCornerTrans)
children(0);
}
secondStackTrans = upperXYTrayTrans * mirror(v=[0,0,1]);
module caseScrewA() {
if (!screwMask) {
color([1, 1, 1]) {
difference() {
scale(v = [0.9, 0.9, 0.9])
counterSunkHead_N(rackFrameScrewType, screwExtension = 6, headExtension = 0.5);
cylinder($fn = 6, r = 1.5);
}
}
}
}
module caseScrewB() {
if (!screwMask) {
color([1, 1, 1]) {
difference() {
scale(v = [0.9, 0.9, 0.9])
counterSunkHead_N(rackFrameScrewType, screwExtension = 10, headExtension = 0.5);
cylinder($fn = 6, r = 1.5);
}
}
}
}
module hingeDowel() {
if (!screwMask) {
color([0, 1, 1])
cylinder(h = dowelPinH, r = dowelPinR);
}
}
module magnet() {
if (!screwMask) {
color([1, 1, 1])
cylinder(r = magnetR, h = magnetH);
}
}
module arrow(length) {
color([1,0,1]) {
translate(v = [0, 0, length-2])
cylinder(r1 = 2, r2 = 0.2, h = 2);
cylinder(r = 1, h = length-2);
}
}
} }

View File

@ -0,0 +1,25 @@
include <./common.scad>
use <./addMagnetsToSideWall.scad>
$vpt = [65,120,96];
$vpr = [66,0,112];
$vpd = 500;
$vpf = 22.50;
insertDowelsIntoSideWall(at=$t);
module insertDowelsIntoSideWall(at=0) {
t = lerp(a=10, b=0, t=at);
hingeHoleH = hingePoleH-sideWallConnLugDepression;
addMagnetsToSideWall(at=1);
translate(v=[hingePoleDx,hingePoleDy, (sideWallZ-hingeHoleH) + t])
hingeDowel();
translate(v=[hingePoleDx,hingePoleDy, (hingeHoleH-hingePoleH)-t])
hingeDowel();
}

View File

@ -0,0 +1,47 @@
include <./common.scad>
use <./slideHexNutToFeet.scad>
use <./attachXYPlates.scad>
$vpt = [95,90,10];
$vpr = [105,0,38];
$vpd = 650;
$vpf = 22.50;
insertFeet(at=$t);
module insertFeet(at=0,r=0) {
t = lerp(a=10,b=0,t=at);
attachXYPlates(at=1,r=r);
multmatrix(feetToYBarTrans(t=t))
slideHexNutToFeet(at=1);
multmatrix(yBarMirrorOtherCornerTrans * feetToYBarTrans(t=t))
slideHexNutToFeet(at=1);
}
module screwFeet(at=0,r=0) {
t = lerp(a=20, b=0, t=at);
function screwTrans(t=0) = translate(v=[-t - 9,0,connectorBottomToScrew]) * rotate(a=[0,-90,0]);
mirrorOtherFeetStackConnectorTrans = translate(v=[stackConnectorDx,0,0]) * mirror(v=[1,0,0]);
module screwToFeetModule() {
multmatrix(feetToYBarTrans(t = 0)*screwTrans(t = t))
caseScrewB(); // we might want a longer screw?
multmatrix(feetToYBarTrans(t = 0)*mirrorOtherFeetStackConnectorTrans*screwTrans(t = t))
caseScrewB();
}
screwToFeetModule();
multmatrix(yBarMirrorOtherCornerTrans)
screwToFeetModule();
insertFeet(at=1,r=r);
}

View File

@ -0,0 +1,32 @@
include <./common.scad>
use <./insertDowelsIntoSideWall.scad>
use <./connectXYTrayWithMainRails.scad>
$vpt = [96,110,70];
$vpr = [68,0,36];
$vpd = 700;
$vpf = 22.50;
propUpBottomXYTraywithSideWalls(at=$t, r=0);
module propUpBottomXYTraywithSideWalls(at=0, r=0) {
t = lerp(a=10,b=0,t=at);
function sideWallToYBarTrans(t=0,r=0) =
yBarMirrorOtherCornerTrans *
yBarSideModuleConnectorTrans * // bring to y bar space
mirror(v=[0,1,0]) *
translate(v=[0,0,t]) *
translate(v=[sideWallConnW/2.0, -hingePoleR, sideWallZHingeTotalClearance]) * // bring to side module space
rotate(a=[0,0,-r]) *
translate(v=[-hingePoleDx, -hingePoleDy, 0]);
connectXYTrayWithMainRails(at=1);
multmatrix(sideWallToYBarTrans(t=t, r=r))
insertDowelsIntoSideWall(at=1);
multmatrix(xBarSpaceToYBarSpace * xBarMirrorOtherCornerTrans * yBarSpaceToXBarSpace * sideWallToYBarTrans(t=t,r=r))
insertDowelsIntoSideWall(at=1);
}

View File

@ -0,0 +1,33 @@
include <./common.scad>
use <./insertFeet.scad>
$vpt = [95,90,10];
$vpr = [105,0,38];
$vpd = 650;
$vpf = 22.50;
screwFeet(at=$t);
module screwFeet(at=0,r=0) {
t = lerp(a=20, b=0, t=at);
function screwTrans(t=0) = translate(v=[-t - 9,0,connectorBottomToScrew]) * rotate(a=[0,-90,0]);
mirrorOtherFeetStackConnectorTrans = translate(v=[stackConnectorDx,0,0]) * mirror(v=[1,0,0]);
module screwToFeetModule() {
multmatrix(feetToYBarTrans(t = 0)*screwTrans(t = t))
caseScrewA();
multmatrix(feetToYBarTrans(t = 0)*mirrorOtherFeetStackConnectorTrans*screwTrans(t = t))
caseScrewA();
}
screwToFeetModule();
multmatrix(yBarMirrorOtherCornerTrans)
screwToFeetModule();
insertFeet(at=1,r=r);
}

View File

@ -0,0 +1,42 @@
include <./common.scad>
use <./attachXBarWithYBar.scad>
$vpt = [103,90,20];
$vpr = [68,0,36];
$vpd = 500;
$vpf = 22.50;
screwXBarAndYBar(at=$t);
module screwXBarAndYBar(at=0) {
screwExtension = lerp(a=16, b=0, t=at);
// in x bar space
function xBarYBarScrewTrans(extension) =
translate(v=[27,xBarSideThickness + extension,8]) * rotate(a=[270,0,0]);
attachXBarWithYBar(at=1);
multmatrix(xBarSpaceToYBarSpace)
union() {
if (!plasticMask) { xBar(); }
multmatrix(xBarYBarScrewTrans(screwExtension))
caseScrewB();
multmatrix(xBarMirrorOtherCornerTrans * xBarYBarScrewTrans(screwExtension))
caseScrewB();
}
multmatrix(yBarMirrorOtherCornerTrans*xBarSpaceToYBarSpace)
union() {
if (!plasticMask) { xBar(); }
multmatrix(xBarYBarScrewTrans(screwExtension))
caseScrewB();
multmatrix(xBarMirrorOtherCornerTrans * xBarYBarScrewTrans(screwExtension))
caseScrewB();
}
}

View File

@ -0,0 +1,31 @@
include <./common.scad>
$vpt = [75,-10,-14];
$vpr = [74,0,120];
$vpd = 300;
$vpf = 22.50;
slideHexNutToFeet(at=$t);
module slideHexNutToFeet(at=0) {
t = lerp(a=8, b=0, t=at);
module slideNut() {
if (!screwMask) {
rotate(a = [0, 0, 90])
rotate(a = [90, 0, 0])
hexNut(rackFrameScrewType);
}
}
translate(v=[0,t,connectorBottomToScrew + 0.5]) // where does this come from again? slack?
slideNut();
translate(v=[stackConnectorDx,t,connectorBottomToScrew + 0.5]) // where does this come from again? slack?
slideNut();
if (!plasticMask) {
stackConnectorFeet();
}
}

View File

@ -0,0 +1,52 @@
include <./common.scad>
$vpt = [43,66,41];
$vpr = [44,0,47];
$vpd = 350;
$vpf = 22.50;
slideHexNutsIntoYBar(at=$t);
module slideHexNutsIntoYBar(at=0)
{
t = lerp(a=20,b=0,t=at);
if (!plasticMask) {
yBar();
}
function sideModuleTrans(t=0) =
yBarSideModuleConnectorTrans *
translate(v = [yBarScrewHoleToOuterYEdge, yBarScrewHoleToFrontXEdge+t, -(4+sideWallConnLugDepression)]) *
rotate(a=[0,0,90]);
function mainRailTrans(t=0) =
yBarMainRailConnectorTrans *
translate(v = [mainRailSlideHexOnYBarDx+t, mainRailSlideHexOnYBarDy, -5]) *
rotate(a=[-45,0,0]);
function xBarTrans(t=0) =
translate(v = [-5, 27, 8+t]) *
yBarXBarConnectorTrans *
rotate(a=[0,90,0]);
module slideHexNutsOneCorner(t=0) {
multmatrix(sideModuleTrans(t = t))
hexNut(rackFrameScrewType);
multmatrix(mainRailTrans(t = t))
hexNut(rackFrameScrewType);
multmatrix(xBarTrans(t = t))
hexNut(rackFrameScrewType);
}
if (!screwMask) {
slideHexNutsOneCorner(t = t);
multmatrix(yBarMirrorOtherCornerTrans)
slideHexNutsOneCorner(t = t);
}
}

View File

@ -0,0 +1,41 @@
include <./common.scad>
use <./attachXYTrays.scad>
$vpt = [71,123,88];
$vpr = [44,0,47];
$vpd = 450;
$vpf = 22.50;
slideHexNutsIntoYBarXYPlate(at=$t);
module slideHexNutsIntoYBarXYPlate(at=0) {
t = lerp(a=12,b=0,t=at);
attachXYTrays(at=1,r=0);
slideHexNuts(t=t);
multmatrix(upperXYTrayTrans)
slideHexNuts(t=t);
module plateHexNut(t) {
multmatrix(yBarBasePlateConnectorTrans)
translate(v=[_heatSetX+t, _heatSetY, 4 + _baseConnRecession]) // TODO gotta rename these
hexNut(rackFrameScrewType);
}
module slideHexNuts(t=0) {
plateHexNut(t=t);
translate(v=[xyPlateConnDx, 0,0])
plateHexNut(t=-t);
translate(v=[0, xyPlateConnDy,0])
plateHexNut(t=t);
translate(v=[xyPlateConnDx, xyPlateConnDy,0])
plateHexNut(t=-t);
}
}

View File

@ -2,8 +2,8 @@ include <../../helper/common.scad>
include <../../config/common.scad> include <../../config/common.scad>
include <../sharedVariables.scad> include <../sharedVariables.scad>
mainRailHeatSetOnYBarDx = railSideMountThickness + 5; mainRailSlideHexOnYBarDx = railSideMountThickness + 5;
mainRailHeatSetOnYBarDy = railFrontThickness + 2; mainRailSlideHexOnYBarDy = railFrontThickness + 2;
module onYBarToMainRailNegative() { module onYBarToMainRailNegative() {
@ -14,7 +14,7 @@ module onYBarToMainRailNegative() {
translate(v=[-slotZSlack/2, -slotSlack/2,0]) translate(v=[-slotZSlack/2, -slotSlack/2,0])
cube(size = [railTotalWidth+slotZSlack, railTotalDepth + slotSlack, railFootThickness]); cube(size = [railTotalWidth+slotZSlack, railTotalDepth + slotSlack, railFootThickness]);
translate(v = [mainRailHeatSetOnYBarDx, mainRailHeatSetOnYBarDy, -5]) translate(v = [mainRailSlideHexOnYBarDx, mainRailSlideHexOnYBarDy, -5])
rotate(a=[-45,0,0]) rotate(a=[-45,0,0])
hexNutPocket_N("m3", openSide=false, backSpace=5); hexNutPocket_N("m3", openSide=false, backSpace=5);
} }
@ -36,7 +36,7 @@ module onMainRailYBarConnectorNegative() {
screwOffset = 9; screwOffset = 9;
translate(v = [mainRailHeatSetOnYBarDx, mainRailHeatSetOnYBarDy + screwOffset, -5 + screwOffset]) translate(v = [mainRailSlideHexOnYBarDx, mainRailSlideHexOnYBarDy + screwOffset, -5 + screwOffset])
rotate(a=[-45,0,0]) rotate(a=[-45,0,0])
counterSunkHead_N(rackFrameScrewType, screwExtension=inf50, headExtension=inf50); counterSunkHead_N(rackFrameScrewType, screwExtension=inf50, headExtension=inf50);

View File

@ -3,7 +3,7 @@ include <../config/common.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
include <./connector/connectors.scad> include <./connector/connectors.scad>
mainRail(); *mainRail();
module mainRail() { module mainRail() {

View File

@ -1,6 +1,6 @@
include <./sideWallBase.scad> include <./sideWallBase.scad>
sideWallLeft(); *sideWallLeft();
module sideWallLeft() { module sideWallLeft() {

View File

@ -1,6 +1,6 @@
include <./sideWallBase.scad> include <./sideWallBase.scad>
sideWallRight(); *sideWallRight();
module sideWallRight() { module sideWallRight() {

View File

@ -3,7 +3,7 @@ include <../config/common.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
include <./connector/connectors.scad> include <./connector/connectors.scad>
xBar(); *xBar();
module xBar() { module xBar() {

View File

@ -1,7 +1,7 @@
include <../helper/common.scad> include <../helper/common.scad>
include <./connector/connectors.scad> include <./connector/connectors.scad>
xyPlate(); *xyPlate();
xyPlateConnDx = xBarX + 2*_heatSetX; // X distance between connectors xyPlateConnDx = xBarX + 2*_heatSetX; // X distance between connectors
xyPlateConnDy = yBarDepth - 2*basePlateScrewMountToYBarXZFace; // Y distance between connectors xyPlateConnDy = yBarDepth - 2*basePlateScrewMountToYBarXZFace; // Y distance between connectors

View File

@ -3,7 +3,7 @@ include <../config/common.scad>
include <./connector/connectors.scad> include <./connector/connectors.scad>
include <./sharedVariables.scad> include <./sharedVariables.scad>
yBar(); *yBar();
module yBar() { module yBar() {

101
rbuild.py
View File

@ -4,12 +4,8 @@ import argparse
import subprocess import subprocess
import os import os
<<<<<<< HEAD PATH_TO_OPENSCAD = '/usr/bin/openscad'
PATH_TO_OPENSCAD = '/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD' PATH_TO_OPENSCAD_NIGHTLY = '/snap/bin/openscad-nightly'
=======
PATH_TO_OPENSCAD = 'openscad'
PATH_TO_OPENSCAD_NIGHTLY = 'path/to/nightly/build'
>>>>>>> 380dcb9 (update)
# For actual dimensions, please see profiles.scad. # For actual dimensions, please see profiles.scad.
class BuildSizeConfig: class BuildSizeConfig:
@ -17,7 +13,6 @@ class BuildSizeConfig:
MINI = 'mini' MINI = 'mini'
MICRO = 'micro' MICRO = 'micro'
RACK_BUILD_DIR = './rack/print' RACK_BUILD_DIR = './rack/print'
RACK_MOUNT_BUILD_DIR = './rack-mount/print' RACK_MOUNT_BUILD_DIR = './rack-mount/print'
@ -26,6 +21,29 @@ BUILD_PARENT_DIR = './stl'
RACK_BUILD_TARGET_SUB_DIR = 'rack' RACK_BUILD_TARGET_SUB_DIR = 'rack'
RACK_MOUNT_BUILD_TARGET_SUB_DIR = 'rack-mount' RACK_MOUNT_BUILD_TARGET_SUB_DIR = 'rack-mount'
ASSEMBLY_GIF_DIR = './rack/assembly'
ASSEMBLY_GIF_BUILD_DIR = './assembly-guide/gifs'
ASSEMBLY_GIF_TEMP_DIR = ASSEMBLY_GIF_BUILD_DIR + '/tmp'
BUILD_GIF_FROM_PNG_SCRIPT = './misc/animate.sh'
ASSEMBLY_STEPS = [
('slideHexNutsIntoYBar.scad', 16),
('addMagnetsToMagnetModules.scad', 16),
('addMagnetsToSideWall.scad', 16),
('attachXBarWithYBar.scad', 16),
('screwXBarAndYBar.scad', 16),
('attachSideConnectorModulesToYBars.scad', 16),
('connectXYTrayWithMainRails.scad', 16),
('insertDowelsIntoSideWall.scad', 16),
('propUpBottomXYTraywithSideWalls.scad', 16),
('slideHexNutsIntoYBarXYPlate.scad', 16),
('attachXYTrays.scad', 16),
('slideHexNutToFeet.scad', 16),
('insertFeet.scad', 16),
('screwFeet.scad', 16),
('attachXYPlates.scad', 16)
]
def main(): def main():
if not assertOpenscadExists(): if not assertOpenscadExists():
@ -72,6 +90,12 @@ def main():
help='Use openscad-nightly command. Should result in much faster build times.' help='Use openscad-nightly command. Should result in much faster build times.'
) )
parser.add_argument(
'--build_assembly_gifs',
action='store_true',
help='Generate the GIFS for the assembly guide.'
)
args = parser.parse_args() args = parser.parse_args()
run_build(args) run_build(args)
@ -79,14 +103,19 @@ def main():
def run_build(args): def run_build(args):
build_var = args.b build_var = args.b
if build_var is None:
print("Please provide the build (-b) variable") # TODO redundant
config_var = args.c config_var = args.c
target_var = args.t target_var = args.t
dz = args.dz dz = args.dz
nightly = args.nightly nightly = args.nightly
build_gifs = args.build_assembly_gifs
if (build_var is not None) == (build_gifs is True):
print("Please either provide the build (-b) variable, or the build-gifs option (--build-assembly-gifs)")
quit()
if build_gifs:
build_assembly_gifs(config_var, dz, nightly)
quit()
if target_var != "": if target_var != "":
final_target_directory_name = target_var final_target_directory_name = target_var
@ -128,12 +157,34 @@ def build_single(build_dir, target_dir, filename, config, dz, nightly):
openscad_args = construct_openscad_args(build_dir, target_dir, filename, config, dz) openscad_args = construct_openscad_args(build_dir, target_dir, filename, config, dz)
run_openscad(openscad_args, nightly) run_openscad(openscad_args, nightly)
def build_assembly_gifs(config, dz, nightly):
print('Building assembly-gifs. Source Dir:', ASSEMBLY_GIF_DIR, ', Target:', ASSEMBLY_GIF_BUILD_DIR)
def construct_openscad_args(build_dir, target_dir, filename, config, dz): for (fileName, numSteps) in ASSEMBLY_STEPS:
print('Rendering', fileName)
openscad_args = construct_openscad_animation_args(
ASSEMBLY_GIF_DIR, ASSEMBLY_GIF_TEMP_DIR, fileName, config, dz, numSteps
)
run_openscad(openscad_args, nightly)
print("Building GIF for", fileName)
build_gif_from_png(fileName)
print("Done")
def build_gif_from_png(fileName):
script_dir = os.path.dirname(os.path.abspath(__file__))
script_path = os.path.join(script_dir, BUILD_GIF_FROM_PNG_SCRIPT)
try:
subprocess.run(["bash", script_path, fileName], check=True)
except subprocess.CalledProcessError as e:
print(f"Error calling shell script: {e}")
def construct_openscad_args(build_dir, target_dir, filename, config, dz, format='.stl'):
source = os.path.join(build_dir, filename) source = os.path.join(build_dir, filename)
target = os.path.join(target_dir, os.path.splitext(filename)[0] + '.stl') target = os.path.join(target_dir, os.path.splitext(filename)[0] + format)
openscad_args = ['-D', 'profileName=\"' + config + '\"'] openscad_args = ['--export-format', 'binstl']
openscad_args += ['-D', 'profileName=\"' + config + '\"']
if dz != 0: if dz != 0:
openscad_args += ['-D', 'numRailScrews=' + dz] openscad_args += ['-D', 'numRailScrews=' + dz]
@ -146,6 +197,22 @@ def construct_openscad_args(build_dir, target_dir, filename, config, dz):
return openscad_args return openscad_args
def construct_openscad_animation_args(build_dir, target_dir, filename, config, dz, steps):
source = os.path.join(build_dir, filename)
target = os.path.join(target_dir, os.path.splitext(filename)[0] + '.png')
openscad_args = []
openscad_args += ['--colorscheme', 'BeforeDawn']
openscad_args += ['--render']
openscad_args += ['--imgsize', '1920,1080']
openscad_args += ['--projection', 'o']
openscad_args += ['--animate', str(steps)]
openscad_args += ['-o', target, source]
return openscad_args
def find_rack(filename): def find_rack(filename):
return find_scad_file(RACK_BUILD_DIR, filename) return find_scad_file(RACK_BUILD_DIR, filename)
@ -178,17 +245,13 @@ def run_openscad(options, nightly):
else: else:
command = [PATH_TO_OPENSCAD] command = [PATH_TO_OPENSCAD]
command += ['--export-format', 'binstl'] + options command += options
try: try:
subprocess.check_output(command, universal_newlines=True, stderr=subprocess.DEVNULL) subprocess.check_output(command, universal_newlines=True, stderr=subprocess.DEVNULL)
except FileNotFoundError: except FileNotFoundError:
print('OpenSCAD command not found! ' print('OpenSCAD command not found! '
<<<<<<< HEAD
'Please make sure that you have OpenSCAD installed and can run OpenSCAD CLI commands. '
=======
'Please make sure that you have the OpenSCAD binary configured in rbuild.py.' 'Please make sure that you have the OpenSCAD binary configured in rbuild.py.'
>>>>>>> 380dcb9 (update)
'(Currently needs Linux/Mac for this)') '(Currently needs Linux/Mac for this)')
def assertOpenscadExists(): def assertOpenscadExists():
return os.path.exists(PATH_TO_OPENSCAD) return os.path.exists(PATH_TO_OPENSCAD)

View File

@ -1,6 +1,6 @@
include <../common.scad> include <../../../config/common.scad>
include <../rack/screws.scad> include <../../../helper/common.scad>
include <../sine.scad> include <../../../rack-mount/plateBase.scad>
vU = 2; vU = 2;
uHeight = 10; uHeight = 10;
@ -20,7 +20,7 @@ frontPlateH = plateScrewDiffH + 2*plateScrewToVEdge;
plateScrewToBoxMin = 6; plateScrewToBoxMin = 6;
length = 170; length = 150;
resolution = 250; resolution = 250;
period = PI/6; period = PI/6;
shift = 0.0; shift = 0.0;
@ -28,11 +28,6 @@ amplitudeFunction = function(x) 2;
module _frontPlateBody() { module _frontPlateBody() {
difference() {
translate(v = [- plateScrewToVEdge, 0, - plateScrewToHEdge])
cube(size = [frontPlateH, frontPlateThickness, frontPlateV]);
}
translate(v=[5,-3,-1]) translate(v=[5,-3,-1])
rotate(a=[180,0,0]) rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period+0.02, 2, 5); sineWaveHull(length, resolution, amplitudeFunction, period+0.02, 2, 5);
@ -69,7 +64,6 @@ module _plateHole() {
module frontPlate() { module frontPlate() {
difference() { difference() {
_frontPlateBody(); _frontPlateBody();
@ -90,11 +84,13 @@ module frontPlate() {
} }
} }
difference() { difference() {
difference() { difference() {
difference() { difference() {
union() { union() {
plateBase(U=2, plateThickness=2.5, screwType="m4", filletR=2);
rotate(a = [- 90, 0, 0]) rotate(a = [- 90, 0, 0])
frontPlate(); frontPlate();
} }
@ -105,7 +101,7 @@ difference() {
translate(v=[0,-50,0]) translate(v=[0,-50,0])
cube(size=[100, 100, 30]); cube(size=[100, 100, 30]);
translate(v=[180-1,0,0]) translate(v=[160-1,0,0])
mirror(v=[1,0,0]) { mirror(v=[1,0,0]) {
rotate(a = [0, - 15, 0]) rotate(a = [0, - 15, 0])
translate(v = [0, - 50, 0]) translate(v = [0, - 50, 0])
@ -116,14 +112,14 @@ difference() {
} }
// lug holes // lug holes
union() { union() {
translate(v=[160,-3,-frontPlateThickness]) translate(v=[150,-3,-frontPlateThickness])
cube(size=[5.2, 5.2, 3]); cube(size=[5.2, 5.2, 3]);
translate(v=[160-91.1,-3,-frontPlateThickness]) translate(v=[150-91.1,-3,-frontPlateThickness])
cube(size=[5.2, 5.2, 3]); cube(size=[5.2, 5.2, 3]);
} }
} }
for (i=[0:5]) { for (i=[0:5]) {
translate(v=[5,i*4 - 0.75,-10]) translate(v=[5,i*4 - 0.75,-10])
cube(size=[170, 1.5, 20]); cube(size=[150, 1.5, 20]);
} }
} }

View File

@ -5,8 +5,8 @@ TODO this case has many many problems as it currently is. The following
- no locking lid for case - no locking lid for case
*/ */
include <../common.scad> include <../../../config/common.scad>
include <../../../helper/common.scad>
// All coordinates are in [x,y], or [x,y,z] format // All coordinates are in [x,y], or [x,y,z] format
pcbDimensions = [56.0, 85.1]; // [x,y] pcbDimensions = [56.0, 85.1]; // [x,y]
@ -134,7 +134,7 @@ module cutoutProfile_N() {
// front I/O // front I/O
mirror(v=[0,1,0]) mirror(v=[0,1,0])
translate(v=[1, -eps*100, pcbThickness-4]) translate(v=[1, -eps*100, pcbThickness-4])
cube(size=[58.0 + 0.1, inf50, 19.0 + 0.1]); cube(size=[58.0 + 0.1, inf50, 21 + 0.1]);
// side I/O // side I/O
translate(v=[-48-3, (pcbDimensions[1]-54)-10, pcbThickness-4]) translate(v=[-48-3, (pcbDimensions[1]-54)-10, pcbThickness-4])

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.