From 1b9f71b4b541eb1676a17e6be94d365dd7aacb38 Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Mon, 20 Mar 2023 18:48:28 +0100 Subject: [PATCH] fix holes only on corners --- gridfinity-constants.scad | 5 +---- gridfinity-rebuilt-bins.scad | 4 ++-- gridfinity-rebuilt-lite.scad | 11 +++++------ gridfinity-rebuilt-utility.scad | 22 ++++++++++++++-------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/gridfinity-constants.scad b/gridfinity-constants.scad index 7e93649..e497e75 100644 --- a/gridfinity-constants.scad +++ b/gridfinity-constants.scad @@ -74,7 +74,4 @@ r_cb = 2.75; // baseplate counterbore depth h_cb = 3; // minimum baseplate thickness (when skeletonized) -h_skel = 1; - -// Prime numbers -p_corn = 401; +h_skel = 1; \ No newline at end of file diff --git a/gridfinity-rebuilt-bins.scad b/gridfinity-rebuilt-bins.scad index 2f2d2e2..187c524 100644 --- a/gridfinity-rebuilt-bins.scad +++ b/gridfinity-rebuilt-bins.scad @@ -59,7 +59,7 @@ style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and // 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 = false; +only_corners = false; /* [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] @@ -78,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*(style_corners?p_corn:1)); +gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, only_corners=only_corners); } diff --git a/gridfinity-rebuilt-lite.scad b/gridfinity-rebuilt-lite.scad index fb24f5a..347b8dc 100644 --- a/gridfinity-rebuilt-lite.scad +++ b/gridfinity-rebuilt-lite.scad @@ -45,7 +45,7 @@ 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 = false; +only_corners = false; // 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) @@ -58,27 +58,26 @@ bottom_layer = 1; // Input all the cutter types in here color("tomato") -gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole) { +gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole, only_corners) { cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = 0); } // ===== CONSTRUCTION ===== // -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); +module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole, only_corners) { 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, sh); + gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, only_corners=only_corners); } difference() { union() { intersection() { difference() { - gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, sh, -d_wall*2, false); + gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, -d_wall*2, false, only_corners=only_corners); 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 d9deec6..de00d1e 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -80,7 +80,7 @@ module profile_base() { ]); } -module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) { +module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only_corners=false) { dbnxt = [for (i=[1:5]) if (abs(gx*i)%1 < 0.001 || abs(gx*i)%1 > 0.999) i]; dbnyt = [for (i=[1:5]) if (abs(gy*i)%1 < 0.001 || abs(gy*i)%1 > 0.999) i]; dbnx = 1/(dx==0 ? len(dbnxt) > 0 ? dbnxt[0] : 1 : round(dx)); @@ -97,8 +97,18 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) { translate([0,0,-1]) rounded_rectangle(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001); - pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l) - block_base(gx, gy, l, dbnx, dbny, style_hole, off); + if(only_corners) { + difference(){ + pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l) + block_base(gx, gy, l, dbnx, dbny, 0, off); + pattern_linear(2, 2, (gx-1)*length+d_hole, (gy-1)*length+d_hole) + block_base_hole(style_hole, off); + } + } + else { + pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l) + block_base(gx, gy, l, dbnx, dbny, style_hole, off); + } } } @@ -107,11 +117,7 @@ module block_base(gx, gy, l, dbnx, dbny, style_hole, off) { difference() { block_base_solid(dbnx, dbny, l, 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 + if (style_hole > 0) pattern_circular(abs(d_hole)<0.001?1:4) translate([d_hole/2, d_hole/2, 0]) block_base_hole(style_hole, off);