1 /* GNU AGPLv3 (or later at your option)
2 see bottom for more license info */
4 /* spin thing that erin likes */
10 weight_lip_thickness
= 1;
12 penny_thickness
= 1.52;
13 spinner_height
= penny_thickness
* 5 + 2;
16 penny_radius
= 19.05 / 2;
17 weight_radius
= (weight
== "penny") ? penny_radius
: _608zz_radius
;
18 weight_thickness
= (weight
== "penny") ?
19 penny_thickness
* 5 : _608zz_thickness
;
20 bearing_radius
= (bearing
== "608zz") ? _608zz_radius
: 1/0;
21 bearing_thickness
= (bearing
== "608zz") ? _608zz_thickness
: 1/0;
24 module
ring(outer_radius
, inner_radius
) {
27 circle(inner_radius
); } }
29 module
spin_2d(weight_radius
,
33 bearing_holder_radius
= bearing_radius
+ wall_thickness
;
34 weight_holder_radius
= weight_radius
+ wall_thickness
;
36 ring(bearing_holder_radius
, bearing_radius
);
39 * imagine a triangle with one point at the origin, at the
40 * center of the spinning bearing holder, one point in the middle of
41 * the weight holder, and one point at the center of a circle tangent
42 * to the first two, called the joiner circle.
43 * the radius of the joiner circle is the arithmetic average of the
44 * weight holder and bearing holder.
46 joiner_radius
= (bearing_holder_radius
+ weight_holder_radius
) / 2;
47 /* a: goes between the center of the weight holder and the center of
49 a
= joiner_radius
+ weight_holder_radius
;
50 /* b: length of the base, which goes along the x-axis between
51 the origin and the center of the weight holder. */
52 b
= weight_holder_radius
+ bearing_holder_radius
;
53 /* c: goes between origin and joiner circle. */
54 c
= bearing_holder_radius
+ joiner_radius
;
56 /* A: angle at the origin, between the base and segment from origin
57 to center of joiner circle.
58 it is calculated using law of cosines, given the lengths of
59 all 3 sides of the triangle. */
60 A
= acos((pow(b
, 2) + pow(c
, 2) - pow(a
, 2)) / (2 * b
* c
));
61 /* find the center of the joiner circle */
62 joiner_x
= cos(A
) * c
;
63 joiner_y
= sin(A
) * c
;
65 /* find the points where the circles meet */
66 bearing_joiner_point
= [cos(A
) * bearing_holder_radius
,
67 sin(A
) * bearing_holder_radius
];
68 bearing_weight_point
= [bearing_holder_radius
, 0];
69 /* C: angle between x-axis and line-segment between center of weight
70 holder and center of joiner.
71 it is calculated using law of cosines, given the lengths of
72 all 3 sides of the triangle. */
73 C
= acos((pow(a
, 2) + pow(b
, 2) - pow(c
, 2)) / (2 * a
* b
));
74 weight_joiner_point
= [b
- cos(C
) * weight_holder_radius
,
75 sin(C
) * weight_holder_radius
];
76 for(arm
= [0 : arms
- 1]) {
77 rotate(arm
* 360.0 / arms
) {
79 polygon([bearing_weight_point
,
81 weight_joiner_point
]);
82 translate([joiner_x
, joiner_y
]) {
83 circle(joiner_radius
); }
84 translate([weight_holder_radius
+ bearing_holder_radius
, 0]) {
85 circle(weight_holder_radius
); } }
86 mirror(v
= [0, 1, 0]) {
88 polygon([bearing_weight_point
,
90 weight_joiner_point
]);
91 translate([joiner_x
, joiner_y
]) {
92 circle(joiner_radius
); }
93 translate([weight_holder_radius
+ bearing_holder_radius
, 0]) {
94 circle(weight_holder_radius
); } } }
95 translate([weight_holder_radius
+ bearing_holder_radius
, 0]) {
96 ring(weight_holder_radius
, weight_radius
); } } } }
98 module
spin(weight_radius
,
100 weight_lip_thickness
,
106 /* TODO: make window size parameter */
107 /* TODO: rethink how lips are done */
108 /* TODO: right now, weight is assumed to be thicker than bearing*/
109 bearing_lip_thickness
= (spinner_height
- bearing_thickness
) / 2;
110 linear_extrude(height
= weight_lip_thickness
) {
111 spin_2d(weight_radius
- 1,
114 bearing_radius
- 1); }
115 linear_extrude(height
= bearing_lip_thickness
) {
116 ring(bearing_radius
, bearing_radius
- 1); }
117 linear_extrude(height
= spinner_height
) {
118 spin_2d(weight_radius
, arms
, wall_thickness
, bearing_radius
); }
119 translate([0, 0, spinner_height
- bearing_lip_thickness
]) {
120 linear_extrude(height
= bearing_lip_thickness
) {
121 ring(bearing_radius
, bearing_radius
- 1); } }
122 translate([0, 0, spinner_height
- weight_lip_thickness
]) {
123 linear_extrude(height
= weight_lip_thickness
) {
124 spin_2d(weight_radius
- 1,
127 bearing_radius
- 1); } } }
130 This file is part of 3d-printables.
132 3d-printables is free software: you can redistribute it and/or modify
133 it under the terms of the GNU Affero General Public License as published by
134 the Free Software Foundation, either version 3 of the License, or
135 (at your option) any later version.
137 3d-printables is distributed in the hope that it will be useful,
138 but WITHOUT ANY WARRANTY; without even the implied warranty of
139 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140 GNU Affero General Public License for more details.
142 You should have received a copy of the GNU Affero General Public License
143 along with challenge-bot. If not, see <http://www.gnu.org/licenses/>.