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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
include <design.scad>
include <helpers.scad>
// `Heat` in module name means heat brass threaded insert
// in scanner coords:
// Z facing towards laser beam
// X facing right on laser beam plane
// Y facing top (for scanner body)
hole_side_front = [90, 0, 0];
hole_side_back = [-90, 0, 0];
hole_side_top = [180, 0, 0];
hole_side_bottom = [0, 0, 0];
hole_side_left = [0, 90, 0];
hole_side_right = [0, -90, 0];
hole_insert_height = 4;
m2_head_diameter = 3.75;
m2_head_height = 1.9;
m2 = 2;
padding_around_insert = 2;
// gw - glass width
// gh - glass height
// gt - glass thickness
// gcr - glass corner radius
module glass_hole(gw, gh, gt, gcr)
{
wt = $scannerBodyWallThicknessMm;
padding_around_glass = 0.4;
padding_under_glass = 1;
pag = padding_around_glass;
pug = padding_under_glass;
// visualize glass
color("yellow", 0.5)
hull()
{
for (x_mult = [-1, 1], y_mult = [-1, 1])
{
translate([
(-gw / 2 + gcr) * x_mult,
(-gh / 2 + gcr) * y_mult,
0])
cylinder($fn = dToFn(gcr * 2), r = gcr, h = gt);
}
}
// area to cut around glass
// TODO: create a module for such rounded rects
color("blue", 0.5)
hull()
{
w = gw + pag * 2;
h = gh + pag * 2;
// I'm not sure it's needed, but epoxy should
// have some thickness as well, and this padding should
// protect the glass a bit (the glass will not protrude
// from the scanner body)
t = gt + pag + $tiny_padding;
for (x_mult = [-1, 1], y_mult = [-1, 1])
{
translate([
(-w / 2 + gcr) * x_mult,
(-h / 2 + gcr) * y_mult,
// cut without artifacts
-$tiny_padding])
cylinder($fn = dToFn(gcr * 2), r = gcr, h = t);
}
}
// area to cut under glass
color("blue", 0.5)
hull()
{
w = gw - pug * 2;
h = gh - pug * 2;
// cut without artifacts
// area in front of glass is already taken
// into account above
t = wt + $tiny_padding;
for (x_mult = [-1, 1], y_mult = [-1, 1])
{
translate([
(-w / 2 + gcr) * x_mult,
(-h / 2 + gcr) * y_mult,
0])
cylinder($fn = dToFn(gcr * 2), r = gcr, h = t);
}
}
}
// see `glass_hole` docs for params details
module front_glass_hole(gw, gh, gt, gcr)
{
rotate([90, 0, 0])
glass_hole(gw, gh, gt, gcr);
}
// m - bolt deameter, like M2
// id - insert diameter
// il - insert length
// hd - screw head diameter
// hh - screw head height
// hs - hole side, see values above for details
// wt - wall thickness
// TODO: use `bolt` or `screw` everywhere
module screw_hole(m, id, il, hd, hh, hs, wt = $scannerBodyWallThicknessMm)
{
screw_diameter_delta = 0.2;
sdd = screw_diameter_delta;
head_diameter_delta = 1;
hdd = head_diameter_delta;
head_height_delta = 0.1;
hhd = head_height_delta;
subwall_thickness = 2;
rotate(hs)
{
// insert cutter
cylinder($fn = dToFn(id), d = id, h = il);
// screw cutter
rotate([180, 0, 0])
{
// full screw diameter
fsd = m + sdd;
translate([0, 0, -$tiny_padding])
cylinder($fn = dToFn(fsd), d = fsd, h = wt + $tiny_padding * 2);
// screw head cutter
// full head diameter
fhd = hd + hdd;
fhh = hh + hhd;
echo("hh:", hh);
echo("fhh:", fhh);
translate([0, 0, wt - fhh - $tiny_padding])
cylinder($fn = dToFn(fhd), d = fhd, h = fhh + $tiny_padding * 2);
}
}
}
function padded_hole_d(hd = 4) =
hd + padding_around_insert * 2;
// h - height
// hd - hole diameter
// TODO: support usual holes, not only hot inserts
module hole_holder(h, hd = 4)
{
d = padded_hole_d(hd);
cube_size = [d * 2, d / 2, h];
rotate([90, 0, 90])
translate([0, d / 2, -h / 2])
difference()
{
union()
{
cylinder($fn = dToFn(d), d = d, h = h);
translate([0, -cube_size[1] / 2, h / 2])
cube(cube_size, center = true);
}
union()
{
translate([-d, 0, -$tiny_padding])
cylinder($fn = dToFn(d), d = d, h = h + $tiny_padding * 2);
translate([d, 0, -$tiny_padding])
cylinder($fn = dToFn(d), d = d, h = h + $tiny_padding * 2);
}
}
}
// h - height
// hd - hole (insert) diameter
// hs - hole side, see values above for details
module hole_holder_hot_inserts(h, hd = 4, hs)
{
d = hd + padding_around_insert * 2;
rotate(hs)
difference()
{
hole_holder(h = 40, hd = 4);
// holes for hot inserts
union()
{
translate([-h / 2 - $tiny_padding, 0, d / 2])
screw_hole(
m = m2,
id = hd,
il = hole_insert_height,
hd = m2_head_diameter,
hh = m2_head_height,
hs = hole_side_left);
translate([h / 2 + $tiny_padding, 0, d / 2])
screw_hole(
m = m2,
id = hd,
il = hole_insert_height,
hd = m2_head_diameter,
hh = m2_head_height,
hs = hole_side_right);
}
}
}
hole_holder_hot_inserts(h = 40, hd = 4, hs = hole_side_top);
*screw_hole(
m = m2,
id = 4,
il = hole_insert_height * 2,
hd = m2_head_diameter,
hh = m2_head_height,
hs = hole_side_bottom);
//front_glass_hole(gw = 26.6, gh = 19.6, gt = 2, gcr = 1);
//screw_hole(2);
|