bulk
This commit is contained in:
@ -7,3 +7,8 @@ $fn=64;
|
|||||||
|
|
||||||
|
|
||||||
eps=0.01;
|
eps=0.01;
|
||||||
|
|
||||||
|
inf10 = 10;
|
||||||
|
inf50 = 50;
|
||||||
|
inf1000 = 1000;
|
||||||
|
inf = inf1000;
|
||||||
|
|||||||
1
cases/rack/.#rackCase.scad
Symbolic link
1
cases/rack/.#rackCase.scad
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
zhao@zhao-desktop.12132:1663410391
|
||||||
@ -1,29 +1,24 @@
|
|||||||
|
include <../common.scad>
|
||||||
|
include <./screws.scad>
|
||||||
|
|
||||||
$fn=64;
|
$fn=64;
|
||||||
|
|
||||||
eps=0.1;
|
|
||||||
|
|
||||||
slack = 0.5;
|
|
||||||
m3Diameter = 3.0;
|
|
||||||
m3Radius = m3Diameter/2.0;
|
|
||||||
m3ptr = m3Radius + slack;
|
|
||||||
|
|
||||||
module baseFrame() {
|
module baseFrame() {
|
||||||
difference() {
|
difference() {
|
||||||
cube(size=[200,200,4], center=true);
|
cube(size=[200,200,4], center=true);
|
||||||
cube(size=[180,180,4], center=true);
|
cube(size=[180,180,4], center=true);
|
||||||
}
|
}
|
||||||
|
|
||||||
translate(v=[90,90,0])
|
translate(v=[80,80,0])
|
||||||
cube(size=[20,20, 4],center=true);
|
cube(size=[20,20, 4],center=true);
|
||||||
|
|
||||||
translate(v=[-90,90,0])
|
translate(v=[-80,80,0])
|
||||||
cube(size=[20,20, 4],center=true);
|
cube(size=[20,20, 4],center=true);
|
||||||
|
|
||||||
translate(v=[90,-90,0])
|
translate(v=[80,-80,0])
|
||||||
cube(size=[20,20, 4],center=true);
|
cube(size=[20,20, 4],center=true);
|
||||||
|
|
||||||
translate(v=[-90,-90,0])
|
translate(v=[-80,-80,0])
|
||||||
cube(size=[20,20, 4],center=true);
|
cube(size=[20,20, 4],center=true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +26,7 @@ module lugBottom() {
|
|||||||
difference() {
|
difference() {
|
||||||
cube(size=[9.7,9.7,6], center=true);
|
cube(size=[9.7,9.7,6], center=true);
|
||||||
|
|
||||||
translate(v=[1,1,0])
|
translate(v=[2,2,0])
|
||||||
cube(size=[9.1,9.1,5+1], center=true);
|
cube(size=[9.1,9.1,5+1], center=true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,16 +58,16 @@ module base() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
union() {
|
union() {
|
||||||
translate(v=[90,90,0])
|
translate(v=[80,80,0])
|
||||||
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
translate(v=[-90,90,0])
|
translate(v=[-80,80,0])
|
||||||
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
translate(v=[90,-90,0])
|
translate(v=[80,-80,0])
|
||||||
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
translate(v=[-90,-90,0])
|
translate(v=[-80,-80,0])
|
||||||
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -81,6 +76,4 @@ module base() {
|
|||||||
|
|
||||||
base();
|
base();
|
||||||
|
|
||||||
*lugBottom();
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
8662
cases/rack/base1.stl
8662
cases/rack/base1.stl
File diff suppressed because it is too large
Load Diff
71
cases/rack/frontPlate.scad
Normal file
71
cases/rack/frontPlate.scad
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
include <../common.scad>
|
||||||
|
include <./screws.scad>
|
||||||
|
include <../rpi/voronoi.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;
|
||||||
|
|
||||||
|
module _frontPlateBody() {
|
||||||
|
translate(v=[-plateScrewToVEdge,0,-plateScrewToHEdge])
|
||||||
|
cube(size=[frontPlateH,frontPlateThickness,frontPlateV]);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 () {
|
||||||
|
rotate(a=[-90,0,0])
|
||||||
|
frontPlate();
|
||||||
|
translate(v=[0,0,-5])
|
||||||
|
voronoi3u_N(10);
|
||||||
|
}
|
||||||
|
// lug holes
|
||||||
|
union() {
|
||||||
|
translate(v=[160,-3,-frontPlateThickness])
|
||||||
|
cube(size=[5.2, 5.2, 3]);
|
||||||
|
translate(v=[160-88,-3,-frontPlateThickness])
|
||||||
|
cube(size=[5.2, 5.2, 3]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
20806
cases/rack/frontPlate.stl
Normal file
20806
cases/rack/frontPlate.stl
Normal file
File diff suppressed because it is too large
Load Diff
16214
cases/rack/frontPlate2u.stl
Normal file
16214
cases/rack/frontPlate2u.stl
Normal file
File diff suppressed because it is too large
Load Diff
158
cases/rack/m4Leg.scad
Normal file
158
cases/rack/m4Leg.scad
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
include <../common.scad>
|
||||||
|
include <./screws.scad>
|
||||||
|
|
||||||
|
|
||||||
|
//slack = 0.5;
|
||||||
|
//m3Diameter = 3.0;
|
||||||
|
//m3Radius = m3Diameter/2.0;
|
||||||
|
//m3ptr = m3Radius + slack;
|
||||||
|
|
||||||
|
legWidth = 16;
|
||||||
|
legLength = 16;
|
||||||
|
legHeight = 60;
|
||||||
|
|
||||||
|
legFrontThickness = 6;
|
||||||
|
legSupportThickness = 4;
|
||||||
|
|
||||||
|
legWingThickness = 4;
|
||||||
|
legWingLength = 9;
|
||||||
|
|
||||||
|
// 9.5 to account for space for inserting hex nuts at the top
|
||||||
|
legWingWidth = 9.5+legSupportThickness;
|
||||||
|
|
||||||
|
|
||||||
|
module legWing() {
|
||||||
|
difference() {
|
||||||
|
cube(size=[legWingLength, legWingThickness, legWingWidth]);
|
||||||
|
|
||||||
|
union() {
|
||||||
|
translate(v=[4,0,10])
|
||||||
|
rotate(a=[90,0,0])
|
||||||
|
cylinder(r=m3RadiusSlacked, h=20, center=true);
|
||||||
|
|
||||||
|
translate(v=[14,0,10])
|
||||||
|
rotate(a=[90,0,0])
|
||||||
|
cylinder(r=m3RadiusSlacked, h=20, center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module base() {
|
||||||
|
difference() {
|
||||||
|
cube(size=[25,25,legWingThickness]);
|
||||||
|
|
||||||
|
union() {
|
||||||
|
translate(v=[20,20,0])
|
||||||
|
cylinder(r=m3RadiusSlacked, h=100, center=true);
|
||||||
|
|
||||||
|
translate(v=[10,10,0])
|
||||||
|
cylinder(r=m3RadiusSlacked, h=100, center=true);
|
||||||
|
|
||||||
|
translate(v=[20,10,0])
|
||||||
|
cylinder(r=m3RadiusSlacked, h=100, center=true);
|
||||||
|
|
||||||
|
translate(v=[10,20,0])
|
||||||
|
cylinder(r=m3RadiusSlacked, h=100, center=true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module baseLeg(legHeight) {
|
||||||
|
union() {
|
||||||
|
difference() {
|
||||||
|
cube(size=[16,16, legHeight]);
|
||||||
|
|
||||||
|
union() {
|
||||||
|
translate(v=[4,6,0])
|
||||||
|
cube(size=[16, 16, legHeight]);
|
||||||
|
|
||||||
|
// compensate for differences between leg/wing thickness
|
||||||
|
translate(v=[legSupportThickness,legSupportThickness,0])
|
||||||
|
cube(size=[legWidth,legWidth,legSupportThickness+10]);
|
||||||
|
|
||||||
|
translate(v=[legSupportThickness,legSupportThickness,legHeight-legWingWidth])
|
||||||
|
cube(size=[legWidth,legWidth,legSupportThickness+10]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
translate(v=[16,0,0])
|
||||||
|
legWing();
|
||||||
|
|
||||||
|
|
||||||
|
translate(v=[16,0,legHeight])
|
||||||
|
mirror(v=[0,0,1]) {
|
||||||
|
legWing();
|
||||||
|
}
|
||||||
|
|
||||||
|
mirror(v=[1,-1,0]) {
|
||||||
|
translate(v=[16,0,0])
|
||||||
|
legWing();
|
||||||
|
|
||||||
|
|
||||||
|
translate(v=[16,0,legHeight])
|
||||||
|
mirror(v=[0,0,1]) {
|
||||||
|
legWing();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
base();
|
||||||
|
|
||||||
|
translate(v=[0,0,legHeight-legWingThickness])
|
||||||
|
base();
|
||||||
|
}
|
||||||
|
|
||||||
|
*baseLeg(180);
|
||||||
|
|
||||||
|
module leg(ui) {
|
||||||
|
assert(ui > 0);
|
||||||
|
|
||||||
|
legLength = 20 + (ui-1)*10;
|
||||||
|
|
||||||
|
difference() {
|
||||||
|
baseLeg(legLength);
|
||||||
|
|
||||||
|
union() {
|
||||||
|
|
||||||
|
intersection() {
|
||||||
|
union() {
|
||||||
|
for (i = [1:ui-2]) {
|
||||||
|
translate(v=[0,10,(i+1)*10])
|
||||||
|
rotate(a=[0,90,0])
|
||||||
|
*cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
translate(v=[10,3,(i+1)*10])
|
||||||
|
rotate(a=[90,-10,0])
|
||||||
|
m4HexNutPocketNegative();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
translate(v=[-1,-1,legWingWidth])
|
||||||
|
cube(size=[1000,1000,legLength-2*legWingWidth]);
|
||||||
|
}
|
||||||
|
|
||||||
|
translate(v=[0,10,10])
|
||||||
|
rotate(a=[0,90,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
translate(v=[0,10,ui*10])
|
||||||
|
rotate(a=[0,90,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
|
||||||
|
translate(v=[10,0,10])
|
||||||
|
rotate(a=[90,0,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
translate(v=[10,0,ui*10])
|
||||||
|
rotate(a=[90,0,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//mirror(v=[1,0,0])
|
||||||
|
leg(20);
|
||||||
54952
cases/rack/m4Leg.stl
Normal file
54952
cases/rack/m4Leg.stl
Normal file
File diff suppressed because it is too large
Load Diff
54952
cases/rack/m4LegM.stl
Normal file
54952
cases/rack/m4LegM.stl
Normal file
File diff suppressed because it is too large
Load Diff
133
cases/rack/rackCase.scad
Normal file
133
cases/rack/rackCase.scad
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
include <../common.scad>
|
||||||
|
include <./screws.scad>
|
||||||
|
include <../rockpro/rockpro.scad>
|
||||||
|
|
||||||
|
vU = 4;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// BOX CONFIG
|
||||||
|
|
||||||
|
// box dimensions
|
||||||
|
boxDepth = 135;
|
||||||
|
boxWidth = 95;
|
||||||
|
|
||||||
|
boxBottomThickness = 1;
|
||||||
|
boxSideThickness = 2;
|
||||||
|
boxBackThickness = 2;
|
||||||
|
// boxFrontThickness is just frontPlateThickness
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
boxTopSpace = 1; // meant for lids?
|
||||||
|
boxBottomSpace = 1; // meant to be used for boxes that expect support rails
|
||||||
|
|
||||||
|
|
||||||
|
boxHeight = vU * uHeight + 2*plateScrewToHEdge - (boxBottomSpace+boxTopSpace);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// the pcb and the bottom of the inside of the case
|
||||||
|
module frontFaceHoles(zLen, rise) {
|
||||||
|
|
||||||
|
//mirror(v=[0,1,0])
|
||||||
|
// translate(v=[5,-eps,rise])
|
||||||
|
//frontFaceIOCutouts_N();
|
||||||
|
}
|
||||||
|
|
||||||
|
module backFaceHoles(zLen, rise) {
|
||||||
|
}
|
||||||
|
|
||||||
|
module leftFaceHoles(zLen, rise) {
|
||||||
|
}
|
||||||
|
|
||||||
|
module rightFaceHoles(zLen, rise) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module boxBody() {
|
||||||
|
// save this transformation...
|
||||||
|
// translate(v=[(plateScrewDiffH-boxWidth)/2.0,0,boxBottomSpace -plateScrewToHEdge])
|
||||||
|
|
||||||
|
// convert to inside box space
|
||||||
|
translate(v=[-boxSideThickness, -frontPlateThickness, -boxBottomThickness])
|
||||||
|
difference() {
|
||||||
|
cube(size=[boxWidth, boxDepth, boxHeight]);
|
||||||
|
translate(v=[boxSideThickness, frontPlateThickness, boxBottomThickness])
|
||||||
|
cube(size=[boxWidth-2*boxSideThickness, boxDepth-(boxBackThickness+frontPlateThickness), inf]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*difference() {
|
||||||
|
boxBody();
|
||||||
|
|
||||||
|
translate(v=[7,2,5])
|
||||||
|
cutoutProfile_N();
|
||||||
|
}
|
||||||
|
|
||||||
|
translate(v=[7,2,5])
|
||||||
|
*cutoutProfile_N();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
module _frontPlateBody() {
|
||||||
|
translate(v=[-plateScrewToVEdge,0,-plateScrewToHEdge])
|
||||||
|
cube(size=[frontPlateH,frontPlateThickness,frontPlateV]);
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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();
|
||||||
7506
cases/rack/rackCase180.stl
Normal file
7506
cases/rack/rackCase180.stl
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,11 +8,12 @@ slack = 0.4;
|
|||||||
|
|
||||||
boxWidth = 157.67;
|
boxWidth = 157.67;
|
||||||
boxHeight = 27.0;
|
boxHeight = 27.0;
|
||||||
boxLength = 101.5;
|
boxLength = 101.5+1;
|
||||||
|
|
||||||
topThickness = 1.0;
|
topThickness = 1.0;
|
||||||
bottomThickness = 1.0;
|
bottomThickness = 1.0;
|
||||||
|
|
||||||
|
faceThickness = 3.0;
|
||||||
sideThickness = 2.0;
|
sideThickness = 2.0;
|
||||||
sideSupportWidth = 10;
|
sideSupportWidth = 10;
|
||||||
|
|
||||||
@ -23,19 +24,21 @@ totalLength = boxLength+2*sideThickness;
|
|||||||
|
|
||||||
|
|
||||||
railMountWidthDiff = (200.0 - (boxWidth + 2*sideThickness)) / 2.0;
|
railMountWidthDiff = (200.0 - (boxWidth + 2*sideThickness)) / 2.0;
|
||||||
|
|
||||||
|
totalMountLength = 200.0 + 2*faceThickness + 1;
|
||||||
|
|
||||||
module sideHolder() {
|
module sideHolder() {
|
||||||
|
|
||||||
|
|
||||||
module frontLowerCaseSegment() {
|
module frontLowerCaseSegment() {
|
||||||
translate(v=[0,0,0])
|
translate(v=[0,0,0])
|
||||||
cube(size=[sideSupportWidth, sideThickness, bottomThickness]);
|
cube(size=[sideSupportWidth, faceThickness, bottomThickness]);
|
||||||
}
|
}
|
||||||
|
|
||||||
module frontUpperCaseSegment() {
|
module frontUpperCaseSegment() {
|
||||||
// no room for slack? :(
|
// no room for slack? :(
|
||||||
translate(v=[0,0,boxHeight+bottomThickness])
|
translate(v=[0,0,boxHeight+bottomThickness])
|
||||||
cube(size=[sideSupportWidth, sideThickness, topThickness]);
|
cube(size=[sideSupportWidth, faceThickness, topThickness]);
|
||||||
}
|
}
|
||||||
|
|
||||||
module backLowerCaseSegment() {
|
module backLowerCaseSegment() {
|
||||||
@ -49,25 +52,25 @@ module sideHolder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module backLowerRailSegment() {
|
module backLowerRailSegment() {
|
||||||
translate(v=[0,198.0-sideThickness,0])
|
translate(v=[0,200.0+1,0])
|
||||||
cube(size=[sideSupportWidth, sideThickness, bottomThickness]);
|
cube(size=[sideSupportWidth, faceThickness, bottomThickness]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module backUpperRailSegment() {
|
module backUpperRailSegment() {
|
||||||
translate(v=[0,198.0-sideThickness,boxHeight+bottomThickness])
|
translate(v=[0,200.0+1,boxHeight+bottomThickness])
|
||||||
cube(size=[sideSupportWidth, sideThickness, topThickness]);
|
cube(size=[sideSupportWidth, faceThickness, topThickness]);
|
||||||
}
|
}
|
||||||
|
|
||||||
module frontRailMountSegment() {
|
module frontRailMountSegment() {
|
||||||
// +2 is slack
|
// +2 is slack
|
||||||
translate(v=[-railMountWidthDiff+5,0,0])
|
translate(v=[-railMountWidthDiff+5,0,0])
|
||||||
// should technically use different totalHeight, as current totalHeight is for case holder
|
// should technically use different totalHeight, as current totalHeight is for case holder
|
||||||
cube(size=[railWidth,sideThickness,totalHeight]);
|
cube(size=[railWidth,faceThickness,totalHeight]);
|
||||||
}
|
}
|
||||||
|
|
||||||
module backRailMountSegment() {
|
module backRailMountSegment() {
|
||||||
translate(v=[0,198.0-sideThickness,0])
|
translate(v=[0,200+1,0])
|
||||||
// should technically use different totalHeight, as current totalHeight is for case holder
|
// should technically use different totalHeight, as current totalHeight is for case holder
|
||||||
frontRailMountSegment();
|
frontRailMountSegment();
|
||||||
}
|
}
|
||||||
@ -82,19 +85,19 @@ module sideHolder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// screw holes
|
// screw holes
|
||||||
translate(v=[-railMountWidthDiff + 10,0,5])
|
translate(v=[-railMountWidthDiff + 11.5,0,5])
|
||||||
rotate(a=[90,0,0])
|
rotate(a=[90,0,0])
|
||||||
cylinder(r=m3RadiusSlacked, h=10, center=true);
|
cylinder(r=m4RadiusSlacked, h=10, center=true);
|
||||||
|
|
||||||
translate(v=[-railMountWidthDiff + 10,0,25])
|
translate(v=[-railMountWidthDiff + 11.5,0,25])
|
||||||
rotate(a=[90,0,0])
|
rotate(a=[90,0,0])
|
||||||
cylinder(r=m3RadiusSlacked, h=10, center=true);
|
cylinder(r=m4RadiusSlacked, h=10, center=true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module backFace() {
|
module backFace() {
|
||||||
translate(v=[0,198.0-sideThickness,0])
|
translate(v=[0,200.0+faceThickness+1,0])
|
||||||
frontFace();
|
frontFace();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -134,24 +137,24 @@ module sideHolder() {
|
|||||||
difference() {
|
difference() {
|
||||||
cube(size=[sideThickness, totalLength, totalHeight]);
|
cube(size=[sideThickness, totalLength, totalHeight]);
|
||||||
|
|
||||||
translate(v=[-eps/2,5,5])
|
translate(v=[-eps/2,8,5])
|
||||||
cube(size=[sideThickness+eps,totalLength-10+eps, totalHeight-10+eps]);
|
cube(size=[sideThickness+eps,totalLength-17.5+eps, totalHeight-10+eps]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// side support/hold for case
|
// side support/hold for case
|
||||||
difference() {
|
difference() {
|
||||||
translate(v=[sideSupportWidth-sideThickness,totalLength,0])
|
translate(v=[sideSupportWidth-sideThickness,totalLength,0])
|
||||||
cube(size=[sideThickness, 198-totalLength, totalHeight]);
|
cube(size=[sideThickness, totalMountLength-totalLength, totalHeight]);
|
||||||
|
|
||||||
translate(v=[sideSupportWidth-sideThickness-eps/2,(198-totalLength)+15,5])
|
translate(v=[sideSupportWidth-sideThickness-eps/2,(200-totalLength)+20,5])
|
||||||
cube(size=[sideThickness+eps,(198-totalLength)-10+eps, totalHeight-10+eps]);
|
cube(size=[sideThickness+eps,(200-totalLength)-10+eps, totalHeight-10+eps]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module sideHolderAligned() {
|
module sideHolderAligned() {
|
||||||
translate(v=[19,0,0])
|
//translate(v=[19,0,0])
|
||||||
sideHolder();
|
sideHolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +166,6 @@ module mSide() {
|
|||||||
|
|
||||||
sideHolderAligned();
|
sideHolderAligned();
|
||||||
|
|
||||||
translate(v=[42 + boxWidth,0,0])
|
//translate(v=[42 + boxWidth,0,0])
|
||||||
*mSide();
|
//mSide();
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
7982
cases/rack/rackCaseForBoxM.stl
Normal file
7982
cases/rack/rackCaseForBoxM.stl
Normal file
File diff suppressed because it is too large
Load Diff
14422
cases/rack/screwmount-test.stl
Normal file
14422
cases/rack/screwmount-test.stl
Normal file
File diff suppressed because it is too large
Load Diff
62
cases/rack/screwmount.scad
Normal file
62
cases/rack/screwmount.scad
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/* Contains screw mounts to be used to fix risers and whatnot into plastic */
|
||||||
|
|
||||||
|
include <../common.scad>
|
||||||
|
include <./screws.scad>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Heat set inserts:
|
||||||
|
|
||||||
|
// Useful references:
|
||||||
|
// https://hackaday.com/2019/02/28/threading-3d-printed-parts-how-to-use-heat-set-inserts/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// My knurled brass nut dimensions
|
||||||
|
|
||||||
|
|
||||||
|
m4NutDiameter = 6;
|
||||||
|
m4NutLength1 = 6;
|
||||||
|
|
||||||
|
m3NutDiameter = 4.9;
|
||||||
|
m3NutLength1 = 6;
|
||||||
|
|
||||||
|
|
||||||
|
module nut_N(diameter,length,edm,elm) {
|
||||||
|
cylinder(h=(length + length*edm), d=(diameter + diameter*edm));
|
||||||
|
}
|
||||||
|
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
cube(size=[30,30,2.5]);
|
||||||
|
|
||||||
|
translate(v=[8,8,0])
|
||||||
|
cylinder(h=8,d=8);
|
||||||
|
|
||||||
|
translate(v=[22,8,0])
|
||||||
|
cylinder(h=10,d=8);
|
||||||
|
|
||||||
|
translate(v=[8,22,0])
|
||||||
|
cylinder(h=8,d=10);
|
||||||
|
|
||||||
|
translate(v=[22,22,0])
|
||||||
|
cylinder(h=10,d=10);
|
||||||
|
}
|
||||||
|
|
||||||
|
union() {
|
||||||
|
translate(v=[8,8,2])
|
||||||
|
cylinder(h=6, d=6);
|
||||||
|
|
||||||
|
translate(v=[22,8,4])
|
||||||
|
cylinder(h=6,d=6);
|
||||||
|
|
||||||
|
translate(v=[8,22,2])
|
||||||
|
cylinder(h=6,d=6);
|
||||||
|
|
||||||
|
translate(v=[22,22,3])
|
||||||
|
cylinder(h=8,d=6);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ module m4HexNutPocketNegative() {
|
|||||||
|
|
||||||
// TODO: remove test
|
// TODO: remove test
|
||||||
|
|
||||||
difference() {
|
*difference() {
|
||||||
translate(v=[0,1,0])
|
translate(v=[0,1,0])
|
||||||
cube(size=[10,12,6], center=true);
|
cube(size=[10,12,6], center=true);
|
||||||
|
|
||||||
|
|||||||
79
cases/rack/top1.scad
Normal file
79
cases/rack/top1.scad
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
include <../common.scad>
|
||||||
|
include <./screws.scad>
|
||||||
|
|
||||||
|
$fn=64;
|
||||||
|
|
||||||
|
module baseFrame() {
|
||||||
|
difference() {
|
||||||
|
cube(size=[200,200,4], center=true);
|
||||||
|
cube(size=[180,180,4], center=true);
|
||||||
|
}
|
||||||
|
|
||||||
|
translate(v=[80,80,0])
|
||||||
|
cube(size=[20,20, 4],center=true);
|
||||||
|
|
||||||
|
translate(v=[-80,80,0])
|
||||||
|
cube(size=[20,20, 4],center=true);
|
||||||
|
|
||||||
|
translate(v=[80,-80,0])
|
||||||
|
cube(size=[20,20, 4],center=true);
|
||||||
|
|
||||||
|
translate(v=[-80,-80,0])
|
||||||
|
cube(size=[20,20, 4],center=true);
|
||||||
|
}
|
||||||
|
|
||||||
|
module lugBottom() {
|
||||||
|
difference() {
|
||||||
|
cube(size=[9.7,9.7,6], center=true);
|
||||||
|
|
||||||
|
translate(v=[2,2,0])
|
||||||
|
cube(size=[9.1,9.1,5+1], center=true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module base() {
|
||||||
|
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
translate(v=[0,0,4/2])
|
||||||
|
baseFrame();
|
||||||
|
|
||||||
|
|
||||||
|
translate(v=[-90,-90,-6/2])
|
||||||
|
lugBottom();
|
||||||
|
|
||||||
|
mirror(v=[1,0,0])
|
||||||
|
translate(v=[-90,-90,-6/2])
|
||||||
|
lugBottom();
|
||||||
|
|
||||||
|
mirror(v=[0,1,0])
|
||||||
|
translate(v=[-90,-90,-6/2])
|
||||||
|
lugBottom();
|
||||||
|
|
||||||
|
mirror(v=[1,1,0])
|
||||||
|
translate(v=[-90,-90,-6/2])
|
||||||
|
lugBottom();
|
||||||
|
}
|
||||||
|
|
||||||
|
union() {
|
||||||
|
translate(v=[80,80,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
translate(v=[-80,80,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
translate(v=[80,-80,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
translate(v=[-80,-80,0])
|
||||||
|
cylinder(h = 100, r = m3ptr, $fn=32, center=true);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
base();
|
||||||
|
|
||||||
|
|
||||||
@ -1,21 +1,64 @@
|
|||||||
|
include <../common.scad>
|
||||||
|
|
||||||
|
// All coordinates are in [x,y], or [x,y,z] format
|
||||||
|
|
||||||
|
pcbDimensions = [79.41, 127.06]; // [x,y]
|
||||||
|
pcbThickness = 1.22;
|
||||||
|
|
||||||
rockProMountDeltaXY = [[0,0,0], [118,0,0], [118,71.0,0], [0,71.0,0]];
|
// TODO move mount points
|
||||||
|
mountPoints = [[0,0,0], [0,118,0], [71.0,118, 0], [71.0,0,0]];
|
||||||
|
|
||||||
|
module mountPoints_N(cylHeight, cylRad1, cylRad2, cylFn, center) {
|
||||||
module rockProMountPoints(cylHeight, cylRad1, cylRad2, cylFn, center) {
|
|
||||||
|
|
||||||
for (i=[0:3]) {
|
for (i=[0:3]) {
|
||||||
p = rockProMountDeltaXY[i];
|
p = mountPoints[i];
|
||||||
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 pcb() {
|
||||||
|
cube(size=[pcbDimensions[0], pcbDimensions[1], pcbThickness]);
|
||||||
|
}
|
||||||
|
|
||||||
//rockProMountPoints(10,2,64, true);
|
// defined on x-z plane, start at top of pcb
|
||||||
|
module frontFaceIOCutouts_N() {
|
||||||
|
translate(v=[9,0,0])
|
||||||
|
cube(size=[26.0,inf50,7.5]);
|
||||||
|
|
||||||
|
translate(v=[35,0,0])
|
||||||
|
cube(size=[35,inf50,17.9]);
|
||||||
|
}
|
||||||
|
module backFaceIOCutouts_N() {
|
||||||
|
translate(v=[9,0,0])
|
||||||
|
cube(size=[61,inf50,14]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module cutoutProfile_N() {
|
||||||
|
|
||||||
|
color([1,0,1])
|
||||||
|
union() {
|
||||||
|
mirror(v=[0,1,0])
|
||||||
|
translate(v=[0,-1,pcbThickness])
|
||||||
|
frontFaceIOCutouts_N();
|
||||||
|
|
||||||
|
translate(v=[0,pcbDimensions[1]-1, pcbThickness])
|
||||||
|
backFaceIOCutouts_N();
|
||||||
|
}
|
||||||
|
|
||||||
|
color([0.3,0.8,0.1])
|
||||||
|
difference() {
|
||||||
|
pcb();
|
||||||
|
translate(v=[3.75, 3.75])
|
||||||
|
mountPoints_N(10,2,2,10,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cutoutProfile_N();
|
||||||
|
|
||||||
|
|
||||||
|
//mountPoints_N(10,2,2, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
cases/rpi/.#front.scad
Symbolic link
1
cases/rpi/.#front.scad
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
zhao@zhao-desktop.12132:1663410391
|
||||||
149
cases/rpi/rpi2b.scad
Normal file
149
cases/rpi/rpi2b.scad
Normal 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
40798
cases/rpi/rpi2b.stl
Normal file
File diff suppressed because it is too large
Load Diff
30438
cases/rpi/rpi2bDimTest.stl
Normal file
30438
cases/rpi/rpi2bDimTest.stl
Normal file
File diff suppressed because it is too large
Load Diff
22
cases/rpi/top.scad
Normal file
22
cases/rpi/top.scad
Normal 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
2326
cases/rpi/top.stl
Normal file
File diff suppressed because it is too large
Load Diff
95
cases/rpi/voronoi.scad
Normal file
95
cases/rpi/voronoi.scad
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user