This commit is contained in:
zhao
2022-11-05 18:47:13 -04:00
parent 5edad72862
commit d81b129686
27 changed files with 535 additions and 20902 deletions

0
cases/hinge.scad Normal file
View File

View File

@ -111,8 +111,8 @@ module patchPanel_P() {
frontPlate(); frontPlate();
for (i = [0:7]) { for (i = [0:7]) {
translate(v=[(i*20+12.5)-2.5,0,-3.5]) translate(v=[(i*20+12.5)-2.5,0,-4.5])
cube(size=[20,6,28]); cube(size=[20,6,29]);
} }
} }
@ -123,7 +123,7 @@ module patchPanel() {
patchPanel_P(); patchPanel_P();
for (i = [0:7]) { for (i = [0:7]) {
translate(v=[i*20 + 12.5,0,0]) translate(v=[i*18 + 12.5,0,-2])
keystoneJack_N(); keystoneJack_N();
} }
} }

Binary file not shown.

View File

@ -0,0 +1,19 @@
sideHeight = 210;
sideLength = 200;
holeOffset = 10;
// TODO make helper function for this
screwDiffs = [
[sideLength-holeOffset, sideHeight-holeOffset,0],
[holeOffset, holeOffset,0],
[sideLength-holeOffset, holeOffset],
[holeOffset, sideHeight-holeOffset],
[sideLength-2*holeOffset, sideHeight-holeOffset,0],
[2*holeOffset, holeOffset,0],
[sideLength-2*holeOffset, holeOffset],
[2*holeOffset, sideHeight-holeOffset]
];

View File

@ -62,7 +62,7 @@ difference() {
union() { union() {
translate(v=[160,-3,-frontPlateThickness]) translate(v=[160,-3,-frontPlateThickness])
cube(size=[5.2, 5.2, 3]); cube(size=[5.2, 5.2, 3]);
translate(v=[160-88,-3,-frontPlateThickness]) translate(v=[160-91.1,-3,-frontPlateThickness])
cube(size=[5.2, 5.2, 3]); cube(size=[5.2, 5.2, 3]);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -81,11 +81,6 @@ module trayBody() {
cube(size=[5,2,5]); cube(size=[5,2,5]);
translate(v=[trayOuterWidth-5,-2,0]) translate(v=[trayOuterWidth-5,-2,0])
cube(size=[5,2,5]); cube(size=[5,2,5]);
translate(v=[0,-2,20])
cube(size=[5,2,5]);
translate(v=[trayOuterWidth-5,-2,20])
cube(size=[5,2,5]);
} }
} }

View File

@ -1,99 +1,261 @@
include <../common.scad> include <../common.scad>
include <./screws.scad> include <./screws.scad>
include <../rockpro/rockpro.scad> include <../risers.scad>
vU = 4; // TODO currently only for rockpro64 - make generic
vU = 3;
uHeight = 10; uHeight = 10;
plateScrewDiffV = uHeight*vU;
plateScrewDiffH = 180;
plateScrewToHEdge = 4.5; // Front Plate dimensions
plateScrewToVEdge = 5.5; frontPlateScrewDiffV = uHeight*vU;
frontPlateScrewDiffH = 180;
frontPlateHeightTopSpace = 0.25; // Give some space at the top for the lid
frontPlateHeightBottomSpace = 0;
frontPlateHeight = (vU+1)*uHeight - (frontPlateHeightBottomSpace+frontPlateHeightTopSpace);
frontPlateWidth = 190;
frontPlateBottomScrewToHEdge = uHeight/2 + frontPlateHeightBottomSpace;
frontPlateTopScrewToHEdge = uHeight/2 + frontPlateHeightTopSpace;
frontPlateScrewToVEdge = (frontPlateWidth - frontPlateScrewDiffH)/2;
frontPlateThickness = 2.5; frontPlateThickness = 2.5;
frontPlateV = plateScrewDiffV + 2*plateScrewToHEdge;
frontPlateH = plateScrewDiffH + 2*plateScrewToVEdge;
plateScrewToBoxMin = 6; plateScrewToBoxMin = 6;
// BOX CONFIG // BOX CONFIG
// box dimensions // box dimensions
boxDepth = 135; boxDepth = 132;
boxWidth = 95; boxWidth = 160;
boxBottomThickness = 1; boxBottomThickness = 2;
boxSideThickness = 2; boxSideThickness = 2;
boxBackThickness = 2; boxBackThickness = 2;
// boxFrontThickness is just frontPlateThickness boxFrontThickness = 2;
boxTopSpace = 1; // meant for lids? boxTopSpace = 1; // meant for lids?
boxBottomSpace = 1; // meant to be used for boxes that expect support rails boxBottomSpace = 1; // meant to be used for boxes that expect support rails (edit: not using right now)
boxHeight = (vU+1) * uHeight - (boxBottomSpace+boxTopSpace);
boxHeight = vU * uHeight + 2*plateScrewToHEdge - (boxBottomSpace+boxTopSpace); boxInnerDepth = boxDepth - (boxBackThickness+boxFrontThickness);
boxInnerHeight = boxHeight - boxBottomThickness; // TODO support lids
boxInnerWidth = boxWidth - 2*boxSideThickness;
// all of these are defined on the xy plane with centered zLen height // all of these are defined on the xy plane with centered zLen height
// 'rise' is meant model how raised a pcb is. More specifically, the distance between the top of // 'rise' is meant model how raised a pcb is. More specifically, the distance between the top of
// the pcb and the bottom of the inside of the case // the pcb and the bottom of the inside of the case
module frontFaceHoles(zLen, rise) { module frontFace_N(zLen, rise) {
translate(v=[7.5,2,0])
//mirror(v=[0,1,0]) cube(size=[boxInnerWidth - 15, boxInnerHeight-8, zLen]);
// translate(v=[5,-eps,rise])
//frontFaceIOCutouts_N();
} }
module backFaceHoles(zLen, rise) { module backFace_N(zLen, rise) {
translate(v=[7.5,2,0])
cube(size=[boxInnerWidth - 15, boxInnerHeight-8, zLen]);
} }
module leftFaceHoles(zLen, rise) { module leftFace_N(zLen, rise) {
translate(v=[7.5,2,0])
cube(size=[boxInnerDepth - 15, boxInnerHeight-8, zLen]);
} }
module rightFaceHoles(zLen, rise) { module rightFace_N(zLen, rise) {
translate(v=[7.5,2,0])
cube(size=[boxInnerDepth - 15, boxInnerHeight-8, zLen]);
} }
module boxBody() { module boxBody() {
// save this transformation... // save this transformation...
// translate(v=[(plateScrewDiffH-boxWidth)/2.0,0,boxBottomSpace -plateScrewToHEdge]) // translate(v=[(plateScrewDiffH-boxWidth)/2.0,0,boxBottomSpace -plateScrewToHEdge])
// convert to inside box space // convert to inside box space
translate(v=[-boxSideThickness, -frontPlateThickness, -boxBottomThickness]) translate(v=[-boxSideThickness, -boxFrontThickness, -boxBottomThickness])
difference() { difference() {
cube(size=[boxWidth, boxDepth, boxHeight]); cube(size=[boxWidth, boxDepth, boxHeight]);
translate(v=[boxSideThickness, frontPlateThickness, boxBottomThickness]) translate(v=[boxSideThickness, boxFrontThickness, boxBottomThickness])
cube(size=[boxWidth-2*boxSideThickness, boxDepth-(boxBackThickness+frontPlateThickness), inf]); cube(size=[boxWidth-2*boxSideThickness, boxDepth-(boxBackThickness+boxFrontThickness), inf]);
} }
}
module boxBodyWithHoles() {
m_trans_back =
[ [-1, 0, 0, boxInnerWidth],
[0, -1, 0, boxInnerDepth-boxBackThickness],
[0, 0, 1, 0],
[0, 0, 0, 1]];
m_trans_left_side =
[ [cos(-90), -sin(-90), 0, 0],
[sin(-90), cos(-90), 0, boxInnerDepth],
[0, 0, 1, 0],
[0, 0, 0, 1]];
m_trans_right_side =
[ [cos(90), -sin(90), 0, boxInnerWidth],
[sin(90), cos(90), 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]];
difference() {
boxBody();
union() {
rotate(a=[90,0,0])
frontFace_N(10, 0);
multmatrix(m_trans_back)
rotate(a=[90,0,0])
backFace_N(10, 0);
multmatrix(m_trans_left_side)
rotate(a=[90,0,0])
leftFace_N(10, 0);
multmatrix(m_trans_right_side)
rotate(a=[90,0,0])
rightFace_N(10, 0);
}
}
}
// lid + lugging
module cylinderLug_M(length, radius) {
rotate(a=[0,90,0])
cylinder(h=length, r=radius, center=true);
}
module cylinderLug(lMult=1, rMult=1) {
cylinderLug_M(6*lMult, 1*rMult);
}
function lerp(u, a, b) = (1-u)*a + u*b;
module lugLine(a,b, numLugs, lMult=1, rMult=1) {
assert(numLugs>0);
// require straight line that is level (same z values) either parallel with the x axis, or y axis
// this just avoids some math and simplifies things
assert(a[2] == b[2] && (a[0]==b[0] || a[1]==b[1]));
direction = norm(b-a);
for (i=[0:numLugs-1]) {
u = (i+1)/(numLugs+1);
if (a[1] == b[1]) {
translate(v=lerp(u,a,b))
cylinderLug(lMult, rMult);
} else if (a[0] == b[0]) {
translate(v=lerp(u,a,b))
rotate(a=[0,0,90])
cylinderLug(lMult,rMult);
}
}
}
module lugProfile(height, sideEps=0, lMult=1, rMult=1) {
points = [
[0+sideEps,0+sideEps,height],
[boxInnerWidth-sideEps,0+sideEps,height],
[boxInnerWidth-sideEps, boxInnerDepth-sideEps, height],
[0+sideEps, boxInnerDepth-sideEps, height]
];
for (i=[1:4]) {
lugLine(points[(i-1)%4], points[i%4], 3, lMult, rMult);
}
}
module lidBody() {
topLidThickness = 1;
bottomLidThickness = 4;
bottomLidWallThickness = 2;
translate(v=[-boxSideThickness, -boxFrontThickness,0])
cube(size=[boxWidth, boxDepth, topLidThickness]);
difference() {
innerWallTolerance = 0.1;
innerWallWidth = boxWidth - 2 * boxSideThickness - innerWallTolerance;
innerWallDepth = boxDepth - (boxFrontThickness + boxBackThickness) - innerWallTolerance;
translate(v = [innerWallTolerance/2, innerWallTolerance/2, topLidThickness])
cube(size = [innerWallWidth, innerWallDepth,
bottomLidThickness]);
translate(v = [bottomLidWallThickness, bottomLidWallThickness, topLidThickness])
cube(size = [boxWidth - 2*boxSideThickness - 2*bottomLidWallThickness, boxDepth - (boxFrontThickness + boxBackThickness) - 2*bottomLidWallThickness,
bottomLidThickness]);
}
} }
*difference() { module lid() {
boxBody();
translate(v=[7,2,5]) difference() {
cutoutProfile_N(); union() {
lidBody();
// todo figure out relation
lugProfile(3, sideEps = 0.25, lMult=0.95, rMult=0.95);
}
for (i=[0:7]) {
translate(v=[i*17 + 14, 15,-2])
minkowski() {
cylinder(r=1,h=1);
cube(size = [10, 20, 5]);
}
}
}
} }
translate(v=[7,2,5]) module case() {
*cutoutProfile_N(); difference() {
union() {
boxBodyWithHoles();
translate(v=[20,5, -1])
rockProScrewMounts();
// lugs
translate(v=[0,-(1+boxFrontThickness),0])
cube(size=[4,1,4]);
translate(v=[boxInnerWidth-4,-(1+boxFrontThickness),0])
cube(size=[4,1,4]);
}
union() {
lugProfile(boxHeight-4); // todo reliant on box bottom thickness
translate(v=[32,25,-2])
minkowski() {
cylinder(r=1,h=0.1);
cube(size = [50, 80, 5]);
}
}
}
}
/////////////////////////////////////////////////////////////////////////////////
module _frontPlateBody() { module _frontPlateBody() {
translate(v=[-plateScrewToVEdge,0,-plateScrewToHEdge]) cube(size=[frontPlateWidth,frontPlateThickness,frontPlateHeight]);
cube(size=[frontPlateH,frontPlateThickness,frontPlateV]);
} }
module _plateHole() { module _plateHole() {
@ -101,33 +263,103 @@ module _plateHole() {
cylinder(r=m4RadiusSlacked, h=inf, center=true); cylinder(r=m4RadiusSlacked, h=inf, center=true);
} }
module frontPlate() { module frontPlate() {
difference() { difference() {
_frontPlateBody(); _frontPlateBody();
translate(v=[frontPlateScrewToVEdge, 0, frontPlateBottomScrewToHEdge])
union() { union() {
// TODO: introduce helper modules for this pattern // TODO: introduce helper modules for this pattern
_plateHole(); _plateHole();
translate(v=[plateScrewDiffH,0,0]) translate(v=[frontPlateScrewDiffH,0,0])
_plateHole(); _plateHole();
translate(v=[0,0,plateScrewDiffV]) translate(v=[0,0,frontPlateScrewDiffV])
_plateHole(); _plateHole();
translate(v=[plateScrewDiffH,0,plateScrewDiffV]) translate(v=[frontPlateScrewDiffH,0,frontPlateScrewDiffV])
_plateHole(); _plateHole();
} }
// TODO REMOVE. Used to save on filament and print time
scale(v=[0.8, 1+eps, 0.5])
translate(v=[0,-eps,0])
translate(v=[21,0,5])
_frontPlateBody();
} }
} }
frontPlate(); module frontPlateAligned() {
difference() {
// Aligned with case
translate(v = [
-(boxSideThickness + (frontPlateWidth - boxWidth) / 2),
-(boxFrontThickness+frontPlateThickness),
-boxBottomThickness
])
frontPlate();
union() {
// lugs
translate(v=[-0.05,-(1.5+boxFrontThickness),-0.05])
cube(size=[4+0.1,2,4+0.1]);
translate(v=[-0.05 + (boxInnerWidth-4),-(1.5+boxFrontThickness),-0.05])
cube(size=[4+0.1,2,4+0.1]);
}
}
}
module rockPro64FrontPlate() {
difference() {
frontPlateAligned();
union() {
translate(v=[-1,-4,22])
rotate(a=[90,0,0])
linear_extrude(10)
text("rock-2", font="Tlwg Mono:style=Bold", size=9);
minkowski() {
rotate(a=[90,0,0])
cylinder(h=1, r=1);
union() {
translate(v = [24, - 10, 7])
cube(size = [62, 10, 9]);
translate(v = [52, - 10, 7])
cube(size = [34, 10, 18]);
}
}
intersection() {
translate(v = [95, - 10, 3])
cube(size = [70, 20, 26]);
for(i=[0:9]) {
translate(v = [83 + 8*i, - 10, 0])
rotate(a=[0,30,0])
cube(size=[3, 15, 50]);
}
}
}
}
}
rockPro64FrontPlate();
//translate(v=[0,-20,0])
//frontPlateAligned();
//case();
//translate(v=[0,0,50])
//mirror(v=[0,0,1])
//lid();

BIN
cases/rack/rackCase.stl Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
cases/rack/rackCaseLid.stl Normal file

Binary file not shown.

BIN
cases/rack/rackCaselid.stl Normal file

Binary file not shown.

22
cases/risers.scad Normal file
View File

@ -0,0 +1,22 @@
include <./common.scad>
include <./rack/screws.scad>
include <./rockpro/rockpro.scad>
module screwRiser(innerD, outerD, height) {
difference() {
cylinder(d=outerD, h=height, $fn=64);
cylinder(d=innerD, h=height, $fn=64);
}
}
module rockProScrewMounts() {
for (i=[0:3]) {
p = mountPoints[i];
translate(v=[p[0], p[1], p[2]])
screwRiser(innerD=2.8, outerD=8, height=7);
}
}
//rockProScrewMounts();

View File

@ -83,7 +83,6 @@ module mountPoints_N(cylHeight, cylRad1, cylRad2, cylFn, center) {
translate(v=[p[0], p[1], p[2]]) translate(v=[p[0], p[1], p[2]])
cylinder(r1=cylRad1, r2=cylRad2, h=cylHeight, $fn=cylFn, center=center); cylinder(r1=cylRad1, r2=cylRad2, h=cylHeight, $fn=cylFn, center=center);
} }
} }
module rockProScrewMounts() { module rockProScrewMounts() {

111
cases/rpi/frontPlate.scad Normal file
View File

@ -0,0 +1,111 @@
include <../common.scad>
include <../rack/screws.scad>
include <../sinusoid.scad>
vU = 2;
uHeight = 10;
plateScrewDiffV = uHeight*vU;
plateScrewDiffH = 180;
plateScrewToHEdge = 4.5;
plateScrewToVEdge = 5.5;
frontPlateThickness = 2.5;
frontPlateV = plateScrewDiffV + 2*plateScrewToHEdge;
frontPlateH = plateScrewDiffH + 2*plateScrewToVEdge;
plateScrewToBoxMin = 6;
length = 170;
resolution = 250;
period = PI/6;
shift = 0.0;
amplitudeFunction = function(x) 2;
module _frontPlateBody() {
difference() {
translate(v = [- plateScrewToVEdge, 0, - plateScrewToHEdge])
cube(size = [frontPlateH, frontPlateThickness, frontPlateV]);
}
translate(v=[5,-3,-1])
rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period+0.02, 2, 5);
translate(v=[5,-3,4-1])
rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period, 2 , 5);
translate(v=[5,-3,8-1])
rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period+0.03, 2.5, 5);
translate(v=[5,-3,12-1])
rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period+0.1, 3.3, 5);
translate(v=[5,-3,16-1])
rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period+0.1, 5, 5);
translate(v=[5,-3,20-1])
rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period+0.1, 6, 5);
translate(v=[5,-3,24-1])
rotate(a=[180,0,0])
sineWaveHull(length, resolution, amplitudeFunction, period+0.08, 7, 5);
}
module _plateHole() {
rotate(a=[90,0,0])
cylinder(r=m4RadiusSlacked, h=inf, center=true);
}
module frontPlate() {
difference() {
_frontPlateBody();
union() {
// TODO: introduce helper modules for this pattern
_plateHole();
translate(v=[plateScrewDiffH,0,0])
_plateHole();
translate(v=[0,0,plateScrewDiffV])
_plateHole();
translate(v=[plateScrewDiffH,0,plateScrewDiffV])
_plateHole();
}
}
}
difference() {
difference() {
union() {
rotate(a=[-90,0,0])
frontPlate();
}
// lug holes
union() {
translate(v=[160,-3,-frontPlateThickness])
cube(size=[5.2, 5.2, 3]);
translate(v=[160-91.1,-3,-frontPlateThickness])
cube(size=[5.2, 5.2, 3]);
}
}
for (i=[0:5]) {
translate(v=[5,i*4 - 0.5,-10])
cube(size=[170, 2, 20]);
}
}

BIN
cases/rpi/frontPlate.stl Normal file

Binary file not shown.

View File

@ -1,11 +1,7 @@
/* /*
TODO this case has many many problems as it currently is. The following TODO this case has many many problems as it currently is. The following
should be addressed before it is printed again: should be addressed before it is printed again:
- not enough space for I/O connectors (the plastic handles have
to go though the IO holes right now and they usually don't fit)
- risers are made of plastic and really easily break - risers are made of plastic and really easily break
- side perforations for ventilation do not print nicely (probably a printer issue)
- not enough space for sd card
- no locking lid for case - no locking lid for case
*/ */
@ -18,14 +14,14 @@ pcbThickness = 1.42;
// [+x, -x, +y, -y] // [+x, -x, +y, -y]
pcbCaseSpace = [5, 2, 2, 2]; pcbCaseSpace = [5, 2, 5, 2];
pcbRise = 3; pcbRise = 3;
caseWallThickness = 2; caseWallThickness = 2;
caseBottomThickness = 2; caseBottomThickness = 2;
mountPointDiameter = 2.69; mountPointDiameter = 5;
mountPoints = [[3.65,23.30,0], [3.65,pcbDimensions[1]-3.65,0], [pcbDimensions[0]-3.65,23.30,0], [pcbDimensions[0]-3.65,pcbDimensions[1]-3.65,0]]; mountPoints = [[3.65,23.30,0], [3.65,pcbDimensions[1]-3.65,0], [pcbDimensions[0]-3.65,23.30,0], [pcbDimensions[0]-3.65,pcbDimensions[1]-3.65,0]];
module pcb() { module pcb() {
@ -52,8 +48,11 @@ module pcbCaseBottom_() {
module pcbCaseWithRisers_() { module pcbCaseWithRisers_() {
union() { union() {
translate(v=[0,0,-pcbRise]){ translate(v=[0,0,-pcbRise]){
mountPoints_N(pcbRise, mountPointDiameter, mountPointDiameter, 32, false);
mountPoints_N(pcbRise+2, mountPointDiameter/2.5, mountPointDiameter/2.5, 32, false); difference () {
mountPoints_N(pcbRise, mountPointDiameter/1.5, mountPointDiameter/2, 32, false);
mountPoints_N(pcbRise + 2, 1.95/2 - 0.05, 1.95/2 - 0.05, 32, false);
}
} }
pcbCaseBottom_(); pcbCaseBottom_();
} }
@ -73,15 +72,12 @@ module cutoutProfileAirflow_N() {
} }
} }
// back cutouts // back cutout
for (i=[0:4]) { translate(v=[5,pcbDimensions[1]+5,-1])
translate(v=[i*10 + 7,pcbDimensions[1],4])
minkowski() { minkowski() {
cube(size=[50,90,15], center=false);
cube(size=[3,100,10], center=false); rotate(a=[90,0,0])
rotate(a=[90,0,0])
cylinder(h=1,r=2); cylinder(h=1,r=2);
}
} }
// front cutout // front cutout
@ -94,13 +90,16 @@ difference() {
union() { union() {
pcbCaseWithRisers_(); pcbCaseWithRisers_();
// lugs // lugs
translate(v=[pcbDimensions[0]+caseWallThickness+pcbCaseSpace[0],-caseWallThickness-pcbCaseSpace[3],-pcbRise-caseBottomThickness]) // -4
cube(size=[2,5,5]); translate(v=[pcbDimensions[0]+caseWallThickness+pcbCaseSpace[0],-caseWallThickness-pcbCaseSpace[3],-pcbRise-caseBottomThickness])
cube(size=[2,5,5]);
translate(v=[pcbDimensions[0]+caseWallThickness+pcbCaseSpace[0],pcbDimensions[1]+pcbCaseSpace[2]-5+caseWallThickness,-pcbRise-caseBottomThickness]) // 87.1
cube(size=[2,5,5]); translate(v=[pcbDimensions[0]+caseWallThickness+pcbCaseSpace[0],pcbDimensions[1]+pcbCaseSpace[2]-5+caseWallThickness,-pcbRise-caseBottomThickness])
cube(size=[2,5,5]);
// -> 87.1 + 4 = 91.1
} }
union() { union() {
@ -128,24 +127,22 @@ module mountPoints_N(cylHeight, cylRad1, cylRad2, cylFn, center) {
} }
} }
// fucked up
module cutoutProfile_N() { module cutoutProfile_N() {
color([1,0,1]) color([1,0,1])
union() { union() {
// front I/O // front I/O
mirror(v=[0,1,0]) mirror(v=[0,1,0])
translate(v=[2, -eps*100, pcbThickness]) translate(v=[1, -eps*100, pcbThickness-4])
cube(size=[52.0 + 0.1, inf50, 16.0 + 0.1]); cube(size=[58.0 + 0.1, inf50, 18.0 + 0.1]);
// side I/O // side I/O
translate(v=[-48-3, (pcbDimensions[1]-54)-10, pcbThickness-4])
translate(v=[-48, (pcbDimensions[1]-54)-5, pcbThickness]) cube(size=[inf50, 64, 18]);
cube(size=[inf50, 54, 8]);
} }
} }
//cutoutProfile_N(); *cutoutProfile_N();
//pcb(); //pcb();

Binary file not shown.

View File

@ -2,17 +2,17 @@
difference() { difference() {
union() { union() {
cube(size=[67,93,1]); cube(size=[67,95.7,1]);
translate(v=[2, 2,1]) translate(v=[2,2,1])
cube(size=[63,88.8,2]); cube(size=[63,91.7,3]);
} }
union() { union() {
translate(v=[3.5, 3.5,1]) translate(v=[3.5, 3.8,1])
cube(size=[60,85,3]); cube(size=[60,88,3]);
for(i=[0:7]) { for(i=[0:7]) {
translate(v=[33.5,i*10 + 10,0]) translate(v=[33.5,i*10 + 12,0])
minkowski() { minkowski() {
cylinder(h=1,r=1); cylinder(h=1,r=1);
cube(size=[50,5,10], center=true); cube(size=[50,5,10], center=true);

Binary file not shown.

64
cases/sinusoid.scad Normal file
View File

@ -0,0 +1,64 @@
// config
length = 100;
resolution = 128;
amplitude = 4.0;
period = PI;
shift = 0.0;
// end config
function radToDeg(r) = r * (180 / PI);
function sinR(r) = sin(radToDeg(r));
//sigmoid = function(x) exp(x) / (exp(x) + 1);
//dsigmoid = function(x) sigmoid(x) * (1-sigmoid(x));
//amplitudeFunction = function(x) 5*dsigmoid(x - 3) + 1;
amplitudeFunction = function(x) 1;
module sineWave(length, resolution, amplitudeFunction, period, shift) {
dx = length / resolution;
p = period / (2*PI);
for (i = [1:resolution]) {
idx_prev = (i - 1) * dx;
idx_curr = i * dx;
hull() {
translate(v = [idx_prev, amplitudeFunction(idx_prev) * sinR(p * idx_prev + shift), 0])
cube(size = [0.1, 1, 1]);
translate(v = [idx_curr, amplitudeFunction(idx_curr) * sinR(p * idx_curr + shift), 0])
cube(size = [0.1, 1, 1]);
translate(v = [idx_curr, -10, 0])
cube(size=[0.1,1,1]);
translate(v = [idx_prev, -10, 0])
cube(size=[0.1,1,1]);
}
}
}
module sineWaveHull(length, resolution, amplitudeFunction, period, shift, hullDiff) {
dx = length / resolution;
p = period / (2*PI);
for (i = [1:resolution]) {
idx_prev = (i - 1) * dx;
idx_curr = i * dx;
hull() {
translate(v = [idx_prev, amplitudeFunction(idx_prev) * sinR(p * idx_prev + shift), 0])
cube(size = [0.1, 1, 1]);
translate(v = [idx_curr, amplitudeFunction(idx_curr) * sinR(p * idx_curr + shift), 0])
cube(size = [0.1, 1, 1]);
translate(v = [idx_curr, -hullDiff, 0])
cube(size=[0.1,1,1]);
translate(v = [idx_prev, -hullDiff, 0])
cube(size=[0.1,1,1]);
}
}
}
//sineWaveHull(length, resolution, amplitudeFunction, period, shift, 10);