-
Notifications
You must be signed in to change notification settings - Fork 2
/
talons.scad
238 lines (189 loc) · 4.29 KB
/
talons.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
// Talons - grid or ring layout
// Layout
_Layout = "Grid"; // [Grid, Ring]
/* [Base] */
// Solid base
_SolidBase = true;
// Base thickness
_BaseThickness = 3;
// Base border
_BaseBorder = 2;
// Ring base outer radius
_RingBaseOuterRadius = 40;
// Ring base inner radis
_RingBaseInnerRadius = 30;
/* [Talon] */
// Talon radius
_TalonRadius = 30;
// Talon thickness
_TalonThickness = 6;
// Talon front/back offset
_TalonOffset = 6;
// Talon XY rotation
_TalonRotation = 0;
/* [Grid] */
// X spacing
_SpaceX = 8;
// Y spacing
_SpaceY = 8;
// X count
_CountX = 4;
// Y count
_CountY = 4;
/* [Main Ring] */
// Radius of first ring
_MainFirstRingRadius = 4;
// Step between rings
_MainRingRadiusStep = 10;
// Number of rings
_MainRingCount = 4;
// Talons per ring
_MainRingTalonCount = 8;
/* [Fill Ring] */
// Radius of first ring
_FillFirstRingRadius = 14;
// Step between rings
_FillRingRadiusStep = 10;
// Number of rings
_FillRingCount = 3;
// Talons per ring
_FillRingTalonCount = 8;
// Rotation
_FillRingRotate = 22.5;
module __end_cust() {};
//
// Render a Talon
//
module Talon(Radius, Thickness, Offset)
{
color("blue")
{
intersection()
{
// Half-moon Talon
translate([0, Radius, 0])
{
rotate([90, 0, 90])
{
linear_extrude(Thickness)
{
difference()
{
circle(Radius);
translate([Offset, 0, 0])
{
circle(Radius);
}
}
}
}
}
// Box above Z = 0
cube([Thickness, Radius - Offset, Radius]);
}
}
}
//
// Render a grid of talons
//
module TalonGrid(CountX, CountY, SpaceX, SpaceY, TalonRadius, TalonThickness, TalonOffset)
{
for (X = [0 : 1 : CountX - 1])
{
for (Y = [0 : 1 : CountY - 1])
{
OddY = (Y % 2) == 1;
PointX = OddY ? (X * SpaceX) + SpaceX / 2 : (X * SpaceX);
PointY = Y * SpaceY;
translate([PointX, PointY, 0])
{
Talon(TalonRadius, TalonThickness, TalonOffset);
}
}
}
}
//
// Render a ring of talons
//
// TODO:
// Add stepping up or down of size
module TalonRing(FirstRingRadius, RingRadiusStep, RingRadiusCount, TalonCount, TalonRadius, TalonThickness, TalonOffset, TalonRotation)
{
Theta = 360 / TalonCount;
// Each ring
if (RingRadiusCount > 0 && TalonCount > 0)
{
for (r = [0 : RingRadiusCount - 1])
{
// Each talon
for (t = [0 : TalonCount - 1])
{
PointX = (FirstRingRadius + (r * RingRadiusStep)) * cos(t * Theta);
PointY = (FirstRingRadius + (r * RingRadiusStep)) * sin(t * Theta);
translate([PointX, PointY, 0])
{
rotate([0, 0, 270 + (t * Theta) + TalonRotation])
{
// Translate so talons are centered on ray
translate([-TalonThickness / 2, 0, 0])
{
Talon(TalonRadius, TalonThickness, TalonOffset);
}
}
}
}
}
}
}
module main()
{
Z_Up = _SolidBase ? _BaseThickness : 0;
translate([0, 0, Z_Up])
{
if (_Layout == "Grid")
{
translate([2, 2, 0])
{
TalonGrid(_CountX, _CountY, _SpaceX, _SpaceY, _TalonRadius, _TalonThickness, _TalonOffset);
}
}
if (_Layout == "Ring")
{
// TODO:
// translate to center
// Compute size of base
// Main ring
color("red")
{
TalonRing(_MainFirstRingRadius, _MainRingRadiusStep, _MainRingCount, _MainRingTalonCount, _TalonRadius, _TalonThickness, _TalonOffset, _TalonRotation);
}
// Fill ring
color("blue")
{
rotate([0, 0, _FillRingRotate])
{
TalonRing(_FillFirstRingRadius, _FillRingRadiusStep, _FillRingCount, _FillRingTalonCount, _TalonRadius, _TalonThickness, _TalonOffset, _TalonRotation);
}
}
}
}
if (_SolidBase && _Layout == "Grid")
{
CubeWidth = _BaseBorder + (_CountX * _SpaceX) + (_TalonThickness / 2) + _BaseBorder;
CubeDepth = _BaseBorder + (_CountY * _SpaceY) + _BaseBorder;
cube([CubeWidth, CubeDepth, _BaseThickness]);
}
if (_SolidBase && _Layout == "Ring")
{
translate([0, 0, Z_Up / 2])
{
difference()
{
// Matter
cylinder(Z_Up, r=_RingBaseOuterRadius, center=true);
// Anti-matter
cylinder(Z_Up + .001, r=_RingBaseInnerRadius, center=true); }
}
}
}
main();