forked from philipparndt/nuki-ultra-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparts.scad
86 lines (67 loc) · 2.52 KB
/
parts.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
module lock(topDiameter, bottomDiameter, height, depth) {
distance = height - topDiameter/2 - bottomDiameter/2;
translate([0, -topDiameter/2 + height/2, 0]) {
cylinder(h = depth, r = topDiameter/2, $fn=100);
translate([0, -distance, 0]) {
cylinder(h = depth, r = bottomDiameter/2, $fn=100);
}
translate([-bottomDiameter/2, -distance, 0]) {
cube([bottomDiameter, distance, depth]);
}
}
}
//lock(topDiameter = 17, bottomDiameter = 10, height = 32, depth=10);
module boreHoles(diameter, depth, boreHoleDistance) {
previewOptimize=.1;
translate([-boreHoleDistance/2, 0, 0]) {
translate([0, 0, -previewOptimize]) {
cylinder(d=diameter, h=depth+previewOptimize*2, center=false, $fn=100);
}
translate([boreHoleDistance, 0, 0]) {
translate([0, 0, -previewOptimize]) {
cylinder(d=diameter, h=depth+previewOptimize*2, center=false, $fn=100);
}
}
}
}
module countersinkHoles(diameter, depth, boreHoleDistance) {
previewOptimize=.1;
translate([-boreHoleDistance/2, 0, -depth]) {
translate([0, 0, -previewOptimize]) {
cylinder(r1=0, r2=diameter/2, h=depth, center=false, $fn=100);
}
translate([boreHoleDistance, 0, 0]) {
translate([0, 0, -previewOptimize]) {
cylinder(r1=0, r2=diameter/2, h=depth, center=false, $fn=100);
}
}
}
}
Mtolerance = 0.1;
M5size = 7.8;
function M5() = M5size + Mtolerance;
module hexHole(flatToFlatDistance, depth) {
previewOptimize = 0.1;
hexagonSide = flatToFlatDistance / (cos(30) * 2);
translate([0, 0, -previewOptimize]) {
linear_extrude(height=depth + previewOptimize * 2, center=false) {
polygon(points=[
[hexagonSide, 0],
[hexagonSide / 2, sqrt(3) * hexagonSide / 2],
[-hexagonSide / 2, sqrt(3) * hexagonSide / 2],
[-hexagonSide, 0],
[-hexagonSide / 2, -sqrt(3) * hexagonSide / 2],
[hexagonSide / 2, -sqrt(3) * hexagonSide / 2]
]);
}
}
}
module boreHexHoles(flatToFlatDistance, depth, boreHoleDistance) {
translate([-boreHoleDistance / 2, 0, 0]) {
hexHole(flatToFlatDistance, depth);
}
translate([boreHoleDistance / 2, 0, 0]) {
hexHole(flatToFlatDistance, depth);
}
}
base(diameter = 52, depth = 10, holeD = 5, boreHoleDistance=37.5);