From faff922757cda077bcfb934b76df6ded88b6ca30 Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Sun, 28 Jan 2024 19:54:51 -0800 Subject: [PATCH] Add `style_lip` as argument to `gridfinityInit` When used as a library, `grifinity-rebuilt-utility.scad` accepts all the bin properties to use as arguments to `gridfinityInit`, `cut`, or other methods, with the sole exception of `style_lip` which must be defined in the calling file. This change adds `style_lip` as an argument to `gridfinityInit` to ensure `gridfinity-rebuilt-utility.scad` can be used as a library. --- docs/bins.md | 1 + gridfinity-rebuilt-utility.scad | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/bins.md b/docs/bins.md index f75ae73..1b1d088 100644 --- a/docs/bins.md +++ b/docs/bins.md @@ -43,6 +43,7 @@ gridy | { n>0 \| n∈R } | number of bases along the y-axis height | { n>0 \| n∈R } | height of the bin, in millimeters (but not exactly).
See the `height()` function for more info. height_internal | { n>0 \| n∈R } | height of the internal block.
Can be lower than bin height to save filament on custom bins.
default of 0 means use the calculated height. length | { n>0 \| n∈R } | length of one unit of the base.
default: 42 (The Answer to the Ultimate Question of Life,
the Universe, and Everything.) +style_lip | {0, 1, 2} | if you are not stacking the bin, you can disable the top lip
to save space.
• (0) Regular lip
• (1) Subtract lip to save space
• (2) Disable lip while retaining height ``` // Example: generate a 3x3x6 bin with a 42mm unit size diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index d789b65..929e6f0 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -56,11 +56,14 @@ module cutCylinders(n_divx=1, n_divy=1, cylinder_diameter=1, cylinder_height=1, } // initialize gridfinity -module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid) { +// sl: lip style of this bin. +// 0:Regular lip, 1:Remove lip subtractively, 2:Remove lip and retain height +module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid, sl = 0) { $gxx = gx; $gyy = gy; $dh = h; $dh0 = h0; + $style_lip = sl; color("tomato") { difference() { color("firebrick") @@ -69,7 +72,7 @@ module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid) { } color("royalblue") block_wall(gx, gy, l) { - if (style_lip == 0) profile_wall(); + if ($style_lip == 0) profile_wall(); else profile_wall2(); } } @@ -307,10 +310,10 @@ module block_cutter(x,y,w,h,t,s) { v_ang_tab = a_tab; v_ang_lip = 45; - 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; + 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*l_grid+d_magic)/$gyy-d_div;