forked from MGX3D/pegstr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pegstr.scad
401 lines (319 loc) · 10.2 KB
/
pegstr.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
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
// PEGSTR - Pegboard Wizard
// Design by Marius Gheorghescu, November 2014
// Update log:
// November 9th 2014
// - first coomplete version. Angled holders are often odd/incorrect.
// November 15th 2014
// - minor tweaks to increase rendering speed. added logo.
// November 28th 2014
// - bug fixes
// preview[view:north, tilt:bottom diagonal]
// width of the orifice
holder_x_size = 10;
// depth of the orifice
holder_y_size = 10;
// hight of the holder
holder_height = 15;
// how thick are the walls. Hint: 6*extrusion width produces the best results.
wall_thickness = 1.85;
// how many times to repeat the holder on X axis
holder_x_count = 1;
// how many times to repeat the holder on Y axis
holder_y_count = 2;
// orifice corner radius (roundness). Needs to be less than min(x,y)/2.
corner_radius = 30;
// Use values less than 1.0 to make the bottom of the holder narrow
taper_ratio = 1.0;
/* [Advanced] */
// offset from the peg board, typically 0 unless you have an object that needs clearance
holder_offset = 0.0;
// what ratio of the holders bottom is reinforced to the plate [0.0-1.0]
strength_factor = 0.66;
// for bins: what ratio of wall thickness to use for closing the bottom
closed_bottom = 0.0;
// what percentage cu cut in the front (example to slip in a cable or make the tool snap from the side)
holder_cutout_side = 0.0;
// set an angle for the holder to prevent object from sliding or to view it better from the top
holder_angle = 0.0;
/* [Hidden] */
// what is the $fn parameter
holder_sides = max(50, min(20, holder_x_size*2));
// dimensions the same outside US?
hole_spacing = 25.4;
hole_size = 6;//6.0035;
board_thickness = 5;
holder_total_x = wall_thickness + holder_x_count*(wall_thickness+holder_x_size);
holder_total_y = wall_thickness + holder_y_count*(wall_thickness+holder_y_size);
holder_total_z = round(holder_height/hole_spacing)*hole_spacing;
holder_roundness = min(corner_radius, holder_x_size/2, holder_y_size/2);
// what is the $fn parameter for holders
fn = 32;
epsilon = 0.1;
clip_height = 2*hole_size + 2;
$fn = fn;
module round_rect_ex(x1, y1, x2, y2, z, r1, r2)
{
$fn=holder_sides;
brim = z/10;
//rotate([0,0,(holder_sides==6)?30:((holder_sides==4)?45:0)])
hull() {
translate([-x1/2 + r1, y1/2 - r1, z/2-brim/2])
cylinder(r=r1, h=brim,center=true);
translate([x1/2 - r1, y1/2 - r1, z/2-brim/2])
cylinder(r=r1, h=brim,center=true);
translate([-x1/2 + r1, -y1/2 + r1, z/2-brim/2])
cylinder(r=r1, h=brim,center=true);
translate([x1/2 - r1, -y1/2 + r1, z/2-brim/2])
cylinder(r=r1, h=brim,center=true);
translate([-x2/2 + r2, y2/2 - r2, -z/2+brim/2])
cylinder(r=r2, h=brim,center=true);
translate([x2/2 - r2, y2/2 - r2, -z/2+brim/2])
cylinder(r=r2, h=brim,center=true);
translate([-x2/2 + r2, -y2/2 + r2, -z/2+brim/2])
cylinder(r=r2, h=brim,center=true);
translate([x2/2 - r2, -y2/2 + r2, -z/2+brim/2])
cylinder(r=r2, h=brim,center=true);
}
}
module old_pin(clip)
{
rotate([0,0,15])
cylinder(r=hole_size/2, h=board_thickness*1.5+epsilon, center=true, $fn=12);
if (clip) {
//
rotate([0,0,90])
intersection() {
translate([0, 0, hole_size-epsilon])
cube([hole_size+2*epsilon, clip_height, 2*hole_size], center=true);
// [-hole_size/2 - 1.95,0, board_thickness/2]
translate([0, hole_size/2 + 2, board_thickness/2])
rotate([0, 90, 0])
rotate_extrude(convexity = 5, $fn=20)
translate([5, 0, 0])
circle(r = (hole_size*0.95)/2);
translate([0, hole_size/2 + 2 - 1.6, board_thickness/2])
rotate([45,0,0])
translate([0, -0, hole_size*0.6])
cube([hole_size+2*epsilon, 3*hole_size, hole_size], center=true);
}
}
}
module pin(clip)
{
rotate([0,0,15])
#cylinder(r=hole_size/2, h=board_thickness*1.5+epsilon, center=true, $fn=12);
if (clip) {
//
rotate([0,0,90])
intersection() {
translate([0, 0, hole_size-epsilon])
cube([hole_size+2*epsilon, clip_height, 2*hole_size], center=true);
// [-hole_size/2 - 1.95,0, board_thickness/2]
translate([0, hole_size/2 + 2, board_thickness/2])
rotate([0, 90, 0])
rotate_extrude(convexity = 5, $fn=20)
translate([5, 0, 0])
circle(r = (hole_size*0.95)/2);
translate([0, hole_size/2 + 2 - 1.6, board_thickness/2])
rotate([45,0,0])
translate([0, -0, hole_size*0.6])
cube([hole_size+2*epsilon, 3*hole_size, hole_size], center=true);
}
}
}
module pinboard_clips()
{
rotate([0,90,0])
for(i=[0:round(holder_total_x/hole_spacing)]) {
for(j=[0:max(strength_factor, round(holder_height/hole_spacing))]) {
translate([
j*hole_spacing,
-hole_spacing*(round(holder_total_x/hole_spacing)/2) + i*hole_spacing,
0])
pin(j==0);
}
}
}
module pinboard(clips)
{
rotate([0,90,0])
translate([-epsilon, 0, -wall_thickness - board_thickness/2 + epsilon])
hull() {
translate([-clip_height/2 + hole_size/2,
-hole_spacing*(round(holder_total_x/hole_spacing)/2),0])
cylinder(r=hole_size/2, h=wall_thickness);
translate([-clip_height/2 + hole_size/2,
hole_spacing*(round(holder_total_x/hole_spacing)/2),0])
cylinder(r=hole_size/2, h=wall_thickness);
translate([max(strength_factor, round(holder_height/hole_spacing))*hole_spacing,
-hole_spacing*(round(holder_total_x/hole_spacing)/2),0])
cylinder(r=hole_size/2, h=wall_thickness);
translate([max(strength_factor, round(holder_height/hole_spacing))*hole_spacing,
hole_spacing*(round(holder_total_x/hole_spacing)/2),0])
cylinder(r=hole_size/2, h=wall_thickness);
}
}
module holder(negative)
{
for(x=[1:holder_x_count]){
for(y=[1:holder_y_count])
/* render(convexity=2)*/ {
translate([
-holder_total_y /*- (holder_y_size+wall_thickness)/2*/ + y*(holder_y_size+wall_thickness) + wall_thickness,
-holder_total_x/2 + (holder_x_size+wall_thickness)/2 + (x-1)*(holder_x_size+wall_thickness) + wall_thickness/2,
0])
{
rotate([0, holder_angle, 0])
translate([
-wall_thickness*abs(sin(holder_angle))-0*abs((holder_y_size/2)*sin(holder_angle))-holder_offset-(holder_y_size + 2*wall_thickness)/2 - board_thickness/2,
0,
-(holder_height/2)*sin(holder_angle) - holder_height/2 + clip_height/2
])
difference() {
if (!negative)
round_rect_ex(
(holder_y_size + 2*wall_thickness),
holder_x_size + 2*wall_thickness,
(holder_y_size + 2*wall_thickness)*taper_ratio,
(holder_x_size + 2*wall_thickness)*taper_ratio,
holder_height,
holder_roundness + epsilon,
holder_roundness*taper_ratio + epsilon);
translate([0,0,closed_bottom*wall_thickness])
if (negative>1) {
round_rect_ex(
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
3*max(holder_height, hole_spacing),
holder_roundness*taper_ratio + epsilon,
holder_roundness*taper_ratio + epsilon);
} else {
round_rect_ex(
holder_y_size,
holder_x_size,
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
holder_height+2*epsilon,
holder_roundness + epsilon,
holder_roundness*taper_ratio + epsilon);
}
if (!negative)
if (holder_cutout_side > 0) {
if (negative>1) {
hull() {
scale([1.0, holder_cutout_side, 1.0])
round_rect_ex(
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
3*max(holder_height, hole_spacing),
holder_roundness*taper_ratio + epsilon,
holder_roundness*taper_ratio + epsilon);
translate([0-(holder_y_size + 2*wall_thickness), 0,0])
scale([1.0, holder_cutout_side, 1.0])
round_rect_ex(
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
3*max(holder_height, hole_spacing),
holder_roundness*taper_ratio + epsilon,
holder_roundness*taper_ratio + epsilon);
}
} else {
hull() {
scale([1.0, holder_cutout_side, 1.0])
round_rect_ex(
holder_y_size,
holder_x_size,
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
holder_height+2*epsilon,
holder_roundness + epsilon,
holder_roundness*taper_ratio + epsilon);
translate([0-(holder_y_size + 2*wall_thickness), 0,0])
scale([1.0, holder_cutout_side, 1.0])
round_rect_ex(
holder_y_size,
holder_x_size,
holder_y_size*taper_ratio,
holder_x_size*taper_ratio,
holder_height+2*epsilon,
holder_roundness + epsilon,
holder_roundness*taper_ratio + epsilon);
}
}
}
}
} // positioning
} // for y
} // for X
}
module pegstr()
{
difference() {
union() {
pinboard();
difference() {
hull() {
pinboard();
intersection() {
translate([-holder_offset - (strength_factor-0.5)*holder_total_y - wall_thickness/4,0,0])
cube([
holder_total_y + 2*wall_thickness,
holder_total_x + wall_thickness,
2*holder_height
], center=true);
holder(0);
}
}
if (closed_bottom*wall_thickness < epsilon) {
holder(2);
}
}
//color([0.2,0.5,0])
difference() {
holder(0);
holder(2);
}
color([0,0,0])
pinboard_clips();
}
holder(1);
translate([-board_thickness/2,-1,-clip_height+5])
rotate([-90,0,90]) {
intersection() {
union() {
difference() {
round_rect_ex(3, 10, 3, 10, 2, 1, 1);
round_rect_ex(2, 9, 2, 9, 3, 1, 1);
}
translate([2.5, 0, 0])
difference() {
round_rect_ex(3, 10, 3, 10, 2, 1, 1);
round_rect_ex(2, 9, 2, 9, 3, 1, 1);
}
}
translate([0, -3.5, 0])
cube([20,4,10], center=true);
}
translate([1.25, -2.5, 0])
difference() {
round_rect_ex(8, 7, 8, 7, 2, 1, 1);
round_rect_ex(7, 6, 7, 6, 3, 1, 1);
translate([3,0,0])
cube([4,2.5,3], center=true);
}
translate([2.0, -1.0, 0])
cube([8, 0.5, 2], center=true);
translate([0,-2,0])
cylinder(r=0.25, h=2, center=true, $fn=12);
translate([2.5,-2,0])
cylinder(r=0.25, h=2, center=true, $fn=12);
}
}
}
rotate([180,0,0]) pegstr();