mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-11-26 02:08:01 +00:00
Convered scoop param from boolean to real
Scoop parameter can now be any real number. Follows the same logic as before, where false (now 0) means no scoop, and true (now 1) means regular scoop. Any real number will scale the scoop value to preference.
This commit is contained in:
parent
7430123683
commit
831c7d6bf1
2 changed files with 17 additions and 18 deletions
|
@ -26,7 +26,6 @@ https://github.com/kennetek/gridfinity-rebuilt-openscad
|
||||||
/* [Setup Parameters] */
|
/* [Setup Parameters] */
|
||||||
$fa = 8;
|
$fa = 8;
|
||||||
$fs = 0.25;
|
$fs = 0.25;
|
||||||
$scoop_percentage = 100;
|
|
||||||
|
|
||||||
/* [General Settings] */
|
/* [General Settings] */
|
||||||
// number of bases along x-axis
|
// number of bases along x-axis
|
||||||
|
@ -45,8 +44,6 @@ divx = 1;
|
||||||
divy = 1;
|
divy = 1;
|
||||||
|
|
||||||
/* [Toggles] */
|
/* [Toggles] */
|
||||||
// internal fillet for easy part removal
|
|
||||||
enable_scoop = true;
|
|
||||||
// snap gridz height to nearest 7mm increment
|
// snap gridz height to nearest 7mm increment
|
||||||
enable_zsnap = false;
|
enable_zsnap = false;
|
||||||
// enable upper lip for stacking other bins
|
// enable upper lip for stacking other bins
|
||||||
|
@ -57,6 +54,8 @@ enable_lip = true;
|
||||||
gridz_define = 0; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters]
|
gridz_define = 0; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters]
|
||||||
// the type of tabs
|
// the type of tabs
|
||||||
style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
|
style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
|
||||||
|
// scoop weight percentage. 0 disables scoop, 1 is regualar scoop. Any real number will scale the effective scoop.
|
||||||
|
scoop = 1;
|
||||||
|
|
||||||
// overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm
|
// overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm
|
||||||
height_internal = 0;
|
height_internal = 0;
|
||||||
|
@ -72,14 +71,14 @@ div_base_y = 0;
|
||||||
|
|
||||||
// ===== IMPLEMENTATION ===== //
|
// ===== IMPLEMENTATION ===== //
|
||||||
|
|
||||||
color("tomato") {
|
//color("tomato") {
|
||||||
gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), height_internal, length) {
|
//gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), height_internal, length) {
|
||||||
|
//
|
||||||
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, enable_scoop = enable_scoop);
|
// 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);
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
// ===== EXAMPLES ===== //
|
// ===== EXAMPLES ===== //
|
||||||
|
|
|
@ -15,11 +15,11 @@ function height (z,d=0,l=true,s=true) = (s?((abs(hf(z,d,l))%7==0)?hf(z,d,l):hf(z
|
||||||
// n_divy: number of y compartments (ideally, coprime w/ gridy)
|
// n_divy: number of y compartments (ideally, coprime w/ gridy)
|
||||||
// set n_div values to 0 for a solid bin
|
// set n_div values to 0 for a solid bin
|
||||||
// style_tab: tab style for all compartments. see cut()
|
// style_tab: tab style for all compartments. see cut()
|
||||||
// enable_scoop: scoop toggle for all compartments. see cut()
|
// scoop_weight: scoop toggle for all compartments. see cut()
|
||||||
module cutEqual(n_divx=1, n_divy=1, style_tab=1, enable_scoop=true) {
|
module cutEqual(n_divx=1, n_divy=1, style_tab=1, scoop_weight=1) {
|
||||||
for (i = [1:n_divx])
|
for (i = [1:n_divx])
|
||||||
for (j = [1:n_divy])
|
for (j = [1:n_divy])
|
||||||
cut((i-1)*$gxx/n_divx,(j-1)*$gyy/n_divy, $gxx/n_divx, $gyy/n_divy, style_tab, enable_scoop);
|
cut((i-1)*$gxx/n_divx,(j-1)*$gyy/n_divy, $gxx/n_divx, $gyy/n_divy, style_tab, scoop_weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize gridfinity
|
// initialize gridfinity
|
||||||
|
@ -53,7 +53,7 @@ module gridfinityInit(gx, gy, h, h0 = 0, l) {
|
||||||
// 0:full, 1:auto, 2:left, 3:center, 4:right, 5:none
|
// 0:full, 1:auto, 2:left, 3:center, 4:right, 5:none
|
||||||
// Automatic alignment will use left tabs for bins on the left edge, right tabs for bins on the right edge, and center tabs everywhere else.
|
// Automatic alignment will use left tabs for bins on the left edge, right tabs for bins on the right edge, and center tabs everywhere else.
|
||||||
// s: toggle the rounded back corner that allows for easy removal
|
// s: toggle the rounded back corner that allows for easy removal
|
||||||
module cut(x=0, y=0, w=1, h=1, t=1, s=true) {
|
module cut(x=0, y=0, w=1, h=1, t=1, s=1) {
|
||||||
translate([0,0,-$dh-h_base])
|
translate([0,0,-$dh-h_base])
|
||||||
cut_move(x,y,w,h)
|
cut_move(x,y,w,h)
|
||||||
block_cutter(clp(x,0,$gxx), clp(y,0,$gyy), clp(w,0,$gxx-x), clp(h,0,$gyy-y), t, s);
|
block_cutter(clp(x,0,$gxx), clp(y,0,$gyy), clp(w,0,$gxx-x), clp(h,0,$gyy-y), t, s);
|
||||||
|
@ -232,7 +232,7 @@ module block_cutter(x,y,w,h,t,s) {
|
||||||
xlen = w*($gxx*length+d_magic)/$gxx-d_div;
|
xlen = w*($gxx*length+d_magic)/$gxx-d_div;
|
||||||
|
|
||||||
height = $dh;
|
height = $dh;
|
||||||
extent = (s && ycutfirst ? d_wall2-d_wall-d_clear : 0);
|
extent = (abs(s) > 0 && ycutfirst ? d_wall2-d_wall-d_clear : 0);
|
||||||
tab = (zsmall || t == 5) ? (ycutlast?v_len_lip:0) : v_len_tab;
|
tab = (zsmall || t == 5) ? (ycutlast?v_len_lip:0) : v_len_tab;
|
||||||
ang = (zsmall || t == 5) ? (ycutlast?v_ang_lip:0) : v_ang_tab;
|
ang = (zsmall || t == 5) ? (ycutlast?v_ang_lip:0) : v_ang_tab;
|
||||||
cut = (zsmall || t == 5) ? (ycutlast?v_cut_lip:0) : v_cut_tab;
|
cut = (zsmall || t == 5) ? (ycutlast?v_cut_lip:0) : v_cut_tab;
|
||||||
|
@ -298,7 +298,7 @@ module block_cutter(x,y,w,h,t,s) {
|
||||||
if (!((zsmall || t == 5) && !ycutlast))
|
if (!((zsmall || t == 5) && !ycutlast))
|
||||||
profile_cutter_tab(height-h_bot, tab, ang);
|
profile_cutter_tab(height-h_bot, tab, ang);
|
||||||
|
|
||||||
if (!s && y == 0)
|
if (!(abs(s) > 0)&& y == 0)
|
||||||
translate([ylen-extent,0,0])
|
translate([ylen-extent,0,0])
|
||||||
mirror([1,0,0])
|
mirror([1,0,0])
|
||||||
profile_cutter_tab(height-h_bot, v_len_lip, v_ang_lip);
|
profile_cutter_tab(height-h_bot, v_len_lip, v_ang_lip);
|
||||||
|
@ -346,7 +346,7 @@ module fillet_cutter(t = 0, c = "goldenrod") {
|
||||||
}
|
}
|
||||||
|
|
||||||
module profile_cutter(h, l, s) {
|
module profile_cutter(h, l, s) {
|
||||||
scoop = s ? (length*(($dh * ($scoop_percentage / 100)-2)/7+1)/12-r_f2) : 0;
|
scoop = max(s*$dh/2-r_f2,0);
|
||||||
translate([r_f2,r_f2])
|
translate([r_f2,r_f2])
|
||||||
hull() {
|
hull() {
|
||||||
if (l-scoop-2*r_f2 > 0)
|
if (l-scoop-2*r_f2 > 0)
|
||||||
|
|
Loading…
Reference in a new issue