-
Notifications
You must be signed in to change notification settings - Fork 0
/
mount.scad
361 lines (319 loc) · 8.1 KB
/
mount.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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
// Segments in a circle, increase for the final render
$fn = 600;
// My Anet A8, which I use to debug this
// Nozzle diameter: 0.4mm
// Layer thickness: 0.08, 0.12, 0.16... in increments of 0.04mm
// Units are mm!
outer_r = 30/2; // outer disk radius
outer_h = 1.2;//2.76; // outer disk height
support_r = 25.5/2; // supporting disk radius
support_h = 0.6; // distance from support to base at support_r
support_s = 25.6/2*12; // rounding of the supporting disk
hplug = 7.44+support_h; // Height of the bottom 'plug'
r1 = 8.2; // Bottom radius of the plug
r2 = 9.2; // Upper radius of the plug
rr = 2.0; // rounding at the bottom
ru = 0.2; // rounding at the top
lock_a = [ 180+120, 180-105, 180-14 ]; // angles of the lock 'crests'
lock_ea0 = 36; // lock entrance start angle
lock_ea1 = 8; // lock entrance end angle
// tongues which hold the sensor
tongue_top = -1.2; // top, relative to support_h
tongue_r0 = 7.5; // inner radius
tongue_r1 = 12.0; // outer radius
tongues = [ [ 45+8, 45-8, 1.2 ], // start-end angles and thickness
[ 225+16, 225-16, 2.16 ] ];
// Trap door dimensions
tdw = 27.5; // width
tdh = 25.5; // height
tdd = 27.5; // distance between the diagonal bevels
tdl = 3.6; // length (depth)
a = 45; // diagonal bevels angle
tow = 23.5; // width of the opening
toh = 21.5; // height of the opening
// Trap door cutout to place the grips in
tdcw = 10;
tdch = 8;
// Clips
cth = 1.6; // thickness of a clip
cl = 7; // full length of a clip
c2b = 5.15; // clip-2-base distance
ct2 = 2.4; // clip thickness at the bottom
cl2 = 1.2; // length of the thick part above tongue
cto = 2.4; // length of the tongue of the clip (minus cth)
cw1 = 8; // width of the first (wider) clip
cw2 = 6; // width of the second (narrower) clip
cwr = 0.8; // width of the rests which touch the trap door
// Supports of the clips which touch the sensor
sw = 0.8;
st = 4; // top of the supports
sb = 7; // bottom of the supports
ss = 14; // separation between the opposite supports
// support disc cutout (to remove the sensor) width
dcw = 2.8;
/**
* Shape to cut a pie slice, angles a1-a2.
*/
module pie_cut( h, r, a1, a2 )
{
rotate( [ 0, 0, a1 ] )
{
translate( [ -r, 0, 0 ] )
{
cube( [ r*2, r*2, h*1.1 ], center = true );
}
}
rotate( [ 0, 0, a2 ] )
{
translate( [ r, 0, 0 ] )
{
cube( [ r*2, r*2, h*1.1 ], center = true );
}
}
}
/**
* Pie slice of thickness h, radius r, angles a1-a2
*/
module pie( h, r, a1, a2 )
{
difference( )
{
cylinder( h=h, r=r, center = true );
pie_cut( h, r, a1, a2 );
}
}
module plug_cone( )
{
translate( [ 0, 0, outer_h + support_h ] )
{
rotate( [ 180, 0, 0 ] )
{
hull()
{
rotate_extrude()
{
translate([r2-ru, 0]) circle(ru, $fn=8);
translate([r1-rr, (hplug-rr)]) circle(rr, $fn=24);
}
}
}
}
}
// Disk that the sensor lies on
module support_disk( )
{
// support normal angle at support_r from center
supa = asin( support_r/support_s );
outz = outer_h + support_s*cos(supa); // z of the outer rounding sphere
difference( )
{
cylinder( h=outer_h, r=outer_r );
translate( [ 0, 0, outz ] ) sphere( r=support_s/*, $fn=400*/ );
}
suph = outer_h+support_h/cos(supa); // support disk edge height above z=0
supz = suph + support_s*cos(supa); // z of the rounding sphere
// cut box dimensions
cbox_side = sqrt( 2*pow(2*support_h,2) );
cbox_size = [ cbox_side, support_r, cbox_side ];
// entrance cut box dimensions
ebox_width = support_r * sin( (lock_ea0-lock_ea1)/2.0 );
ebox_size = [ ebox_width, support_r, ebox_width*2 ];
difference( )
{
cylinder( h=suph*2.0, r=support_r );
translate( [ 0, 0, supz ] ) sphere( r=support_s/*, $fn=400*/ );
for ( ang = lock_a )
{
rotate( [ 0, 0, ang ] )
{
translate( [ 0, support_r, outer_h + 1.9*support_h ] )
{
rotate( [ supa, 0, 0 ] ) rotate( [ 0, 45, 0 ] )
{
cube( cbox_size, center=true );
}
}
}
}
for ( ang = lock_a )
{
rotate( [ 0, 0, ang+lock_ea0 ] )
{
translate( [ 0, support_r, outer_h + support_h ] )
{
rotate( [ supa, 0, 0 ] )
{
translate( [ ebox_width/2, 0, 0 ] )
{
cube( ebox_size, center=true );
}
}
}
}
}
for ( ang = lock_a )
{
rotate( [ 0, 0, ang+lock_ea1 ] )
{
translate( [ 0, support_r, outer_h + support_h ] )
{
rotate( [ supa, 0, 0 ] ) rotate( [ 0, 60, 0 ] )
{
translate( [ -ebox_width/2, 0, 0 ] )
{
cube( ebox_size, center=true );
}
}
}
}
}
}
}
module support_disk_cutout( )
{
// Length of the cutting box, we just need some large
// enough value
l = outer_r;
// Distance from the center to cutout
r = tdh/2; // same where the trap door starts
// Height of the cutting box, some value > disk h
h = outer_h*3;
translate( [ 0, r+l/2, 0 ] )
{
cube( [ dcw, l, h ], center = true );
}
}
// Trap door which has the shape of hexagonal prism
module trap_door( w, h, d, l )
{
intersection( )
{
cube( [ w, h, l ], true );
rotate( [ 0, 0, a ] )
{
cube( [ d, d*2, l ], true );
}
rotate( [ 0, 0, -a ] )
{
cube( [ d, d*2, l ], true );
}
}
}
// Makes x-parallel clip, zero y is where it touches
// the edge of the trap door opening.
module clip( w )
{
translate( [ 0, -ct2, 0 ] )
{
translate( [ -w/2, cth, -cl ] )
{
l = cto; // tongue length
t = cl - c2b; // tongue thickness
ra = atan( t/l );
difference( )
{
cube( [ w, l, t ] );
rotate( [ ra, 0, 0 ] )
{
translate( [ 0, 0, -t ] ) cube( [ w, 2*l, t ] );
}
}
}
translate( [ -w/2, 0, -c2b ] )
{
difference( )
{
cube( [ w, ct2, cl2 ] );
translate( [ cwr, 0, 0 ] )
{
cube( [ w - 2*cwr, ct2, cl2 ] );
}
}
}
translate( [ -w/2, 0, -cl ] )
{
cube( [ w, cth, cl ] );
}
}
}
// Supporting structure which is inside the grip.
module support_inner( )
{
translate( [ 0, 0, -tdl/2 ] )
{
difference( )
{
trap_door( tdw, tdh, tdd, tdl );
union( )
{
cube( [ tdcw, tdh, tdl ], center = true );
cube( [ tdw, tdch, tdl ], center = true );
}
}
}
translate( [ 0, toh/2, 0 ] )
{
clip( cw1 );
}
translate( [ 0, -toh/2, 0 ] )
{
rotate( [ 0, 0, 180 ] )
{
clip( cw1 );
}
}
translate( [ -tow/2, 0, 0 ] )
{
rotate( [ 0, 0, 90 ] )
{
clip( cw2 );
}
}
translate( [ tow/2, 0, 0 ] )
{
rotate( [ 0, 0, -90 ] )
{
clip( cw2 );
}
}
// Height of the clip supports
sh = sb - st;
translate( [ 0, 0, -sb/2 - st/2 ] )
{
difference( )
{
cube( [ tow - ct2*2, sw, sh ], center = true );
cube( [ ss, sw, sh ], center = true );
}
difference( )
{
cube( [ sw, toh - ct2*2, sh ], center = true );
cube( [ sw, ss, sh ], center = true );
}
}
}
difference( )
{
union( )
{
difference( )
{
support_disk( );
support_disk_cutout( );
}
support_inner( );
}
plug_cone( );
}
difference( )
{
for ( tongue = tongues )
{
lz = tongue_top + outer_h + support_h - tongue[2]/2;
translate( [ 0, 0, lz ] )
{
pie( tongue[2], tongue_r1, tongue[0], tongue[1] );
}
}
cylinder( r=tongue_r0, h=outer_h*10, center=true );
}