This commit is contained in:
jazhawang
2022-09-18 11:13:08 -04:00
parent 070f97103b
commit 94c8c2116c
27 changed files with 261367 additions and 10156 deletions

1
cases/rpi/.#front.scad Symbolic link
View File

@ -0,0 +1 @@
zhao@zhao-desktop.12132:1663410391

149
cases/rpi/rpi2b.scad Normal file
View File

@ -0,0 +1,149 @@
include <../common.scad>
// All coordinates are in [x,y], or [x,y,z] format
pcbDimensions = [56.0, 85.1]; // [x,y]
pcbThickness = 1.42;
// [+x, -x, +y, -y]
pcbCaseSpace = [5, 2, 2, 2];
pcbRise = 3;
caseWallThickness = 2;
caseBottomThickness = 2;
mountPointDiameter = 2.69;
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() {
cube(size=[pcbDimensions[0], pcbDimensions[1], pcbThickness]);
}
module pcbCaseBottom_() {
translate(v=[-pcbCaseSpace[1]-caseWallThickness, -pcbCaseSpace[3]-caseWallThickness, -caseBottomThickness-pcbRise])
difference() {
cube(size=[
pcbDimensions[0]+pcbCaseSpace[0]+pcbCaseSpace[1] + 2*caseWallThickness,
pcbDimensions[1]+pcbCaseSpace[2]+pcbCaseSpace[3] + 2*caseWallThickness,
26 // 3u case, subtracted for and other bullshit
]);
translate(v=[caseWallThickness, caseWallThickness, caseBottomThickness])
cube(size=[
pcbDimensions[0]+pcbCaseSpace[0]+pcbCaseSpace[1],
pcbDimensions[1]+pcbCaseSpace[2]+pcbCaseSpace[3],
26 // 3u case, subtracted 4 for lid and bullshit
]);
}
}
module pcbCaseWithRisers_() {
union() {
translate(v=[0,0,-pcbRise]){
mountPoints_N(pcbRise, mountPointDiameter, mountPointDiameter, 32, false);
mountPoints_N(pcbRise+2, mountPointDiameter/2.5, mountPointDiameter/2.5, 32, false);
}
pcbCaseBottom_();
}
}
module cutoutProfileAirflow_N() {
// bottom cutouts
union() {
for (i=[0:11]) {
translate(v=[pcbDimensions[0]/2.0, i*6 + 10,0])
minkowski() {
cube(size=[30,1,20], center=true);
cylinder(h=1,r=1);
}
}
}
// back cutouts
for (i=[0:4]) {
translate(v=[i*10 + 7,pcbDimensions[1],4])
minkowski() {
cube(size=[3,100,10], center=false);
rotate(a=[90,0,0])
cylinder(h=1,r=2);
}
}
// front cutout
translate(v=[pcbDimensions[0],2.5,1])
cube(size=[inf50, 80, 15]);
}
difference() {
union() {
pcbCaseWithRisers_();
// lugs
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])
cube(size=[2,5,5]);
}
union() {
cutoutProfile_N();
cutoutProfileAirflow_N();
}
}
//cutoutProfileAirflow_N();
module mountPoints_N(cylHeight, cylRad1, cylRad2, cylFn, center) {
for (i=[0:3]) {
p = mountPoints[i];
translate(v=[p[0], p[1], p[2]])
cylinder(r1=cylRad1, r2=cylRad2, h=cylHeight, $fn=cylFn, center=center);
}
}
*difference() {
union () {
pcb();
mountPoints_N(7, mountPointDiameter/2.5, mountPointDiameter/2.5, 32, false);
mountPoints_N(5, mountPointDiameter, mountPointDiameter, 32, false);
}
}
module cutoutProfile_N() {
color([1,0,1])
union() {
// front I/O
mirror(v=[0,1,0])
translate(v=[2, -eps*100, pcbThickness])
cube(size=[52.0 + 0.1, inf50, 16.0 + 0.1]);
// side I/O
translate(v=[-48, (pcbDimensions[1]-54)-5, pcbThickness])
cube(size=[inf50, 54, 8]);
}
}
//cutoutProfile_N();
//pcb();

40798
cases/rpi/rpi2b.stl Normal file

File diff suppressed because it is too large Load Diff

30438
cases/rpi/rpi2bDimTest.stl Normal file

File diff suppressed because it is too large Load Diff

22
cases/rpi/top.scad Normal file
View File

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

2326
cases/rpi/top.stl Normal file

File diff suppressed because it is too large Load Diff

95
cases/rpi/voronoi.scad Normal file
View File

@ -0,0 +1,95 @@
// (c)2013 Felipe Sanches <juca@members.fsf.org>
// licensed under the terms of the GNU GPL version 3 (or later)
function normalize(v) = v / (sqrt(v[0] * v[0] + v[1] * v[1]));
//
// The voronoi() function generates a 2D surface, which can be provided to
// a) linear_extrude() to produce a 3D object
// b) intersection() to restrict it to a a specified shape -- see voronoi_polygon.scad
//
// Parameters:
// points (required) ... nuclei coordinates (array of [x, y] pairs)
// L ... the radius of the "world" (the pattern is built within this circle)
// thickness ... the thickness of the lines between cells
// round ... the radius applied to corners (fillet in CAD terms)
// nuclei (bool) ... show nuclei sites
//
// These parameters need to be kept more or less in proportion to each other, and to the distance
// apart of points in the point_set. If one or the other parameter is increased or decreased too
// much, you'll get no output.
//
module voronoi(points, L = 200, thickness = 1, round = 6, nuclei = true) {
for (p = points) {
difference() {
minkowski() {
intersection_for(p1 = points){
if (p != p1) {
angle = 90 + atan2(p[1] - p1[1], p[0] - p1[0]);
translate((p + p1) / 2 - normalize(p1 - p) * (thickness + round))
rotate([0, 0, angle])
translate([-L, -L])
square([2 * L, L]);
}
}
circle(r = round, $fn = 20);
}
if (nuclei)
translate(p) circle(r = 1, $fn = 20);
}
}
}
//
// The random_voronoi() function is the helper wrapper over the voronoi() core.
// It generates random nuclei site coordinates into the square area,
// passing other arguments to voronoi() unchanged.
//
// Parameters:
// n ... number of nuclei sites to be generated
// nuclei (bool) ... show nuclei sites
// L ... the radius of the "world" (the pattern is built within this circle)
// thickness ... the thickness of the lines between cells
// round ... the radius applied to corners (fillet in CAD terms)
// min ... minimum x and y coordinate for nuclei generation
// max ... maximum x and y coordinate for nuclei generation
// seed ... seed for the random generator (random if undefined)
// center (bool) ... move resulting pattern to [0, 0] if true
//
module random_voronoi(n = 20, nuclei = true, L = 200, thickness = 1, round = 6, min = 0, max = 100, seed = undef, center = false) {
seed = seed == undef ? rands(0, 100, 1)[0] : seed;
echo("Seed", seed);
// Generate points.
x = rands(min, max, n, seed);
y = rands(min, max, n, seed + 1);
points = [ for (i = [0 : n - 1]) [x[i], y[i]] ];
// Center Voronoi.
offset_x = center ? -(max(x) - min(x)) / 2 : 0;
offset_y = center ? -(max(y) - min(y)) / 2 : 0;
translate([offset_x, offset_y])
voronoi(points, L = L, thickness = thickness, round = round, nuclei = nuclei);
}
// example with an explicit list of points:
point_set = [
[0, 0], [30, 0], [20, 10], [50, 20], [15, 30], [85, 30], [35, 30], [12, 60],
[45, 50], [80, 80], [20, -40], [-20, 20], [-15, 10], [-15, 50]
];
//voronoi(points = point_set, round = 4, nuclei = true);
module voronoi3u_N(h) {
intersection() {
translate(v=[10,5,0])
cube(size=[160, 10, h]);
translate(v=[20,-52,0])
scale(v=[0.40,0.44,10])
linear_extrude(height=10)
random_voronoi(n = 128, round = 2, min = 0, max = 350, seed = 40, thickness=3.5, nuclei=false);
}
}