818dd661 |
1 | /* GNU AGPLv3 (or later at your option) |
2 | see bottom for more license info */ |
3 | |
4 | /* spin thing that erin likes */ |
cc410ed6 |
5 | $fn = 50; |
6 | |
7 | layer_height = 0.15; |
818dd661 |
8 | |
9 | weight = "penny"; |
10 | // weight = "608zz"; |
3e3691aa |
11 | bearing = "608zz"; |
cc410ed6 |
12 | weight_lip_overhang = 0.3; |
13 | bearing_lip_overhang = weight_lip_overhang; |
14 | // TODO: switch wall_thickness -> wall |
15 | wall_thickness = 3; |
16 | wall = 3; |
2645ef26 |
17 | penny_thickness = 1.52; |
818dd661 |
18 | penny_radius = 19.05 / 2; |
7f1519fb |
19 | |
20 | _608zz_radius = 22 / 2; |
21 | _608zz_inner_radius = 8.1 / 2; |
22 | _608zz_cover_radius = 19.4 / 2; |
23 | _608zz_cap_footprint_radius = 12 / 2; |
24 | _608zz_thickness = 7; |
25 | |
818dd661 |
26 | weight_radius = (weight == "penny") ? penny_radius : _608zz_radius; |
2645ef26 |
27 | weight_thickness = (weight == "penny") ? |
28 | penny_thickness * 5 : _608zz_thickness; |
7f1519fb |
29 | |
3e3691aa |
30 | bearing_radius = (bearing == "608zz") ? _608zz_radius : 1/0; |
7f1519fb |
31 | bearing_inner_radius = (bearing == "608zz") ? _608zz_inner_radius : 1/0; |
32 | bearing_cover_radius = (bearing == "608zz") |
cc410ed6 |
33 | ? _608zz_cover_radius + wall |
7f1519fb |
34 | : 1/0; |
35 | bearing_cap_footprint_radius = |
36 | (bearing == "608zz") ? _608zz_cap_footprint_radius : 1/0; |
2645ef26 |
37 | bearing_thickness = (bearing == "608zz") ? _608zz_thickness : 1/0; |
7f1519fb |
38 | |
39 | spinner_height = penny_thickness * 5 + 2; |
818dd661 |
40 | arms = 3; |
41 | |
7f1519fb |
42 | module cap(bearing_inner_radius, |
43 | bearing_cap_footprint_radius, |
44 | bearing_cover_radius, |
45 | bearing_thickness) { |
46 | footprint_height = 1.6; |
47 | footprint_radius_safety = 0.25; |
48 | cap_height = 3; |
49 | bearing_cover_radius_safety = 0.75; |
50 | bearing_thickness_safety = 0.2; |
51 | |
52 | difference() { |
53 | union() { |
54 | cylinder(r1 = bearing_cover_radius - tan(30) * cap_height, |
55 | r2 = bearing_cover_radius, |
56 | h = cap_height); |
57 | linear_extrude(height = cap_height + footprint_height) { |
58 | circle(bearing_cap_footprint_radius - footprint_radius_safety); } |
59 | linear_extrude(height = cap_height |
60 | + footprint_height |
61 | + bearing_thickness / 2 |
62 | - bearing_thickness_safety) { |
63 | circle(bearing_inner_radius); } } |
64 | translate([0, 0, -0.01]) { |
65 | cylinder(r1 = bearing_inner_radius + tan(30) * (cap_height - 1), |
66 | r2 = bearing_inner_radius, |
67 | h = cap_height - 1); } } } |
68 | |
cc410ed6 |
69 | module fillet(r) { |
70 | offset(r = -r) { offset(delta = r) { children(); } } } |
71 | |
72 | module spin_footprint(weight_radius, |
73 | bearing_radius, |
74 | round_extra, |
75 | wall, |
76 | arms) { |
77 | thinner_radius = (bearing_radius < weight_radius)? |
78 | bearing_radius : weight_radius; |
79 | fillet(thinner_radius) { |
80 | for(arm = [0 : arms - 1]) { |
81 | hull() { |
82 | circle(bearing_radius + round_extra); |
83 | rotate( (arm / arms) * 360 ) { |
84 | translate([bearing_radius + wall + weight_radius, 0]) { |
85 | circle(weight_radius + round_extra); } } } } } } |
86 | |
87 | module mirrored(axis) { |
88 | children(); |
89 | mirror(axis) children(); } |
2645ef26 |
90 | |
91 | module spin(weight_radius, |
92 | weight_thickness, |
2645ef26 |
93 | bearing_radius, |
cc410ed6 |
94 | bearing_thickness, |
95 | weight_lip_overhang = 0.3, |
96 | bearing_lip_overhang = 0.3, |
97 | wall = 3, |
98 | arms = 3) { |
99 | layer_height = 0.15; |
100 | thicker_thickness = (bearing_thickness > weight_thickness) ? |
101 | bearing_thickness : weight_thickness; |
102 | calculated_height = thicker_thickness + 2 * wall; |
103 | layers = 2 * ceil(ceil(calculated_height / layer_height) / 2); |
104 | actual_height = layers * layer_height; |
105 | round_radius = actual_height / 2; |
106 | |
107 | mirrored([0, 0, 1]) { |
108 | for(layer = [0 : (layers / 2) - 1]) { |
109 | translate([0, 0, layer * layer_height - actual_height / 2]) { |
110 | linear_extrude(height = layer_height) { |
111 | adjacent = round_radius - (layer * layer_height); |
112 | angle = acos(adjacent / round_radius); |
113 | round_extra = adjacent * tan(angle); |
114 | spin_footprint(weight_radius, |
115 | bearing_radius, |
116 | round_extra, |
117 | wall, |
118 | arms); } } } } } |
818dd661 |
119 | |
120 | /* |
121 | This file is part of 3d-printables. |
122 | |
123 | 3d-printables is free software: you can redistribute it and/or modify |
124 | it under the terms of the GNU Affero General Public License as published by |
125 | the Free Software Foundation, either version 3 of the License, or |
126 | (at your option) any later version. |
127 | |
128 | 3d-printables is distributed in the hope that it will be useful, |
129 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
130 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
131 | GNU Affero General Public License for more details. |
132 | |
133 | You should have received a copy of the GNU Affero General Public License |
134 | along with challenge-bot. If not, see <http://www.gnu.org/licenses/>. |
135 | */ |