1 /* GNU AGPLv3 (or later at your option)
2 see bottom for more license info */
4 /* spin thing that erin likes */
12 weight_lip_overhang
= 0.3;
13 bearing_lip_overhang
= weight_lip_overhang
;
15 penny_thickness
= 1.52;
16 penny_radius
= 19.05 / 2;
18 _608zz_radius
= 22 / 2;
19 _608zz_inner_radius
= 8.1 / 2;
20 _608zz_cover_radius
= _608zz_radius
;
21 _608zz_cap_footprint_radius
= 12 / 2;
24 weight_radius
= (weight
== "penny") ? penny_radius
: _608zz_radius
;
25 weight_thickness
= (weight
== "penny") ?
26 penny_thickness
* 5 : _608zz_thickness
;
28 bearing_radius
= (bearing
== "608zz") ? _608zz_radius
: 1/0;
29 bearing_inner_radius
= (bearing
== "608zz") ? _608zz_inner_radius
: 1/0;
30 bearing_cover_radius
= (bearing
== "608zz")
33 bearing_cap_footprint_radius
=
34 (bearing
== "608zz") ? _608zz_cap_footprint_radius
: 1/0;
35 bearing_thickness
= (bearing
== "608zz") ? _608zz_thickness
: 1/0;
37 spinner_height
= penny_thickness
* 5 + 2;
40 module
cap(bearing_inner_radius
,
41 bearing_cap_footprint_radius
,
44 footprint_height
= 1.6;
45 footprint_radius_safety
= 0.25;
47 bearing_cover_radius_safety
= 0.75;
48 bearing_thickness_safety
= 0.2;
52 cylinder(r1
= bearing_cover_radius
- tan(30) * cap_height
,
53 r2
= bearing_cover_radius
,
55 linear_extrude(height
= cap_height
+ footprint_height
) {
56 circle(bearing_cap_footprint_radius
- footprint_radius_safety
); }
57 linear_extrude(height
= cap_height
59 + bearing_thickness
/ 2
60 - bearing_thickness_safety
) {
61 circle(bearing_inner_radius
); } }
62 translate([0, 0, -0.01]) {
63 cylinder(r1
= bearing_inner_radius
+ tan(30) * (cap_height
- 1),
64 r2
= bearing_inner_radius
,
65 h
= cap_height
- 1); } } }
67 module
donut(height
, footprint_radius
) {
68 bread_radius
= height
/ 2;
70 translate([footprint_radius
, 0]) {
71 circle(bread_radius
); } } }
73 module
donut_hole(height
, footprint_radius
) {
75 cylinder(r
= footprint_radius
, h
= height
, center
= true);
76 donut(height
, footprint_radius
); } }
78 module
jelly_filled(height
, footprint_radius
) {
79 cylinder(r
= footprint_radius
, h
= height
, center
= true);
80 donut(height
, footprint_radius
); }
83 offset(r
= -r
) { offset(delta
= r
) { children(); } } }
85 module
mirrored(axis
) {
87 mirror(axis
) children(); }
89 module
spin_slice(weight_radius
,
94 joiner_radius
= (bearing_radius
+ weight_radius
) / 2;
97 // a = side along x axis
98 a
= bearing_radius
+ weight_radius
+ wall
;
99 // b = side from center to joiner
100 b
= bearing_radius
+ joiner_radius
+ round_extra
;
101 // c = side between joiner and arm center
102 c
= joiner_radius
+ weight_radius
+ round_extra
;
106 cos_C
= (pow(a
, 2) + pow(b
, 2) - pow(c
, 2)) / (2 * a
* b
);
107 sin_C
= sqrt(1 - pow(cos_C
, 2));
109 joiner_xy
= [cos_C
, sin_C
] * b
;
111 for(arm
= [0 : arms
- 1]) {
112 rotate(arm
* (360 / arms
)) {
115 translate(bearing_xy
) {
116 circle(bearing_radius
+ round_extra
); }
117 translate(weight_xy
) {
118 circle(weight_radius
+ round_extra
); }
120 polygon([bearing_xy
, weight_xy
, joiner_xy
]); } }
122 translate(joiner_xy
) {
123 circle(joiner_radius
); } } } } } }
125 module
spin_slices(weight_radius
,
129 weight_lip_overhang
= 0.3,
130 bearing_lip_overhang
= 0.3,
133 layer_height
= 0.15) {
134 thicker_thickness
= (bearing_thickness
> weight_thickness
) ?
135 bearing_thickness
: weight_thickness
;
136 calculated_height
= thicker_thickness
+ 2 * wall
;
137 layers
= 2 * ceil(ceil(calculated_height
/ layer_height
) / 2);
138 actual_height
= layers
* layer_height
;
139 round_radius
= actual_height
/ 2;
141 /* rounding the outside edge of the spinner with a semi-circle leads
142 to a shape that an overhang on the second layer several times the
143 thickness of a printed extrusion width.
145 rather than using a full semi-circle, this code aims to use just the
146 portion in the middle, where the overhang is less severe */
148 old_end
= (layers
/ 2) - 1;
150 /* add one to have some thickness all around weight holes
152 new_start
= old_end
/ 8 + 1;
155 old_range
= old_end
- old_start
;
156 new_range
= new_end
- new_start
;
158 factor
= new_range
/ old_range
;
160 /* initial adjacent is adjusted to (new start - 1) to allow some
161 thickness all around weight holes on first layer */
162 initial_adjacent
= round_radius
- ((new_start
- 1) * layer_height
);
163 initial_angle
= acos(initial_adjacent
/ round_radius
);
164 initial_round_extra
= initial_adjacent
* tan(initial_angle
);
167 mirrored([0, 0, 1]) {
168 for(layer
= [0 : (layers
/ 2) - 1]) {
169 translate([0, 0, layer
* layer_height
- actual_height
/ 2]) {
170 linear_extrude(height
= layer_height
) {
171 new_layer
= (layer
- old_start
) * factor
+ new_start
;
172 adjacent
= round_radius
- (new_layer
* layer_height
);
173 angle
= acos(adjacent
/ round_radius
);
174 round_extra
= adjacent
* tan(angle
) - initial_round_extra
;
175 spin_slice(weight_radius
,
180 cylinder(h
= actual_height
+ 0.1,
181 r
= bearing_radius
- bearing_lip_overhang
,
183 cylinder(h
= bearing_thickness
+ 0.1,
184 r
= bearing_radius
+ 0.1,
186 for(arm
= [0 : arms
- 1]) {
187 rotate(arm
* (360 / arms
)) {
188 translate([bearing_radius
+ wall
+ weight_radius
, 0]) {
189 cylinder(h
= actual_height
+ 0.1,
190 r
= weight_radius
- weight_lip_overhang
,
192 cylinder(h
= weight_thickness
+ 0.1,
193 r
= weight_radius
+ 0.1,
194 center
= true); } } } } }
197 This file is part of 3d-printables.
199 3d-printables is free software: you can redistribute it and/or modify
200 it under the terms of the GNU Affero General Public License as published by
201 the Free Software Foundation, either version 3 of the License, or
202 (at your option) any later version.
204 3d-printables is distributed in the hope that it will be useful,
205 but WITHOUT ANY WARRANTY; without even the implied warranty of
206 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
207 GNU Affero General Public License for more details.
209 You should have received a copy of the GNU Affero General Public License
210 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.