Repository navigation
Expand file tree
/
Copy pathspikes.scad
More file actions
368 lines (308 loc) · 9.98 KB
/
Copy pathspikes.scad
File metadata and controls
368 lines (308 loc) · 9.98 KB
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
/*
* Spikes on rafts, with selectable spike type:
*
* Cylindrical - Cylinder topped by point
* Pyramidal - Pyramid
*
* Holes around the border of the raft are optional, and can be used to connect rafts with rings.
* Magnet slots are optional, and are sized for 13mm x 6.5mm diametric magnets.
*
* To create spikes that are the same size and spacing as Christian Louboutin items:
*
* <*> SpikeSpaceX and SpikeSpaceY: 9.2 mm
* <*> SpikeType: Cylinder
* <*> CylSpikeRadius: 3 mm
* <*> CylSpikeCylHeight: 1.5 mm
* <*> CylSpikeTipHeight: 5.0 mm
*/
// Number of rafts
_RaftCount = 1;
// Space between rafts
_RaftSpaceX = 20;
// Raft height
_RaftHeight = 2.0; // [0 : 0.2 : 4.0]
// Border
_RaftBorder = 10;
// Holes in raft below spikes
_RaftHoles = false;
// Rows of spikes per raft
_SpikeCountY = 4;
// Columns of spikes per raft
_SpikeCountX = 4;
// Space between columns of spikes
_SpikeSpaceX = 10;
// Space between rows of spikes
_SpikeSpaceY = 10;
// Spike type
_SpikeType = "Cylinder"; // ["Cylinder", "Pyramid"]
/* [Cylindrical Spikes] */
// Spike radius
_CylSpikeRadius = 7;
// Spike cylinder height
_CylSpikeCylHeight = 7.1;
// Spike tip height
_CylSpikeTipHeight = 5.3;
// Spike wall thickness
_CylSpikeWall = 2;
/* [Pyramidal Spikes] */
// Spike base width/depth
_PyrBase = 14;
// Spike height
_PyrHeight = 35;
// Spike wall thickness
_PyrWall = 2;
/* [Border Holes] */
// Holes to connect borders
_BorderHoles = true;
// Hole diameter
_BorderHoleDiameter = 1;
// Hole inset from perimeter
_BorderHoleInset = 2.5;
// Hole inset from corner
_BorderCornerHoleInset = 5.0;
/* [Magnets] */
// Edge magnets
_EdgeMagnets = false;
// Magnet box height
_MagnetBoxHeight = 8.0;
// Magnet box depth
_MagnetBoxDepth = 8.0;
// Magnet slot inset from sides
_MagnetSlotInset = 2.0;
// Magnet slot length
_MagnetSlotLength = 13.0;
// Magnet slot height
_MagnetSlotHeight = 6.5;
module __end_customization() {}
/* Pyramid points */
PyrPoints =
[
[0, 0, 0],
[1, 0, 0],
[1, 1, 0],
[0, 1, 0],
[0.5, 0.5, 1]
];
/* Pyramid faces */
PyrFaces =
[
[0, 1, 2, 3],
[4, 1, 0],
[4, 2, 1],
[4, 3, 2],
[4, 0, 3]
];
// Render one spike (cylinder or pyramid)
module Spike(SpikeType, SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall, PyrBase, PyrHeight, PyrWall)
{
if (SpikeType == "Cylinder")
{
CylSpike(SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall);
}
else if (SpikeType == "Pyramid")
{
PyrSpike(PyrBase, PyrHeight, SpikeWall);
}
else
{
echo("Unknown spike type ", SpikeType);
}
}
// Render one cylinder spike
module CylSpike(SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall)
{
{
union()
{
// Cylinder
linear_extrude(SpikeCylHeight)
{
difference()
{
circle(SpikeRadius);
circle(SpikeRadius - SpikeWall);
}
}
// Spike
translate([0, 0, SpikeCylHeight])
{
linear_extrude(SpikeTipHeight, scale=0.1)
{
difference()
{
circle(SpikeRadius);
circle(SpikeRadius - SpikeWall);
}
}
}
}
}
}
// Render one pyramid spike
module PyrSpike(PyrBase, PyrHeight, PyrWall)
{
{
difference()
{
translate([-PyrBase/2, -PyrBase/2, 0])
scale([PyrBase, PyrBase, PyrHeight])
{
polyhedron(points=PyrPoints, faces=PyrFaces);
}
translate([-(PyrBase - PyrWall) / 2, -(PyrBase - PyrWall) / 2, 0])
{
scale([PyrBase - PyrWall, PyrBase - PyrWall, PyrHeight - PyrWall])
{
polyhedron(points=PyrPoints, faces=PyrFaces);
}
}
}
}
}
// Render one hole
module Hole(SpikeType, SpikeRadius, SpikeWall, PyrBase, PyrWall)
{
if (SpikeType == "Cylinder")
{
circle(SpikeRadius - SpikeWall);
}
else if (SpikeType == "Pyramid")
{
translate([-(PyrBase - PyrWall) / 2, -(PyrBase - PyrWall) / 2])
{
square([PyrBase - PyrWall, PyrBase - PyrWall]);
}
}
else
{
echo("Unknown spike type ", SpikeType);
}
}
function RaftSizeX(BorderX, CountX, SpikeSpaceX) = BorderX + ((CountX - 1) * SpikeSpaceX) + BorderX;
function RaftSizeY(BorderY, CountY, SpikeSpaceY) = BorderY + ((CountY - 1) * SpikeSpaceY) + BorderY;
// Render a raft with a grid of spikes
module Raft(CountX, CountY, SpikeSpaceX, SpikeSpaceY, BorderX, BorderY, RaftHeight, RaftHoles, SpikeType, SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall,
PyrBase, PyrHeight, PyrWall)
{
// Compute size of raft
RaftX = RaftSizeX(BorderX, CountX, SpikeSpaceX);
RaftY = RaftSizeY(BorderY, CountY, SpikeSpaceY);
// Raft with holes cut out for spikes
difference()
{
cube([RaftX, RaftY, RaftHeight]);
if (RaftHoles)
{
for (x = [0 : CountX -1])
{
for (y = [0 : CountY - 1])
{
SpikeX = BorderX + (x * SpikeSpaceX);
SpikeY = BorderY + (y * SpikeSpaceY);
translate([SpikeX, SpikeY, 0])
{
linear_extrude(RaftHeight)
{
Hole(SpikeType, SpikeRadius, SpikeWall, PyrBase, PyrWall);
}
}
}
}
}
}
// Grid of spikes
for (x = [0 : CountX -1])
{
for (y = [0 : CountY - 1])
{
SpikeX = BorderX + (x * SpikeSpaceX);
SpikeY = BorderY + (y * SpikeSpaceY);
translate([SpikeX, SpikeY, RaftHeight])
{
Spike(SpikeType, SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall, PyrBase, PyrHeight, PyrWall);
}
}
}
}
// Render edge holes (intended to be used as antimatter)
module Holes(CountX, CountY, SpikeSpaceX, SpikeSpaceY, RaftHeight, BorderX, BorderY, BorderHoles, BorderHoleDiameter, BorderHoleInset,BorderCornerHoleInset)
{
// Compute size of raft
RaftX = RaftSizeX(BorderX, CountX, SpikeSpaceX);
RaftY = RaftSizeY(BorderY, CountY, SpikeSpaceY);
// Drill holes - bottom left
translate([BorderCornerHoleInset, BorderHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
translate([BorderHoleInset, BorderCornerHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
// Drill holes - top left
translate([BorderCornerHoleInset, RaftY - BorderHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
translate([BorderHoleInset, RaftY - BorderCornerHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
// Drill holes - bottom left
translate([RaftX - BorderCornerHoleInset, BorderHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
translate([RaftX - BorderHoleInset, BorderCornerHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
// Drill holes - top right
translate([RaftX - BorderCornerHoleInset, RaftY - BorderHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
translate([RaftX - BorderHoleInset, RaftY - BorderCornerHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
// Drill holes - bottom and top edges
translate([RaftX / 2, BorderHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
translate([RaftX / 2, RaftY - BorderHoleInset, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
// Drill holes - left and right edges
translate([BorderHoleInset, RaftY / 2, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
translate([RaftX - BorderHoleInset, RaftY / 2, 0]) cylinder(99, d=BorderHoleDiameter, $fn=99);
}
// Render a raft, with optional edge holes
module FullRaft(CountX, CountY, SpikeSpaceX, SpikeSpaceY, BorderX, BorderY, RaftHeight, RaftHoles, SpikeType, SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall, PyrBase, PyrHeight, PyrWall, BorderHoles, BorderHoleDiameter, BorderHoleInset, BorderCornerHoleInset)
{
if (BorderHoles)
{
difference()
{
// Matter
Raft(CountX, CountY, SpikeSpaceX, SpikeSpaceY, BorderX, BorderY, RaftHeight, RaftHoles, SpikeType, SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall, PyrBase, PyrHeight, PyrWall);
// Antimatter
Holes(CountX, CountY, SpikeSpaceX, SpikeSpaceY, RaftHeight, BorderX, BorderY, BorderHoles, BorderHoleDiameter, BorderHoleInset,_BorderCornerHoleInset);
}
}
else
{
Raft(CountX, CountY, SpikeSpaceX, SpikeSpaceY, BorderX, BorderY, RaftHeight, RaftHoles, SpikeType, SpikeRadius, SpikeCylHeight, SpikeTipHeight, SpikeWall, PyrBase, PyrHeight, PyrWall);
}
}
// Render magnet holes
module MagnetHoles(RaftHeight, BoxX, BoxY, BoxZ, SlotInset, SlotLength, SlotHeight)
{
translate([SlotInset, (BoxY - SlotHeight) / 2, RaftHeight]) cube([SlotLength, SlotHeight, SlotHeight]);
translate([BoxX - SlotInset - SlotLength, (BoxY - SlotHeight) / 2, RaftHeight]) cube([SlotLength, SlotHeight, SlotHeight]);
}
// Render a box that holds magnets
module EdgeMagnetBox(RaftHeight, BoxX, BoxY, BoxZ, SlotInset, SlotLength, SlotHeight)
{
difference()
{
// Matter
cube([BoxX, BoxY, BoxZ]);
// Anti-matter
MagnetHoles(RaftHeight, BoxX, BoxY, BoxZ, SlotInset, SlotLength, SlotHeight);
}
}
// Render all of the rafts
for (r = [0 : _RaftCount - 1])
{
RaftX = r * RaftSizeX(_RaftBorder, _SpikeCountX, _SpikeSpaceX) + (r * _RaftSpaceX);
RaftY = 0;
translate([RaftX, RaftY, 0])
{
FullRaft(_SpikeCountX, _SpikeCountY, _SpikeSpaceX, _SpikeSpaceY,
_RaftBorder, _RaftBorder, _RaftHeight, _RaftHoles,
_SpikeType, _CylSpikeRadius, _CylSpikeCylHeight, _CylSpikeTipHeight, _CylSpikeWall,
_PyrBase, _PyrHeight, _PyrWall, _BorderHoles, _BorderHoleDiameter, _BorderHoleInset, _BorderCornerHoleInset);
if (_EdgeMagnets)
{
SizeX = RaftSizeX(_RaftBorder, _SpikeCountX, _SpikeSpaceX);
SizeY = RaftSizeY(_RaftBorder, _SpikeCountY, _SpikeSpaceY);
translate([0, SizeY, 0])
{
EdgeMagnetBox(_RaftHeight, SizeX, _RaftHeight + _MagnetBoxHeight, _MagnetBoxDepth, _MagnetSlotInset, _MagnetSlotLength, _MagnetSlotHeight);
}
}
}
}