From e2e9ad536c6f5c27792d222a9fa6a49a426ab4ce Mon Sep 17 00:00:00 2001 From: K Hodson Date: Tue, 7 Feb 2023 16:02:46 -0700 Subject: [PATCH] Fixed #59 Changed `enable_lip` to `style_lip` to allow a choice between a regular lip, removal of the lip (losing 3.6mm of height) or remove lip while retaining the regular height --- gridfinity-constants.scad | 2 ++ gridfinity-rebuilt-bins.scad | 6 +++--- gridfinity-rebuilt-utility.scad | 14 +++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gridfinity-constants.scad b/gridfinity-constants.scad index e56a2b0..174a497 100644 --- a/gridfinity-constants.scad +++ b/gridfinity-constants.scad @@ -45,6 +45,8 @@ d_tabh = 15.85; d_tabw = 42; // angle of tab a_tab = 36; +// lip height +h_lip = 3.548; d_wall2 = r_base-r_c1-d_clear*sqrt(2); d_magic = -2*d_clear-2*d_wall+d_div; diff --git a/gridfinity-rebuilt-bins.scad b/gridfinity-rebuilt-bins.scad index 101c57a..b1e1765 100644 --- a/gridfinity-rebuilt-bins.scad +++ b/gridfinity-rebuilt-bins.scad @@ -48,8 +48,8 @@ divy = 1; enable_scoop = true; // snap gridz height to nearest 7mm increment enable_zsnap = false; -// enable upper lip for stacking other bins -enable_lip = true; +// how should the top lip act +style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and retain height] /* [Other] */ // determine what the variable "gridz" applies to based on your use case @@ -72,7 +72,7 @@ div_base_y = 0; // ===== IMPLEMENTATION ===== // color("tomato") { -gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), height_internal, length) { +gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal, length) { if (divx > 0 && divy > 0) cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, enable_scoop = enable_scoop); diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 0d56c83..3698c0a 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -6,8 +6,8 @@ include // ===== User Modules ===== // // functions to convert gridz values to mm values -function hf (z, d, l) = (d==0)?z*7:(d==1)?h_bot+z+h_base:z-(l?3.8:0); -function height (z,d=0,l=true,s=true) = (s?((abs(hf(z,d,l))%7==0)?hf(z,d,l):hf(z,d,l)+7-abs(hf(z,d,l))%7):hf(z,d,l))-h_base; +function hf (z, d, l) = ((d==0)?z*7:(d==1)?h_bot+z+h_base:z-((l==1)?h_lip:0))+(l==2?h_lip:0); +function height (z,d=0,l=0,s=true) = (s?((abs(hf(z,d,l))%7==0)?hf(z,d,l):hf(z,d,l)+7-abs(hf(z,d,l))%7):hf(z,d,l))-h_base; // Creates equally divided cutters for the bin // @@ -36,7 +36,7 @@ module gridfinityInit(gx, gy, h, h0 = 0, l) { } color("royalblue") block_wall(gx, gy, l) { - if (enable_lip) profile_wall(); + if (style_lip == 0) profile_wall(); else profile_wall2(); } } @@ -225,10 +225,10 @@ module block_cutter(x,y,w,h,t,s) { v_ang_tab = a_tab; v_ang_lip = 45; - ycutfirst = y == 0 && enable_lip; - ycutlast = abs(y+h-$gyy)<0.001 && enable_lip; - xcutfirst = x == 0 && enable_lip; - xcutlast = abs(x+w-$gxx)<0.001 && enable_lip; + ycutfirst = y == 0 && style_lip == 0; + ycutlast = abs(y+h-$gyy)<0.001 && style_lip == 0; + xcutfirst = x == 0 && style_lip == 0; + xcutlast = abs(x+w-$gxx)<0.001 && style_lip == 0; zsmall = ($dh+h_base)/7 < 3; ylen = h*($gyy*length+d_magic)/$gyy-d_div;