|
14 | 14 | solid.patch_euclid.run_patch() |
15 | 15 |
|
16 | 16 |
|
17 | | -def thread(outline_pts, inner_rad, pitch, length, external=True, segments_per_rot=32, neck_in_degrees=0, neck_out_degrees=0): |
| 17 | +def thread(outline_pts, inner_rad, pitch, length, external=True, |
| 18 | + segments_per_rot=32, neck_in_degrees=0, neck_out_degrees=0): |
18 | 19 | '''Sweeps outline_pts (an array of points describing a closed polygon in XY) |
19 | 20 | through a spiral. |
20 | 21 |
|
@@ -51,7 +52,7 @@ def thread(outline_pts, inner_rad, pitch, length, external=True, segments_per_ro |
51 | 52 | doing to make the neck-in work as well. Not sure how the two approaches |
52 | 53 | compare in terms of render-time. -ETJ 16 Mar 2011 |
53 | 54 |
|
54 | | - NOTE: if pitch is less than the or equal to the height of each tooth (outline_pts), |
| 55 | + NOTE: if pitch is less than or equal to the height of each tooth (outline_pts), |
55 | 56 | OpenSCAD will likely crash, since the resulting screw would self-intersect |
56 | 57 | all over the place. For screws with essentially no space between |
57 | 58 | threads, (i.e., pitch=tooth_height), I use pitch= tooth_height+EPSILON, |
@@ -107,9 +108,9 @@ def thread(outline_pts, inner_rad, pitch, length, external=True, segments_per_ro |
107 | 108 | int_ext_mult = 1 if external else -1 |
108 | 109 | neck_in_rad = min_rad if external else max_rad |
109 | 110 |
|
110 | | - if angle < neck_in_degrees: |
| 111 | + if neck_in_degrees != 0 and angle < neck_in_degrees: |
111 | 112 | rad = neck_in_rad + int_ext_mult * angle / neck_in_degrees * outline_w |
112 | | - elif angle > total_angle - neck_in_degrees: |
| 113 | + elif neck_out_degrees != 0 and angle > total_angle - neck_out_degrees: |
113 | 114 | rad = neck_in_rad + int_ext_mult * (total_angle - angle) / neck_out_degrees * outline_w |
114 | 115 |
|
115 | 116 | elev_vec = Vector3(rad, 0, elevation) |
|
0 commit comments