forked from jazwa/rackstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrackEars.scad
67 lines (52 loc) · 1.82 KB
/
rackEars.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
include <./common.scad>
// Rack ear modules.
// To be used either by itself if the item supports it, or within another module
rackEarModule(u=4, frontThickness=3, sideThickness=3, frontWidth=20, sideDepth=50, backPlaneHeight, support=true);
module rackEarModule(
u,
frontThickness,
sideThickness,
frontWidth,
sideDepth,
backPlaneHeight,
support=true
) {
// check frontWidth is wide enough
assert(frontWidth-sideThickness >= rackMountScrewXDist+railScrewHoleToInnerEdge);
earHeight = u*uDiff + 2*rackMountScrewZDist;
difference() {
translate(v = [-rackMountScrewXDist, 0, -rackMountScrewZDist]) {
// front
cube(size = [frontWidth, frontThickness, earHeight]);
// side
hull() {
translate(v = [frontWidth-sideThickness, 0, 0])
cube(size = [sideThickness, frontThickness, earHeight]);
backSegmentPlane();
}
if (support) {
defaultExtraSpacing = 1;
extraSpacing = frontWidth-(rackMountScrewXDist+railScrewHoleToInnerEdge+sideThickness) > defaultExtraSpacing
? defaultExtraSpacing
: 0; // don't include extra spacing for support, if tray itself is too large
hull() {
translate(v= [rackMountScrewXDist+railScrewHoleToInnerEdge+extraSpacing,frontThickness,0])
cube(size = [sideThickness, eps, earHeight]);
backSegmentPlane();
}
}
}
rackMountHoles();
}
module backSegmentPlane() {
translate(v = [frontWidth-sideThickness, sideDepth, 0])
cube(size = [sideThickness, eps, backPlaneHeight]);
}
module rackMountHoles() {
rotate(a=[90,0,0])
cylinder(r=screwRadiusSlacked(mainRailScrewType), h=inf, center=true);
translate(v=[0,0,u*uDiff])
rotate(a=[90,0,0])
cylinder(r=screwRadiusSlacked(mainRailScrewType), h=inf, center=true);
}
}