-
Notifications
You must be signed in to change notification settings - Fork 0
/
coil-form.scad
131 lines (113 loc) · 4.22 KB
/
coil-form.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
/* Parametric Coil Form
*
* Copyright (c) 2017 Henrik Brix Andersen <[email protected]>
* License: CC BY-SA
*/
// Rendering
$fn = 100;
module coil_comb_2d(outer_d, inner_d, shaft_d, slot_w, wire_d, slots, slot, turns, length, cutouts) {
height = (outer_d - inner_d) / 2;
coil_length = length - slot_w * 2;
turn_spacing = (coil_length - (turns * wire_d)) / turns;
difference() {
// Main outline
hull() {
for (i = [-1,1]) {
translate([(length / 2 + slot_w) * i, height + 1.5 * wire_d - slot_w * 2, 0]) {
circle(slot_w * 2);
}
}
translate([0, -1 * (inner_d - shaft_d) / 2 + 0.5, 0]) {
square(size = [length + slot_w * 6, 1], center = true);
}
}
// Shaft cutout
translate([0, -1 * (inner_d - shaft_d) / 2, 0]) {
#square(size = [length, inner_d - shaft_d], center = true);
}
// Wire cutouts
for (i = [0:turns - 1]) {
offset = turn_spacing / slots * slot;
translate([coil_length / -2 + wire_d / 2 + i * (turn_spacing + wire_d) + offset, height, 0]) {
#circle(d = wire_d);
}
translate([coil_length / -2 + i * (turn_spacing + wire_d) + offset, height, 0]) {
#square(size = [wire_d, wire_d * 3], center = false);
}
}
// Slot cutouts
for (i = [-1,1]) {
translate([length / 2 * i + i * slot_w / 2, 0, 0]) {
#square(size = [slot_w, height], center = true);
}
}
// Wind load reduction cutouts
if (cutouts > 0) {
spacing = (length - (cutouts * (height / 3 * 2))) / (cutouts + 1);
for (i = [0:cutouts - 1]) {
translate([length / -2 + (height / 3 * 2 * i + height / 3) + spacing * (i + 1), height / 2, 0]) {
#circle(height / 3);
}
}
}
}
}
module coil_comb_3d(outer_d, inner_d, shaft_d, slot_w, wire_d, slots, slot, turns, length, cutouts, thickness) {
linear_extrude(height = thickness, center = true, convexity = 10, twist = 0) {
coil_comb_2d(outer_d, inner_d, shaft_d, slot_w, wire_d, slots, slot, turns, length, cutouts);
}
}
module coil_retainer_2d(outer_d, inner_d, shaft_d, slot_w, wire_d, slots, dshape_h) {
slot_depth = (outer_d - inner_d) / 4;
difference() {
// Disc outline
circle(d=outer_d + 3 * wire_d);
// Centre hole
difference() {
#circle(d=shaft_d);
translate([0, (shaft_d / -2), 0]) {
#square(size = [shaft_d, dshape_h * 2], center = true);
}
}
// Wire hole
rotate([0, 0, 360 / slots / 2]) {
translate([0, shaft_d / 2 + (outer_d - shaft_d) / 4, 0]) {
#circle(d = wire_d);
}
}
// Slot cutouts
for (i = [1:slots]) {
rotate([0, 0, i * 360 / slots]) {
translate([0, outer_d / 2, 0]) {
#square(size = [slot_w, slot_depth * 2], center = true);
}
}
}
}
}
module coil_retainer_3d(outer_d, inner_d, shaft_d, slot_w, wire_d, slots, dshape_h, thickness) {
linear_extrude(height = thickness, center = true, convexity = 10, twist = 0) {
coil_retainer_2d(outer_d, inner_d, shaft_d, slot_w, wire_d, slots, dshape_h);
}
}
od = 50; // Outer coil diameter
id = 25; // Inner diameter
sd = 23; // Shaft diameter
ds = 1; // Shaft d-shape cut off depth
st = 3; // Sheet thickness
wd = 1; // Wire diameter
ct = 20; // Coil turns
ns = 6; // Number of slots
tl = 120; // Length between coil retainers
co = 0; // Number of wind load reduction cutouts
wire_length = od * PI * ct;
echo(wire_length=wire_length,"mm");
for (i = [0:5]) {
my_sd = (i == 0) ? (sd - ds) : sd;
translate([0, i * (od / 2 - my_sd / 2 + 3 * wd), 0]) {
coil_comb_2d(od, id, my_sd, st, wd, ns, i, ct, tl, co);
}
}
//coil_comb_3d(od, id, sd, st, wd, ns, 0, ct, tl, co, st);
//coil_retainer_2d(od, id, sd, st, wd, ns, ds);
//coil_retainer_3d(od, id, sd, st, wd, ns, ds, st);