From b95548fe6d39e1eb86182c1e752c680d6c8d006f Mon Sep 17 00:00:00 2001 From: K Hodson Date: Fri, 17 Feb 2023 10:23:59 -0700 Subject: [PATCH] Option to only put holes at corners of bin --- .gitignore | 4 +++- gridfinity-constants.scad | 13 +++---------- gridfinity-rebuilt-bins.json | 24 ------------------------ gridfinity-rebuilt-bins.scad | 8 +++++--- gridfinity-rebuilt-lite.scad | 7 +++++-- gridfinity-rebuilt-utility.scad | 14 +++++++++----- 6 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 gridfinity-rebuilt-bins.json diff --git a/.gitignore b/.gitignore index 382d386..3d77328 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ ignore/ gridfinity-rebuilt.json +gridfinity-rebuilt-bins.json stl/ batch/ -site/ \ No newline at end of file +site/ +*.json \ No newline at end of file diff --git a/gridfinity-constants.scad b/gridfinity-constants.scad index 174a497..7e93649 100644 --- a/gridfinity-constants.scad +++ b/gridfinity-constants.scad @@ -55,33 +55,26 @@ d_magic = -2*d_clear-2*d_wall+d_div; // Baseplate bottom part height (part added with weigthed=true) bp_h_bot = 6.4; - // Baseplate bottom cutout rectangle size bp_cut_size = 21.4; - // Baseplate bottom cutout rectangle depth bp_cut_depth = 4; - // Baseplate bottom cutout rounded thingy width bp_rcut_width = 8.5; - // Baseplate bottom cutout rounded thingy left bp_rcut_length = 4.25; - // Baseplate bottom cutout rounded thingy depth bp_rcut_depth = 2; - // countersink diameter for baseplate d_cs = 2.5; - // radius of cutout for skeletonized baseplate r_skel = 2; - // baseplate counterbore radius r_cb = 2.75; - // baseplate counterbore depth h_cb = 3; - // minimum baseplate thickness (when skeletonized) h_skel = 1; + +// Prime numbers +p_corn = 401; diff --git a/gridfinity-rebuilt-bins.json b/gridfinity-rebuilt-bins.json deleted file mode 100644 index f1a356a..0000000 --- a/gridfinity-rebuilt-bins.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "fileFormatVersion": "1", - "parameterSets": { - "New set 1": { - "$fa": "8", - "$fs": "0.25", - "div_base_x": "0", - "div_base_y": "0", - "divx": "1", - "divy": "1", - "enable_zsnap": "false", - "gridx": "1", - "gridy": "1", - "gridz": "6", - "gridz_define": "0", - "height_internal": "0", - "length": "42", - "scoop": "1", - "style_hole": "3", - "style_lip": "0", - "style_tab": "1" - } - } -} diff --git a/gridfinity-rebuilt-bins.scad b/gridfinity-rebuilt-bins.scad index 9b7755d..caf2c5c 100644 --- a/gridfinity-rebuilt-bins.scad +++ b/gridfinity-rebuilt-bins.scad @@ -38,9 +38,9 @@ gridz = 6; length = 42; /* [Compartments] */ -// number of X Divisions +// number of X Divisions (set to zero to have solid bin) divx = 1; -// number of y Divisions +// number of y Divisions (set to zero to have solid bin) divy = 1; /* [Height] */ @@ -58,6 +58,8 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None] style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and retain height] // scoop weight percentage. 0 disables scoop, 1 is regular scoop. Any real number will scale the scoop. scoop = 1; //[0:0.1:1] +// only cut magnet/screw holes at the corners of the bin to save uneccesary print time +style_corners = true; /* [Base] */ style_hole = 3; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit] @@ -76,7 +78,7 @@ gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap if (divx > 0 && divy > 0) cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop); } -gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole); +gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole*(style_corners?p_corn:1)); } diff --git a/gridfinity-rebuilt-lite.scad b/gridfinity-rebuilt-lite.scad index 2278bbd..21ec7bf 100644 --- a/gridfinity-rebuilt-lite.scad +++ b/gridfinity-rebuilt-lite.scad @@ -44,6 +44,8 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None] /* [Base] */ style_hole = 0; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit] +// only cut magnet/screw holes at the corners of the bin to save uneccesary print time +style_corners = true; // number of divisions per 1 unit of base along the X axis. (default 1, only use integers. 0 means automatically guess the right division) div_base_x = 0; // number of divisions per 1 unit of base along the Y axis. (default 1, only use integers. 0 means automatically guess the right division) @@ -64,18 +66,19 @@ gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, lengt module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole) { + sh = style_hole*(style_corners?p_corn:1); difference() { union() { gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), 0, length) children(); - gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole); + gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, sh); } difference() { union() { intersection() { difference() { - gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, -d_wall*2, false); + gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, sh, -d_wall*2, false); translate([-gridx*length/2,-gridy*length/2,2*h_base]) cube([gridx*length,gridy*length,1000]); } diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 22131a1..13b5ff9 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -102,9 +102,15 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) { pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l) block_base_solid(dbnx, dbny, l, off); - if (style_hole > 0) - pattern_linear(gx, gy, l) - block_base_hole(style_hole, off); + if (style_hole > 0) + if (style_hole % p_corn < 0.001) + pattern_linear(2, 2, (gx-1)*length+d_hole, (gy-1)*length+d_hole) + block_base_hole(style_hole / p_corn, off); + else + pattern_linear(gx, gy, l) + pattern_circular(abs(d_hole)<0.001?1:4) + translate([d_hole/2, d_hole/2, 0]) + block_base_hole(style_hole, off); } } } @@ -132,8 +138,6 @@ module block_base_solid(dbnx, dbny, l, o) { module block_base_hole(style_hole, o=0) { r1 = r_hole1-o/2; r2 = r_hole2-o/2; - pattern_circular(abs(d_hole)<0.001?1:4) - translate([d_hole/2, d_hole/2, 0]) union() { difference() { cylinder(h = 2*(h_hole-o+(style_hole==3?h_slit:0)), r=r2, center=true);