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_window_radius
= bearing_radius
- bearing_lip_overhang
- 1;
30 bearing_inner_radius
= (bearing
== "608zz") ? _608zz_inner_radius
: 1/0;
31 bearing_cover_radius
= (bearing
== "608zz")
34 bearing_cap_footprint_radius
=
35 (bearing
== "608zz") ? _608zz_cap_footprint_radius
: 1/0;
36 bearing_thickness
= (bearing
== "608zz") ? _608zz_thickness
: 1/0;
38 spinner_height
= penny_thickness
* 5 + 2;
41 module
cap(bearing_inner_radius
,
42 bearing_cap_footprint_radius
,
45 bearing_window_radius
) {
46 footprint_height
= 4.5;
47 footprint_radius_safety
= 0.2;
49 bearing_thickness_safety
= 0.6;
50 finger_spot_height
= cap_height
/ 10;
54 cylinder(r1
= bearing_cover_radius
- tan(30) * cap_height
,
55 r2
= bearing_cover_radius
,
57 linear_extrude(height
= cap_height
60 circle(bearing_window_radius
- 1); }
61 linear_extrude(height
= cap_height
+ footprint_height
) {
62 circle(bearing_cap_footprint_radius
- footprint_radius_safety
); }
63 linear_extrude(height
= cap_height
65 + bearing_thickness
/ 2
66 - bearing_thickness_safety
) {
67 circle(bearing_inner_radius
); }
69 translate([0, 0, -0.01]) {
70 cylinder(r1
= bearing_inner_radius
,
71 r2
= bearing_inner_radius
- tan(30) * finger_spot_height
,
72 h
= finger_spot_height
); } } }
74 module
donut(height
, footprint_radius
) {
75 bread_radius
= height
/ 2;
77 translate([footprint_radius
, 0]) {
78 circle(bread_radius
); } } }
80 module
donut_hole(height
, footprint_radius
) {
82 cylinder(r
= footprint_radius
, h
= height
, center
= true);
83 donut(height
, footprint_radius
); } }
85 module
jelly_filled(height
, footprint_radius
) {
86 cylinder(r
= footprint_radius
, h
= height
, center
= true);
87 donut(height
, footprint_radius
); }
90 offset(r
= -r
) { offset(delta
= r
) { children(); } } }
92 module
mirrored(axis
) {
94 mirror(axis
) children(); }
96 module
spin_slice(weight_radius
,
101 joiner_radius
= (bearing_radius
+ weight_radius
) / 2;
104 // a = side along x axis
105 a
= bearing_radius
+ weight_radius
+ wall
;
106 // b = side from center to joiner
107 b
= bearing_radius
+ joiner_radius
+ round_extra
;
108 // c = side between joiner and arm center
109 c
= joiner_radius
+ weight_radius
+ round_extra
;
113 cos_C
= (pow(a
, 2) + pow(b
, 2) - pow(c
, 2)) / (2 * a
* b
);
114 sin_C
= sqrt(1 - pow(cos_C
, 2));
116 joiner_xy
= [cos_C
, sin_C
] * b
;
118 for(arm
= [0 : arms
- 1]) {
119 rotate(arm
* (360 / arms
)) {
122 translate(bearing_xy
) {
123 circle(bearing_radius
+ round_extra
); }
124 translate(weight_xy
) {
125 circle(weight_radius
+ round_extra
); }
127 polygon([bearing_xy
, weight_xy
, joiner_xy
]); } }
129 translate(joiner_xy
) {
130 circle(joiner_radius
); } } } } } }
132 module
spin_slices(weight_radius
,
136 weight_lip_overhang
= 0.3,
137 bearing_lip_overhang
= 0.3,
140 layer_height
= 0.15) {
141 thicker_thickness
= (bearing_thickness
> weight_thickness
) ?
142 bearing_thickness
: weight_thickness
;
143 calculated_height
= thicker_thickness
+ 2 * wall
;
144 layers
= 2 * ceil(ceil(calculated_height
/ layer_height
) / 2);
145 actual_height
= layers
* layer_height
;
146 round_radius
= actual_height
/ 2;
148 /* rounding the outside edge of the spinner with a semi-circle leads
149 to a shape that an overhang on the second layer several times the
150 thickness of a printed extrusion width.
152 rather than using a full semi-circle, this code aims to use just the
153 portion in the middle, where the overhang is less severe */
155 old_end
= (layers
/ 2) - 1;
157 /* add one to have some thickness all around weight holes
159 new_start
= old_end
/ 8 + 1;
162 old_range
= old_end
- old_start
;
163 new_range
= new_end
- new_start
;
165 factor
= new_range
/ old_range
;
167 /* initial adjacent is adjusted to (new start - 1) to allow some
168 thickness all around weight holes on first layer */
169 initial_adjacent
= round_radius
- ((new_start
- 1) * layer_height
);
170 initial_angle
= acos(initial_adjacent
/ round_radius
);
171 initial_round_extra
= initial_adjacent
* tan(initial_angle
);
174 mirrored([0, 0, 1]) {
175 for(layer
= [0 : (layers
/ 2) - 1]) {
176 translate([0, 0, layer
* layer_height
- actual_height
/ 2]) {
177 linear_extrude(height
= layer_height
) {
178 new_layer
= (layer
- old_start
) * factor
+ new_start
;
179 adjacent
= round_radius
- (new_layer
* layer_height
);
180 angle
= acos(adjacent
/ round_radius
);
181 round_extra
= adjacent
* tan(angle
) - initial_round_extra
;
182 spin_slice(weight_radius
,
187 cylinder(h
= actual_height
+ 0.1,
188 r
= bearing_radius
- bearing_lip_overhang
,
190 cylinder(h
= bearing_thickness
+ 0.1,
191 r
= bearing_radius
+ 0.1,
193 for(arm
= [0 : arms
- 1]) {
194 rotate(arm
* (360 / arms
)) {
195 translate([bearing_radius
+ wall
+ weight_radius
, 0]) {
196 cylinder(h
= actual_height
+ 0.1,
197 r
= weight_radius
- weight_lip_overhang
,
199 cylinder(h
= weight_thickness
+ 0.1,
200 r
= weight_radius
+ 0.1,
201 center
= true); } } } } }
204 This file is part of 3d-printables.
206 3d-printables is free software: you can redistribute it and/or modify
207 it under the terms of the GNU Affero General Public License as published by
208 the Free Software Foundation, either version 3 of the License, or
209 (at your option) any later version.
211 3d-printables is distributed in the hope that it will be useful,
212 but WITHOUT ANY WARRANTY; without even the implied warranty of
213 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
214 GNU Affero General Public License for more details.
216 You should have received a copy of the GNU Affero General Public License
217 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.