-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.scad
116 lines (94 loc) · 1.58 KB
/
model.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
$fn = 80;
nothing = 0.01;
// screw diameter (nominal)
s = 4;
// bottom edge
t = 15;
// bottom hole edge
l = 7 + 0.6;
// bottom height
h1 = 2;
// middle height
h2 = 1;
// top height
h3 = 3;
// top edge
e = 6;
module screw(x, y, height, diameter) {
translate([x, y, -nothing])
cylinder(
d=diameter,
h=height + 2*nothing
);
}
module model_bottom(
size_x=t,
size_y=t,
size_z=h1,
hole_size_x=l,
hole_size_y=l
) {
difference() {
cube([size_x, size_y, size_z]);
// Hole
translate([
size_x/2 - hole_size_x/2,
size_y/2 - hole_size_y/2,
-nothing
])
cube([
hole_size_x,
hole_size_y,
size_z + 2*nothing
]);
}
}
module model_middle(
size_x=t,
size_y=t,
size_z=h2,
screw_diameter=s
) {
difference() {
cube([size_x, size_y, size_z]);
screw(
x=size_x/2,
y=size_y/2,
height=size_z,
diameter=screw_diameter
);
}
}
module model_top(
size_x=e,
size_y=e,
size_z=h3,
screw_diameter=s
) {
difference() {
cube([size_x, size_y, size_z]);
screw(
x=size_x/2,
y=size_y/2,
height=size_z,
diameter=screw_diameter
);
}
}
module model() {
difference() {
union() {
model_bottom();
translate([0, 0, h1 - nothing])
model_middle();
translate([t/2-e/2, t/2-e/2, h1+h2 - 2*nothing])
model_top();
};
screw(
x=t/2,
y=t/2,
diameter=s,
height=h1+h2+h3
);
}
}