-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
gridfinity_tray.scad
458 lines (428 loc) · 18.3 KB
/
gridfinity_tray.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
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
use <modules/module_gridfinity_cup.scad>
use <modules/module_gridfinity.scad>
include <modules/gridfinity_constants.scad>
include <modules/functions_general.scad>
include <modules/module_gridfinity_cup_base.scad>
/*<!!start gridfinity_tray!!>*/
/* [Tray] */
tray_corner_radius = 2;
//Height above the base height
tray_zpos = 0;
tray_magnet_radius = 5;
tray_magnet_thickness = 5;
tray_spacing = 2; //0.1
tray_vertical_compartments = 1;
tray_horizontal_compartments = 1;
/*
xpos,ypos,xsize,ysize,radius,depth.
dimensions of the tray cutout, a string with comma separated values, and pipe (|) separated trays.
- xpos, ypos, the x/y position in gridfinity units.
- xsize, ysize. the x/y size in gridfinity units.
- radius, [optional] corner radius in mm.
- depth, [optional] depth in mm
- example "0,0,2,1|2,0,2,1,2,5"
*/
//[[xpos,ypos,xsize,ysize,radius,depth]]. xpos, ypos, the x/y position in gridfinity units.xsize, ysize. the x/y size in gridfinity units. radius, [optional] corner radius in mm.depth, [optional] depth in mm\nexample "0,0,2,1|2,0,2,1,2,5"
tray_custom_compartments = "0, 0, 0.5, 3, 2, 6|0.5, 0, 0.5, 3,2, 6|1, 0, 3, 1.5|1, 1.5, 3, 1.5";
/*<!!end gridfinity_tray!!>*/
/*<!!start gridfinity_basic_cup!!>*/
/* [General Cup] */
// X dimension. grid units (multiples of 42mm) or mm.
width = [4, 0]; //0.5
// Y dimension. grid units (multiples of 42mm) or mm.
depth = [3, 0]; //0.5
// Z dimension excluding. grid units (multiples of 7mm) or mm.
height = [3, 0]; //0.1
// Fill in solid block (overrides all following options)
filled_in = true;
// Wall thickness of outer walls. default, height < 8 0.95, height < 16 1.2, height > 16 1.6 (Zack's design is 0.95 mm)
wall_thickness = 0; // .01
// Remove some or all of lip
lip_style = "normal"; // [ normal, reduced, minimum, none:not stackable ]
position = "center"; //[default,center,zero]
//under size the bin top by this amount to allow for better stacking
zClearance = 0; // 0.1
/* [Subdivisions] */
chamber_wall_thickness = 1.2;
// X dimension subdivisions
vertical_chambers = 1;
vertical_separator_bend_position = 0;
vertical_separator_bend_angle = 0;
vertical_separator_bend_separation = 0;
vertical_separator_cut_depth=0;
horizontal_chambers = 1;
horizontal_separator_bend_position = 0;
horizontal_separator_bend_angle = 0;
horizontal_separator_bend_separation = 0;
horizontal_separator_cut_depth=0;
// Enable irregular subdivisions
vertical_irregular_subdivisions = false;
// Separator positions are defined in terms of grid units from the left end
vertical_separator_config = "10.5|21|42|50|60";
// Enable irregular subdivisions
horizontal_irregular_subdivisions = false;
// Separator positions are defined in terms of grid units from the left end
horizontal_separator_config = "10.5|21|42|50|60";
/* [Base] */
//size of magnet, diameter and height. Zack's original used 6.5 and 2.4
magnet_size = [6.5, 2.4]; // .1
//create relief for magnet removal
magnet_easy_release = "auto";//["off","auto","inner","outer"]
//size of screw, diameter and height. Zack's original used 3 and 6
screw_size = [3, 6]; // .1
//size of center magnet, diameter and height.
center_magnet_size = [0,0];
// Sequential Bridging hole overhang remedy is active only when both screws and magnets are nonzero (and this option is selected)
hole_overhang_remedy = 2;
//Only add attachments (magnets and screw) to box corners (prints faster).
box_corner_attachments_only = true;
// Minimum thickness above cutouts in base (Zack's design is effectively 1.2)
floor_thickness = 0.7;
cavity_floor_radius = -1;// .1
// Efficient floor option saves material and time, but the internal floor is not flat
efficient_floor = "off";//[off,on,rounded,smooth]
// Enable to subdivide bottom pads to allow half-cell offsets
half_pitch = false;
// Removes the internal grid from base the shape
flat_base = false;
// Remove floor to create a vertical spacer
spacer = false;
/* [Label] */
label_style = "disabled"; //[disabled: no label, normal:normal, gflabel:gflabel basic label, pred:pred - labels by pred, cullenect:Cullenect click labels V2, cullenect_legacy:Cullenect click labels v1]
// Include overhang for labeling (and specify left/right/center justification)
label_position = "left"; // [left, right, center, leftchamber, rightchamber, centerchamber]
// Width, Depth, Height, Radius. Width in Gridfinity units of 42mm, Depth and Height in mm, radius in mm. Width of 0 uses full width. Height of 0 uses Depth, height of -1 uses depth*3/4.
label_size = [0,14,0,0.6]; // 0.01
// Size in mm of relief where appropriate. Width, depth, height, radius
label_relief = [0,0,0,0.6]; // 0.1
// wall to enable on, front, back, left, right. 0: disabled; 1: enabled;
label_walls=[0,1,0,0]; //[0:1:1]
/* [Finger Slide] */
// Include larger corner fillet
fingerslide = "none"; //[none, rounded, chamfered]
// Radius of the corner fillet
fingerslide_radius = 8;
/* [Tapered Corner] */
tapered_corner = "none"; //[none, rounded, chamfered]
tapered_corner_size = 10;
// Set back of the tapered corner, default is the gridfinity corner radius
tapered_setback = -1;//gridfinity_corner_radius/2;
/* [Wall Pattern] */
// Grid wall patter
wallpattern_enabled=false;
// Style of the pattern
wallpattern_style = "grid"; //[grid, hexgrid, voronoi,voronoigrid,voronoihexgrid]
// Spacing between pattern
wallpattern_hole_spacing = 2; //0.1
// wall to enable on, front, back, left, right.
wallpattern_walls=[1,1,1,1];
// Add the pattern to the dividers
wallpattern_dividers_enabled="disabled"; //[disabled, horizontal, vertical, both]
//Number of sides of the hole op
wallpattern_hole_sides = 6; //[4:square, 6:Hex, 64:circle]
//Size of the hole
wallpattern_hole_size = 10; //0.1
// pattern fill mode
wallpattern_fill = "none"; //[none, space, crop, crophorizontal, cropvertical, crophorizontal_spacevertical, cropvertical_spacehorizontal, spacevertical, spacehorizontal]
wallpattern_voronoi_noise = 0.75;
wallpattern_voronoi_radius = 0.5;
/* [Wall Cutout] */
wallcutout_vertical ="disabled"; //[disabled, enabled, wallsonly, frontonly, backonly]
// wall to enable on, front, back, left, right. 0: disabled; Positive: GF units; Negative: ratio length/abs(value)
wallcutout_vertical_position=-2; //0.1
//default will be bin width/2
wallcutout_vertical_width=0;
wallcutout_vertical_angle=70;
//default will be binHeight
wallcutout_vertical_height=0;
wallcutout_vertical_corner_radius=5;
wallcutout_horizontal ="disabled"; //[disabled, enabled, wallsonly, leftonly, rightonly]
// wall to enable on, front, back, left, right. 0: disabled; Positive: GF units; Negative: ratio length/abs(value)
wallcutout_horizontal_position=-2; //0.1
//default will be bin width/2
wallcutout_horizontal_width=0;
wallcutout_horizontal_angle=70;
//default will be binHeight
wallcutout_horizontal_height=0;
wallcutout_horizontal_corner_radius=5;
/* [Extendable] */
extension_x_enabled = "disabled"; //[disabled, front, back]
extension_x_position = 0.5;
extension_y_enabled = "disabled"; //[disabled, front, back]
extension_y_position = 0.5;
extension_tabs_enabled = true;
//Tab size, height, width, thickness, style. width default is height, thickness default is 1.4, style {0,1,2}.
extension_tab_size= [10,0,0,0];
/* [debug] */
//Slice along the x axis
cutx = 0; //0.1
//Slice along the y axis
cuty = 0; //0.1
// enable logging of help messages during render.
enable_help = false;
/*<!!end gridfinity_basic_cup!!>*/
/* [Hidden] */
module end_of_customizer_opts() {}
//Index for custom config arrays
ixPos = 0;
iyPos = 1;
ixSize = 2;
iySize = 3;
iCornerRadius = 4;
iDepth = 5;
// module to build the tray cutouts
// This is what will be executed by external scripts
module tray(
num_x=1,
num_y=2,
num_z,
cornerRadius,
trayZpos,
spacing,
cutoutSize,
baseHeight,
floorThickness,
wallThickness,
verticalCompartments = 1,
horizontalCompartments = 1,
customCompartments = "")
{
cellSpacing = spacing/2;
verticalCompartments = verticalCompartments > 0 ? verticalCompartments : num_x ;
horizontalCompartments = horizontalCompartments > 0 ? horizontalCompartments : num_y;
//todo, this could be simplified, by to produce a single array for ether scenario.
if(len(customCompartments) == 0)
{
//Non custom components
if(IsHelpEnabled("trace")) echo(n=num_x*gf_pitch-(verticalCompartments+1)*spacing,d=verticalCompartments);
xSize = (num_x*gf_pitch-(verticalCompartments+1)*spacing)/verticalCompartments;
xStep = xSize + spacing;
ySize = (num_y*gf_pitch-(horizontalCompartments+1)*spacing)/horizontalCompartments;
yStep = ySize + spacing;
for(x =[0:1:verticalCompartments-1])
{
for(y =[0:1:horizontalCompartments-1])
{
if(IsHelpEnabled("trace")) echo(x=x,y=y,xStep=xStep,yStep=yStep);
translate([spacing+x*xStep,spacing+y*yStep,baseHeight+max(trayZpos,floorThickness)])
roundedCube(
xSize, ySize,
num_z*gf_zpitch,
bottomRadius = cornerRadius,
sideRadius = cornerRadius);
}
}
}
else
{
if(IsHelpEnabled("debug")) echo(customCompartments = splitCustomConfig(customCompartments));
//custom components
compartments = split(customCompartments, "|");
scl = [
(num_x*gf_pitch-cellSpacing*2)/(num_x*gf_pitch),
(num_y*gf_pitch-cellSpacing*2)/(num_y*gf_pitch),1];
translate([cellSpacing,cellSpacing,0])
scale(scl)
union()
for (x =[0:1:len(compartments)-1])
{
comp =csv_parse(compartments[x]);
xpos = comp[ixPos];
ypos = comp[iyPos];
xsize = comp[ixSize];
ysize = comp[iySize];
radius = len(comp) >= 5 ? comp[iCornerRadius] : cornerRadius;
depth = baseHeight+(len(comp) >= 6 ? comp[iDepth] : max(trayZpos,floorThickness));
translate([cellSpacing+xpos*gf_pitch,cellSpacing+ypos*gf_pitch,depth])
roundedCube(
xsize*gf_pitch-cellSpacing*2,
ysize*gf_pitch-cellSpacing*2,
//Added 5, as I need to deal with the lip overhang
num_z*gf_zpitch-depth+fudgeFactor+5,
bottomRadius = radius,
sideRadius = radius);
}
}
}
// Generates the gridfinity bin with cutouts.
// Runs the function without needing to pass the variables.
module gridfinity_tray(
//tray settings
tray_spacing = tray_spacing,
tray_corner_radius = tray_corner_radius,
tray_zpos = tray_zpos,
tray_vertical_compartments = tray_vertical_compartments,
tray_horizontal_compartments = tray_horizontal_compartments,
tray_custom_compartments = tray_custom_compartments,
//gridfinity settings
width=width, depth=depth, height=height,
position=position,
filled_in=filled_in,
label_settings=LabelSettings(
labelStyle=label_style,
labelPosition=label_position,
labelSize=label_size,
labelRelief=label_relief,
labelWalls=label_walls),
fingerslide=fingerslide,
fingerslide_radius=fingerslide_radius,
cupBase_settings = CupBaseSettings(
magnetSize = magnet_size,
magnetEasyRelease = magnet_easy_release,
centerMagnetSize = center_magnet_size,
screwSize = screw_size,
holeOverhangRemedy = hole_overhang_remedy,
cornerAttachmentsOnly = box_corner_attachments_only,
floorThickness = floor_thickness,
cavityFloorRadius = cavity_floor_radius,
efficientFloor=efficient_floor,
halfPitch=half_pitch,
flatBase=flat_base,
spacer=spacer),
wall_thickness=wall_thickness,
chamber_wall_thickness=chamber_wall_thickness,
vertical_chambers = vertical_chambers,
vertical_separator_bend_position=vertical_separator_bend_position,
vertical_separator_bend_angle=vertical_separator_bend_angle,
vertical_separator_bend_separation=vertical_separator_bend_separation,
vertical_separator_cut_depth=vertical_separator_cut_depth,
vertical_irregular_subdivisions=vertical_irregular_subdivisions,
vertical_separator_config=vertical_separator_config,
horizontal_chambers=horizontal_chambers,
horizontal_separator_bend_position=horizontal_separator_bend_position,
horizontal_separator_bend_angle=horizontal_separator_bend_angle,
horizontal_separator_bend_separation=horizontal_separator_bend_separation,
horizontal_separator_cut_depth=horizontal_separator_cut_depth,
horizontal_irregular_subdivisions=horizontal_irregular_subdivisions,
horizontal_separator_config=horizontal_separator_config,
half_pitch=half_pitch,
lip_style=lip_style,
zClearance=zClearance,
tapered_corner=tapered_corner,
tapered_corner_size = tapered_corner_size,
tapered_setback = tapered_setback,
wallpattern_enabled=wallpattern_enabled,
wallpattern_style=wallpattern_style,
wallpattern_walls=wallpattern_walls,
wallpattern_dividers_enabled=wallpattern_dividers_enabled,
wallpattern_hole_sides=wallpattern_hole_sides,
wallpattern_hole_size=wallpattern_hole_size,
wallpattern_hole_spacing=wallpattern_hole_spacing,
wallpattern_fill=wallpattern_fill,
wallpattern_voronoi_noise=wallpattern_voronoi_noise,
wallpattern_voronoi_radius = wallpattern_voronoi_radius,
wallcutout_vertical=wallcutout_vertical,
wallcutout_vertical_position=wallcutout_vertical_position,
wallcutout_vertical_width=wallcutout_vertical_width,
wallcutout_vertical_angle=wallcutout_vertical_angle,
wallcutout_vertical_height=wallcutout_vertical_height,
wallcutout_vertical_corner_radius=wallcutout_vertical_corner_radius,
wallcutout_horizontal=wallcutout_horizontal,
wallcutout_horizontal_position=wallcutout_horizontal_position,
wallcutout_horizontal_width=wallcutout_horizontal_width,
wallcutout_horizontal_angle=wallcutout_horizontal_angle,
wallcutout_horizontal_height=wallcutout_horizontal_height,
wallcutout_horizontal_corner_radius=wallcutout_horizontal_corner_radius,
extendable_Settings = ExtendableSettings(
extendablexEnabled = extension_x_enabled,
extendablexPosition = extension_x_position,
extendableyEnabled = extension_y_enabled,
extendableyPosition = extension_y_position,
extendableTabsEnabled = extension_tabs_enabled,
extendableTabSize = extension_tab_size),
cutx=cutx,
cuty=cuty,
help=enable_help) {
num_x = calcDimensionWidth(width);
num_y = calcDimensionDepth(depth);
num_z = calcDimensionHeight(height);
if(IsHelpEnabled("info")) echo("gridfinity_tray", num_x=num_x, num_y=num_y, num_z=num_z);
difference() {
/*<!!start gridfinity_basic_cup!!>*/
gridfinity_cup(
width=width, depth=depth, height=height,
position=position,
filled_in=filled_in,
label_settings=label_settings,
cupBase_settings = cupBase_settings,
fingerslide_radius=fingerslide_radius,
wall_thickness=wall_thickness,
chamber_wall_thickness=chamber_wall_thickness,
vertical_chambers = vertical_chambers,
vertical_separator_bend_position=vertical_separator_bend_position,
vertical_separator_bend_angle=vertical_separator_bend_angle,
vertical_separator_bend_separation=vertical_separator_bend_separation,
vertical_separator_cut_depth=vertical_separator_cut_depth,
vertical_irregular_subdivisions=vertical_irregular_subdivisions,
vertical_separator_config=vertical_separator_config,
horizontal_chambers=horizontal_chambers,
horizontal_separator_bend_position=horizontal_separator_bend_position,
horizontal_separator_bend_angle=horizontal_separator_bend_angle,
horizontal_separator_bend_separation=horizontal_separator_bend_separation,
horizontal_separator_cut_depth=horizontal_separator_cut_depth,
horizontal_irregular_subdivisions=horizontal_irregular_subdivisions,
horizontal_separator_config=horizontal_separator_config,
lip_style=lip_style,
zClearance=zClearance,
tapered_corner=tapered_corner,
tapered_corner_size = tapered_corner_size,
tapered_setback = tapered_setback,
wallpattern_enabled=wallpattern_enabled,
wallpattern_style=wallpattern_style,
wallpattern_walls=wallpattern_walls,
wallpattern_dividers_enabled=wallpattern_dividers_enabled,
wallpattern_hole_sides=wallpattern_hole_sides,
wallpattern_hole_size=wallpattern_hole_size,
wallpattern_hole_spacing=wallpattern_hole_spacing,
wallpattern_fill=wallpattern_fill,
wallpattern_voronoi_noise=wallpattern_voronoi_noise,
wallpattern_voronoi_radius = wallpattern_voronoi_radius,
wallcutout_vertical=wallcutout_vertical,
wallcutout_vertical_position=wallcutout_vertical_position,
wallcutout_vertical_width=wallcutout_vertical_width,
wallcutout_vertical_angle=wallcutout_vertical_angle,
wallcutout_vertical_height=wallcutout_vertical_height,
wallcutout_vertical_corner_radius=wallcutout_vertical_corner_radius,
wallcutout_horizontal=wallcutout_horizontal,
wallcutout_horizontal_position=wallcutout_horizontal_position,
wallcutout_horizontal_width=wallcutout_horizontal_width,
wallcutout_horizontal_angle=wallcutout_horizontal_angle,
wallcutout_horizontal_height=wallcutout_horizontal_height,
wallcutout_horizontal_corner_radius=wallcutout_horizontal_corner_radius,
extendable_Settings = ExtendableSettings(
extendablexEnabled = extension_x_enabled,
extendablexPosition = extension_x_position,
extendableyEnabled = extension_y_enabled,
extendableyPosition = extension_y_position,
extendableTabsEnabled = extension_tabs_enabled,
extendableTabSize = extension_tab_size),
cutx=cutx,
cuty=cuty,
help = help);
/*<!!end gridfinity_basic_cup!!>*/
translate(cupPosition(position,num_x,num_y))
tray(
num_x = num_x,
num_y = num_y,
num_z = num_z,
floorThickness = floor_thickness,
wallThickness = wall_thickness,
spacing = tray_spacing,
cornerRadius = tray_corner_radius,
trayZpos = tray_zpos,
baseHeight = cupBaseClearanceHeight(magnet_size[iCylinderDimension_Height], screw_size[iCylinderDimension_Height]),
verticalCompartments = tray_vertical_compartments,
horizontalCompartments = tray_horizontal_compartments,
customCompartments = tray_custom_compartments);
//This seems like a complicated way to do this, but it guarantees order will be correct.
configArray = [
[ixPos, 0],
[iyPos, 0],
[ixSize, num_z],
[iySize, num_x],
[iCornerRadius, tray_corner_radius],
[iDepth, num_z]];
if(IsHelpEnabled("info")) echo(outputCustomConfig("tray", replace_Items(configArray, [])));
}
}
gridfinity_tray();