|
@@ -0,0 +1,431 @@
|
|
1
|
+/*
|
|
2
|
+ * ISO-standard metric threads, following this specification:
|
|
3
|
+ * http://en.wikipedia.org/wiki/ISO_metric_screw_thread
|
|
4
|
+ *
|
|
5
|
+ * Copyright 2022 Dan Kirshner - dan_kirshner@yahoo.com
|
|
6
|
+ * This program is free software: you can redistribute it and/or modify
|
|
7
|
+ * it under the terms of the GNU General Public License as published by
|
|
8
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+ * (at your option) any later version.
|
|
10
|
+ *
|
|
11
|
+ * This program is distributed in the hope that it will be useful,
|
|
12
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+ * GNU General Public License for more details.
|
|
15
|
+ *
|
|
16
|
+ * See <http://www.gnu.org/licenses/>.
|
|
17
|
+ *
|
|
18
|
+ * Version 2.7. 2022-02-27 Increase minimum thread segments.
|
|
19
|
+ * Version 2.6. 2021-05-16 Contributed patches for leadin (thanks,
|
|
20
|
+ jeffery.spirko@tamucc.edu) and aligning thread
|
|
21
|
+ "facets" (triangulation) with base cylinder
|
|
22
|
+ (thanks, rambetter@protonmail.com).
|
|
23
|
+ * Version 2.5. 2020-04-11 Leadin option works for internal threads.
|
|
24
|
+ * Version 2.4. 2019-07-14 Add test option - do not render threads.
|
|
25
|
+ * Version 2.3. 2017-08-31 Default for leadin: 0 (best for internal threads).
|
|
26
|
+ * Version 2.2. 2017-01-01 Correction for angle; leadfac option. (Thanks to
|
|
27
|
+ * Andrew Allen <a2intl@gmail.com>.)
|
|
28
|
+ * Version 2.1. 2016-12-04 Chamfer bottom end (low-z); leadin option.
|
|
29
|
+ * Version 2.0. 2016-11-05 Backwards compatibility (earlier OpenSCAD) fixes.
|
|
30
|
+ * Version 1.9. 2016-07-03 Option: tapered.
|
|
31
|
+ * Version 1.8. 2016-01-08 Option: (non-standard) angle.
|
|
32
|
+ * Version 1.7. 2015-11-28 Larger x-increment - for small-diameters.
|
|
33
|
+ * Version 1.6. 2015-09-01 Options: square threads, rectangular threads.
|
|
34
|
+ * Version 1.5. 2015-06-12 Options: thread_size, groove.
|
|
35
|
+ * Version 1.4. 2014-10-17 Use "faces" instead of "triangles" for polyhedron
|
|
36
|
+ * Version 1.3. 2013-12-01 Correct loop over turns -- don't have early cut-off
|
|
37
|
+ * Version 1.2. 2012-09-09 Use discrete polyhedra rather than linear_extrude ()
|
|
38
|
+ * Version 1.1. 2012-09-07 Corrected to right-hand threads!
|
|
39
|
+ */
|
|
40
|
+
|
|
41
|
+// Examples.
|
|
42
|
+//
|
|
43
|
+// Standard M8 x 1.
|
|
44
|
+// metric_thread (diameter=8, pitch=1, length=4);
|
|
45
|
+
|
|
46
|
+// Square thread.
|
|
47
|
+// metric_thread (diameter=8, pitch=1, length=4, square=true);
|
|
48
|
+
|
|
49
|
+// Non-standard: long pitch, same thread size.
|
|
50
|
+//metric_thread (diameter=8, pitch=4, length=4, thread_size=1, groove=true);
|
|
51
|
+
|
|
52
|
+// Non-standard: 20 mm diameter, long pitch, square "trough" width 3 mm,
|
|
53
|
+// depth 1 mm.
|
|
54
|
+//metric_thread (diameter=20, pitch=8, length=16, square=true, thread_size=6,
|
|
55
|
+// groove=true, rectangle=0.333);
|
|
56
|
+
|
|
57
|
+// English: 1/4 x 20.
|
|
58
|
+//english_thread (diameter=1/4, threads_per_inch=20, length=1);
|
|
59
|
+
|
|
60
|
+// Tapered. Example -- pipe size 3/4" -- per:
|
|
61
|
+// http://www.engineeringtoolbox.com/npt-national-pipe-taper-threads-d_750.html
|
|
62
|
+// english_thread (diameter=1.05, threads_per_inch=14, length=3/4, taper=1/16);
|
|
63
|
+
|
|
64
|
+// Thread for mounting on Rohloff hub.
|
|
65
|
+//difference () {
|
|
66
|
+// cylinder (r=20, h=10, $fn=100);
|
|
67
|
+//
|
|
68
|
+// metric_thread (diameter=34, pitch=1, length=10, internal=true, n_starts=6);
|
|
69
|
+//}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+// ----------------------------------------------------------------------------
|
|
73
|
+function segments (diameter) = min (150, max (ceil (diameter*6), 25));
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+// ----------------------------------------------------------------------------
|
|
77
|
+// diameter - outside diameter of threads in mm. Default: 8.
|
|
78
|
+// pitch - thread axial "travel" per turn in mm. Default: 1.
|
|
79
|
+// length - overall axial length of thread in mm. Default: 1.
|
|
80
|
+// internal - true = clearances for internal thread (e.g., a nut).
|
|
81
|
+// false = clearances for external thread (e.g., a bolt).
|
|
82
|
+// (Internal threads should be "cut out" from a solid using
|
|
83
|
+// difference ()). Default: false.
|
|
84
|
+// n_starts - Number of thread starts (e.g., DNA, a "double helix," has
|
|
85
|
+// n_starts=2). See wikipedia Screw_thread. Default: 1.
|
|
86
|
+// thread_size - (non-standard) axial width of a single thread "V" - independent
|
|
87
|
+// of pitch. Default: same as pitch.
|
|
88
|
+// groove - (non-standard) true = subtract inverted "V" from cylinder
|
|
89
|
+// (rather thanadd protruding "V" to cylinder). Default: false.
|
|
90
|
+// square - true = square threads (per
|
|
91
|
+// https://en.wikipedia.org/wiki/Square_thread_form). Default:
|
|
92
|
+// false.
|
|
93
|
+// rectangle - (non-standard) "Rectangular" thread - ratio depth/(axial) width
|
|
94
|
+// Default: 0 (standard "v" thread).
|
|
95
|
+// angle - (non-standard) angle (deg) of thread side from perpendicular to
|
|
96
|
+// axis (default = standard = 30 degrees).
|
|
97
|
+// taper - diameter change per length (National Pipe Thread/ANSI B1.20.1
|
|
98
|
+// is 1" diameter per 16" length). Taper decreases from 'diameter'
|
|
99
|
+// as z increases. Default: 0 (no taper).
|
|
100
|
+// leadin - 0 (default): no chamfer; 1: chamfer (45 degree) at max-z end;
|
|
101
|
+// 2: chamfer at both ends, 3: chamfer at z=0 end.
|
|
102
|
+// leadfac - scale of leadin chamfer length (default: 1.0 = 1/2 thread).
|
|
103
|
+// test - true = do not render threads (just draw "blank" cylinder).
|
|
104
|
+// Default: false (draw threads).
|
|
105
|
+module metric_thread (diameter=8, pitch=1, length=1, internal=false, n_starts=1,
|
|
106
|
+ thread_size=-1, groove=false, square=false, rectangle=0,
|
|
107
|
+ angle=30, taper=0, leadin=0, leadfac=1.0, test=false)
|
|
108
|
+{
|
|
109
|
+ // thread_size: size of thread "V" different than travel per turn (pitch).
|
|
110
|
+ // Default: same as pitch.
|
|
111
|
+ local_thread_size = thread_size == -1 ? pitch : thread_size;
|
|
112
|
+ local_rectangle = rectangle ? rectangle : 1;
|
|
113
|
+
|
|
114
|
+ n_segments = segments (diameter);
|
|
115
|
+ h = (test && ! internal) ? 0 : (square || rectangle) ? local_thread_size*local_rectangle/2 : local_thread_size / (2 * tan(angle));
|
|
116
|
+
|
|
117
|
+ h_fac1 = (square || rectangle) ? 0.90 : 0.625;
|
|
118
|
+
|
|
119
|
+ // External thread includes additional relief.
|
|
120
|
+ h_fac2 = (square || rectangle) ? 0.95 : 5.3/8;
|
|
121
|
+
|
|
122
|
+ tapered_diameter = diameter - length*taper;
|
|
123
|
+
|
|
124
|
+ difference () {
|
|
125
|
+ union () {
|
|
126
|
+ if (! groove) {
|
|
127
|
+ if (! test) {
|
|
128
|
+ metric_thread_turns (diameter, pitch, length, internal, n_starts,
|
|
129
|
+ local_thread_size, groove, square, rectangle, angle,
|
|
130
|
+ taper);
|
|
131
|
+ }
|
|
132
|
+ }
|
|
133
|
+
|
|
134
|
+ difference () {
|
|
135
|
+
|
|
136
|
+ // Solid center, including Dmin truncation.
|
|
137
|
+ if (groove) {
|
|
138
|
+ cylinder (r1=diameter/2, r2=tapered_diameter/2,
|
|
139
|
+ h=length, $fn=n_segments);
|
|
140
|
+ } else if (internal) {
|
|
141
|
+ cylinder (r1=diameter/2 - h*h_fac1, r2=tapered_diameter/2 - h*h_fac1,
|
|
142
|
+ h=length, $fn=n_segments);
|
|
143
|
+ } else {
|
|
144
|
+
|
|
145
|
+ // External thread.
|
|
146
|
+ cylinder (r1=diameter/2 - h*h_fac2, r2=tapered_diameter/2 - h*h_fac2,
|
|
147
|
+ h=length, $fn=n_segments);
|
|
148
|
+ }
|
|
149
|
+
|
|
150
|
+ if (groove) {
|
|
151
|
+ if (! test) {
|
|
152
|
+ metric_thread_turns (diameter, pitch, length, internal, n_starts,
|
|
153
|
+ local_thread_size, groove, square, rectangle,
|
|
154
|
+ angle, taper);
|
|
155
|
+ }
|
|
156
|
+ }
|
|
157
|
+ }
|
|
158
|
+
|
|
159
|
+ // Internal thread lead-in: take away from external solid.
|
|
160
|
+ if (internal) {
|
|
161
|
+
|
|
162
|
+ // "Negative chamfer" z=0 end if leadin is 2 or 3.
|
|
163
|
+ if (leadin == 2 || leadin == 3) {
|
|
164
|
+
|
|
165
|
+ // Fixes by jeffery.spirko@tamucc.edu.
|
|
166
|
+ cylinder (r1=diameter/2 - h + h*h_fac1*leadfac,
|
|
167
|
+ r2=diameter/2 - h,
|
|
168
|
+ h=h*h_fac1*leadfac, $fn=n_segments);
|
|
169
|
+ /*
|
|
170
|
+ cylinder (r1=diameter/2,
|
|
171
|
+ r2=diameter/2 - h*h_fac1*leadfac,
|
|
172
|
+ h=h*h_fac1*leadfac, $fn=n_segments);
|
|
173
|
+ */
|
|
174
|
+ }
|
|
175
|
+
|
|
176
|
+ // "Negative chamfer" z-max end if leadin is 1 or 2.
|
|
177
|
+ if (leadin == 1 || leadin == 2) {
|
|
178
|
+ translate ([0, 0, length + 0.05 - h*h_fac1*leadfac]) {
|
|
179
|
+
|
|
180
|
+ cylinder (r1=tapered_diameter/2 - h,
|
|
181
|
+ h=h*h_fac1*leadfac,
|
|
182
|
+ r2=tapered_diameter/2 - h + h*h_fac1*leadfac,
|
|
183
|
+ $fn=n_segments);
|
|
184
|
+ /*
|
|
185
|
+ cylinder (r1=tapered_diameter/2 - h*h_fac1*leadfac,
|
|
186
|
+ h=h*h_fac1*leadfac,
|
|
187
|
+ r2=tapered_diameter/2,
|
|
188
|
+ $fn=n_segments);
|
|
189
|
+ */
|
|
190
|
+ }
|
|
191
|
+ }
|
|
192
|
+ }
|
|
193
|
+ }
|
|
194
|
+
|
|
195
|
+ if (! internal) {
|
|
196
|
+
|
|
197
|
+ // Chamfer z=0 end if leadin is 2 or 3.
|
|
198
|
+ if (leadin == 2 || leadin == 3) {
|
|
199
|
+ difference () {
|
|
200
|
+ cylinder (r=diameter/2 + 1, h=h*h_fac1*leadfac, $fn=n_segments);
|
|
201
|
+
|
|
202
|
+ cylinder (r2=diameter/2, r1=diameter/2 - h*h_fac1*leadfac, h=h*h_fac1*leadfac,
|
|
203
|
+ $fn=n_segments);
|
|
204
|
+ }
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ // Chamfer z-max end if leadin is 1 or 2.
|
|
208
|
+ if (leadin == 1 || leadin == 2) {
|
|
209
|
+ translate ([0, 0, length + 0.05 - h*h_fac1*leadfac]) {
|
|
210
|
+ difference () {
|
|
211
|
+ cylinder (r=diameter/2 + 1, h=h*h_fac1*leadfac, $fn=n_segments);
|
|
212
|
+
|
|
213
|
+ cylinder (r1=tapered_diameter/2, r2=tapered_diameter/2 - h*h_fac1*leadfac, h=h*h_fac1*leadfac,
|
|
214
|
+ $fn=n_segments);
|
|
215
|
+ }
|
|
216
|
+ }
|
|
217
|
+ }
|
|
218
|
+ }
|
|
219
|
+ }
|
|
220
|
+}
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+// ----------------------------------------------------------------------------
|
|
224
|
+// Input units in inches.
|
|
225
|
+// Note: units of measure in drawing are mm!
|
|
226
|
+module english_thread (diameter=0.25, threads_per_inch=20, length=1,
|
|
227
|
+ internal=false, n_starts=1, thread_size=-1, groove=false,
|
|
228
|
+ square=false, rectangle=0, angle=30, taper=0, leadin=0,
|
|
229
|
+ leadfac=1.0, test=false)
|
|
230
|
+{
|
|
231
|
+ // Convert to mm.
|
|
232
|
+ mm_diameter = diameter*25.4;
|
|
233
|
+ mm_pitch = (1.0/threads_per_inch)*25.4;
|
|
234
|
+ mm_length = length*25.4;
|
|
235
|
+
|
|
236
|
+ echo (str ("mm_diameter: ", mm_diameter));
|
|
237
|
+ echo (str ("mm_pitch: ", mm_pitch));
|
|
238
|
+ echo (str ("mm_length: ", mm_length));
|
|
239
|
+ metric_thread (mm_diameter, mm_pitch, mm_length, internal, n_starts,
|
|
240
|
+ thread_size, groove, square, rectangle, angle, taper, leadin,
|
|
241
|
+ leadfac, test);
|
|
242
|
+}
|
|
243
|
+
|
|
244
|
+// ----------------------------------------------------------------------------
|
|
245
|
+module metric_thread_turns (diameter, pitch, length, internal, n_starts,
|
|
246
|
+ thread_size, groove, square, rectangle, angle,
|
|
247
|
+ taper)
|
|
248
|
+{
|
|
249
|
+ // Number of turns needed.
|
|
250
|
+ n_turns = floor (length/pitch);
|
|
251
|
+
|
|
252
|
+ intersection () {
|
|
253
|
+
|
|
254
|
+ // Start one below z = 0. Gives an extra turn at each end.
|
|
255
|
+ for (i=[-1*n_starts : n_turns+1]) {
|
|
256
|
+ translate ([0, 0, i*pitch]) {
|
|
257
|
+ metric_thread_turn (diameter, pitch, internal, n_starts,
|
|
258
|
+ thread_size, groove, square, rectangle, angle,
|
|
259
|
+ taper, i*pitch);
|
|
260
|
+ }
|
|
261
|
+ }
|
|
262
|
+
|
|
263
|
+ // Cut to length.
|
|
264
|
+ translate ([0, 0, length/2]) {
|
|
265
|
+ cube ([diameter*3, diameter*3, length], center=true);
|
|
266
|
+ }
|
|
267
|
+ }
|
|
268
|
+}
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+// ----------------------------------------------------------------------------
|
|
272
|
+module metric_thread_turn (diameter, pitch, internal, n_starts, thread_size,
|
|
273
|
+ groove, square, rectangle, angle, taper, z)
|
|
274
|
+{
|
|
275
|
+ n_segments = segments (diameter);
|
|
276
|
+ fraction_circle = 1.0/n_segments;
|
|
277
|
+ for (i=[0 : n_segments-1]) {
|
|
278
|
+
|
|
279
|
+ // Keep polyhedron "facets" aligned -- circumferentially -- with base
|
|
280
|
+ // cylinder facets. (Patch contributed by rambetter@protonmail.com.)
|
|
281
|
+ rotate ([0, 0, (i + 0.5)*360*fraction_circle + 90]) {
|
|
282
|
+ translate ([0, 0, i*n_starts*pitch*fraction_circle]) {
|
|
283
|
+ //current_diameter = diameter - taper*(z + i*n_starts*pitch*fraction_circle);
|
|
284
|
+ thread_polyhedron ((diameter - taper*(z + i*n_starts*pitch*fraction_circle))/2,
|
|
285
|
+ pitch, internal, n_starts, thread_size, groove,
|
|
286
|
+ square, rectangle, angle);
|
|
287
|
+ }
|
|
288
|
+ }
|
|
289
|
+ }
|
|
290
|
+}
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+// ----------------------------------------------------------------------------
|
|
294
|
+module thread_polyhedron (radius, pitch, internal, n_starts, thread_size,
|
|
295
|
+ groove, square, rectangle, angle)
|
|
296
|
+{
|
|
297
|
+ n_segments = segments (radius*2);
|
|
298
|
+ fraction_circle = 1.0/n_segments;
|
|
299
|
+
|
|
300
|
+ local_rectangle = rectangle ? rectangle : 1;
|
|
301
|
+
|
|
302
|
+ h = (square || rectangle) ? thread_size*local_rectangle/2 : thread_size / (2 * tan(angle));
|
|
303
|
+ outer_r = radius + (internal ? h/20 : 0); // Adds internal relief.
|
|
304
|
+ //echo (str ("outer_r: ", outer_r));
|
|
305
|
+
|
|
306
|
+ // A little extra on square thread -- make sure overlaps cylinder.
|
|
307
|
+ h_fac1 = (square || rectangle) ? 1.1 : 0.875;
|
|
308
|
+ inner_r = radius - h*h_fac1; // Does NOT do Dmin_truncation - do later with
|
|
309
|
+ // cylinder.
|
|
310
|
+
|
|
311
|
+ translate_y = groove ? outer_r + inner_r : 0;
|
|
312
|
+ reflect_x = groove ? 1 : 0;
|
|
313
|
+
|
|
314
|
+ // Make these just slightly bigger (keep in proportion) so polyhedra will
|
|
315
|
+ // overlap.
|
|
316
|
+ x_incr_outer = (! groove ? outer_r : inner_r) * fraction_circle * 2 * PI * 1.02;
|
|
317
|
+ x_incr_inner = (! groove ? inner_r : outer_r) * fraction_circle * 2 * PI * 1.02;
|
|
318
|
+ z_incr = n_starts * pitch * fraction_circle * 1.005;
|
|
319
|
+
|
|
320
|
+ /*
|
|
321
|
+ (angles x0 and x3 inner are actually 60 deg)
|
|
322
|
+
|
|
323
|
+ /\ (x2_inner, z2_inner) [2]
|
|
324
|
+ / \
|
|
325
|
+ (x3_inner, z3_inner) / \
|
|
326
|
+ [3] \ \
|
|
327
|
+ |\ \ (x2_outer, z2_outer) [6]
|
|
328
|
+ | \ /
|
|
329
|
+ | \ /|
|
|
330
|
+ z |[7]\/ / (x1_outer, z1_outer) [5]
|
|
331
|
+ | | | /
|
|
332
|
+ | x | |/
|
|
333
|
+ | / | / (x0_outer, z0_outer) [4]
|
|
334
|
+ | / | / (behind: (x1_inner, z1_inner) [1]
|
|
335
|
+ |/ | /
|
|
336
|
+ y________| |/
|
|
337
|
+ (r) / (x0_inner, z0_inner) [0]
|
|
338
|
+
|
|
339
|
+ */
|
|
340
|
+
|
|
341
|
+ x1_outer = outer_r * fraction_circle * 2 * PI;
|
|
342
|
+
|
|
343
|
+ z0_outer = (outer_r - inner_r) * tan(angle);
|
|
344
|
+ //echo (str ("z0_outer: ", z0_outer));
|
|
345
|
+
|
|
346
|
+ //polygon ([[inner_r, 0], [outer_r, z0_outer],
|
|
347
|
+ // [outer_r, 0.5*pitch], [inner_r, 0.5*pitch]]);
|
|
348
|
+ z1_outer = z0_outer + z_incr;
|
|
349
|
+
|
|
350
|
+ // Give internal square threads some clearance in the z direction, too.
|
|
351
|
+ bottom = internal ? 0.235 : 0.25;
|
|
352
|
+ top = internal ? 0.765 : 0.75;
|
|
353
|
+
|
|
354
|
+ translate ([0, translate_y, 0]) {
|
|
355
|
+ mirror ([reflect_x, 0, 0]) {
|
|
356
|
+
|
|
357
|
+ if (square || rectangle) {
|
|
358
|
+
|
|
359
|
+ // Rule for face ordering: look at polyhedron from outside: points must
|
|
360
|
+ // be in clockwise order.
|
|
361
|
+ polyhedron (
|
|
362
|
+ points = [
|
|
363
|
+ [-x_incr_inner/2, -inner_r, bottom*thread_size], // [0]
|
|
364
|
+ [x_incr_inner/2, -inner_r, bottom*thread_size + z_incr], // [1]
|
|
365
|
+ [x_incr_inner/2, -inner_r, top*thread_size + z_incr], // [2]
|
|
366
|
+ [-x_incr_inner/2, -inner_r, top*thread_size], // [3]
|
|
367
|
+
|
|
368
|
+ [-x_incr_outer/2, -outer_r, bottom*thread_size], // [4]
|
|
369
|
+ [x_incr_outer/2, -outer_r, bottom*thread_size + z_incr], // [5]
|
|
370
|
+ [x_incr_outer/2, -outer_r, top*thread_size + z_incr], // [6]
|
|
371
|
+ [-x_incr_outer/2, -outer_r, top*thread_size] // [7]
|
|
372
|
+ ],
|
|
373
|
+
|
|
374
|
+ faces = [
|
|
375
|
+ [0, 3, 7, 4], // This-side trapezoid
|
|
376
|
+
|
|
377
|
+ [1, 5, 6, 2], // Back-side trapezoid
|
|
378
|
+
|
|
379
|
+ [0, 1, 2, 3], // Inner rectangle
|
|
380
|
+
|
|
381
|
+ [4, 7, 6, 5], // Outer rectangle
|
|
382
|
+
|
|
383
|
+ // These are not planar, so do with separate triangles.
|
|
384
|
+ [7, 2, 6], // Upper rectangle, bottom
|
|
385
|
+ [7, 3, 2], // Upper rectangle, top
|
|
386
|
+
|
|
387
|
+ [0, 5, 1], // Lower rectangle, bottom
|
|
388
|
+ [0, 4, 5] // Lower rectangle, top
|
|
389
|
+ ]
|
|
390
|
+ );
|
|
391
|
+ } else {
|
|
392
|
+
|
|
393
|
+ // Rule for face ordering: look at polyhedron from outside: points must
|
|
394
|
+ // be in clockwise order.
|
|
395
|
+ polyhedron (
|
|
396
|
+ points = [
|
|
397
|
+ [-x_incr_inner/2, -inner_r, 0], // [0]
|
|
398
|
+ [x_incr_inner/2, -inner_r, z_incr], // [1]
|
|
399
|
+ [x_incr_inner/2, -inner_r, thread_size + z_incr], // [2]
|
|
400
|
+ [-x_incr_inner/2, -inner_r, thread_size], // [3]
|
|
401
|
+
|
|
402
|
+ [-x_incr_outer/2, -outer_r, z0_outer], // [4]
|
|
403
|
+ [x_incr_outer/2, -outer_r, z0_outer + z_incr], // [5]
|
|
404
|
+ [x_incr_outer/2, -outer_r, thread_size - z0_outer + z_incr], // [6]
|
|
405
|
+ [-x_incr_outer/2, -outer_r, thread_size - z0_outer] // [7]
|
|
406
|
+ ],
|
|
407
|
+
|
|
408
|
+ faces = [
|
|
409
|
+ [0, 3, 7, 4], // This-side trapezoid
|
|
410
|
+
|
|
411
|
+ [1, 5, 6, 2], // Back-side trapezoid
|
|
412
|
+
|
|
413
|
+ [0, 1, 2, 3], // Inner rectangle
|
|
414
|
+
|
|
415
|
+ [4, 7, 6, 5], // Outer rectangle
|
|
416
|
+
|
|
417
|
+ // These are not planar, so do with separate triangles.
|
|
418
|
+ [7, 2, 6], // Upper rectangle, bottom
|
|
419
|
+ [7, 3, 2], // Upper rectangle, top
|
|
420
|
+
|
|
421
|
+ [0, 5, 1], // Lower rectangle, bottom
|
|
422
|
+ [0, 4, 5] // Lower rectangle, top
|
|
423
|
+ ]
|
|
424
|
+ );
|
|
425
|
+ }
|
|
426
|
+ }
|
|
427
|
+ }
|
|
428
|
+}
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|