From 473dc07ffaef7483ff7b7f205ac2310ba511f67e Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Tue, 4 Oct 2022 21:40:20 +0200 Subject: [PATCH 1/8] add baseplate modules --- gridfinity-constants.scad | 35 ++++++++++++++++++ gridfinity-rebuilt-utility.scad | 63 +++++++++++++++++++++++++++++++-- 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/gridfinity-constants.scad b/gridfinity-constants.scad index a6143d7..3207641 100644 --- a/gridfinity-constants.scad +++ b/gridfinity-constants.scad @@ -46,3 +46,38 @@ a_tab = 36; d_wall2 = r_base-r_c1-d_clear*sqrt(2); d_magic = -2*d_clear-2*d_wall+d_div; + +// Baseplate constants + +// Baseplate top part height (weigthed=false part) +bp_h_top = 4.65; + +// Baseplate bottom part height (part added with weigthed=true) +bp_h_bot = 6.4; + +// Baseplate z offset +bp_z_offset = 0.1; + +// Baaseplate fitting clearance +bp_clear = 0.5; + +// Baseplate countersink hole biggest diameter +bp_csink_d1 = 8.5; + +// Baseplate countersink hole height +bp_csink_h = 2.5; + +// 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; \ No newline at end of file diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 21ec09b..975969c 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -79,7 +79,7 @@ module profile_base() { ]); } -module gridfinityBase(gx, gy, l, dx, dy, style_hole) { +module gridfinityBase(gx, gy, l, dx, dy, style_hole, block_scale=1, final_cut=true) { 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)); @@ -91,12 +91,14 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole) { rounded_rectangle(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001); intersection(){ + if(final_cut) { translate([0,0,-1]) rounded_rectangle(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001); - + } render() difference() { pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l) + scale([block_scale,block_scale,1]) block_base_solid(dbnx, dbny, l); if (style_hole > 0) @@ -138,6 +140,7 @@ module block_base_hole(style_hole) { } if (style_hole > 1) cylinder(h = 3*h_base, r = r_hole1, center=true); + } } @@ -378,6 +381,62 @@ module profile_cutter_tab(h, tab, ang) { } +// Baseplate modules +module baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weighted, bottom_cutout) { + + scale_factor = (bp_clear / (length /100)) /100 + 1; + + union() { + difference(){ + rounded_rectangle(gridx*length, gridy*length, bp_h_top + bp_z_offset - 0.001, r_base); + translate([0,0,-bp_z_offset]) + + gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, 0, scale_factor, false); + } + + if(weighted) { + difference() { + translate([0,0,-1*(bp_h_bot - bp_clear)]) + rounded_rectangle(gridx*length, gridy*length, bp_h_bot, r_base); + + pattern_linear(gridx, gridy, length) + union() { + block_base_hole(style_hole); + + //TODO Do this part inside block_base_hole as it shares everything except the + // countersink cylinder? Maybe make an extra hole type + if (style_hole > 2) { + translate([0,0,-1*(bp_h_bot + bp_z_offset)]) + pattern_circular(4) + translate([d_hole/2, d_hole/2, 0]) + cylinder(bp_csink_h, d1=bp_csink_d1, r2=r_hole1); + } + + if (bottom_cutout) { + translate([0,0,-1*(bp_h_bot + bp_z_offset)]) + bottom_cutout(); + } + } + } + } + } +} + +module bottom_cutout(){ + union() { + linear_extrude(bp_cut_depth) + square(bp_cut_size, center=true); + pattern_circular(4) + translate([0,10,0]) + linear_extrude(bp_rcut_depth) + union() { + square([bp_rcut_width, bp_rcut_length], center=true); + translate([0,bp_rcut_length/2,0]) + circle(d=bp_rcut_width); + } + } +} + // ==== Utilities ===== function clp(x,a,b) = min(max(x,a),b); From 354705620e1e1f86cc5debebfcd7ab066af399ca Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Tue, 4 Oct 2022 22:25:11 +0200 Subject: [PATCH 2/8] Add countersink hole style --- gridfinity-rebuilt-utility.scad | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 975969c..32d5f97 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -126,7 +126,7 @@ module block_base_solid(dbnx, dbny, l) { } } -module block_base_hole(style_hole) { +module block_base_hole(style_hole, cs_z=0) { pattern_circular(4) translate([d_hole/2, d_hole/2, 0]) union() { @@ -141,6 +141,10 @@ module block_base_hole(style_hole) { if (style_hole > 1) cylinder(h = 3*h_base, r = r_hole1, center=true); + if (style_hole == 4 && cs_z != 0) + translate([0,0,cs_z]) + cylinder(bp_csink_h, d2=bp_csink_d1, r1=r_hole1); + } } @@ -401,16 +405,8 @@ module baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weigh pattern_linear(gridx, gridy, length) union() { - block_base_hole(style_hole); - - //TODO Do this part inside block_base_hole as it shares everything except the - // countersink cylinder? Maybe make an extra hole type - if (style_hole > 2) { - translate([0,0,-1*(bp_h_bot + bp_z_offset)]) - pattern_circular(4) - translate([d_hole/2, d_hole/2, 0]) - cylinder(bp_csink_h, d1=bp_csink_d1, r2=r_hole1); - } + rotate([180,0,0]) + block_base_hole(style_hole, bp_h_bot - bp_z_offset - bp_csink_h); if (bottom_cutout) { translate([0,0,-1*(bp_h_bot + bp_z_offset)]) From 4e26896f5cae1739b5c99df374b91fb53bd95757 Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Tue, 4 Oct 2022 22:25:46 +0200 Subject: [PATCH 3/8] add baseplate to UI --- gridfinity-rebuilt-bins.scad | 47 ++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/gridfinity-rebuilt-bins.scad b/gridfinity-rebuilt-bins.scad index 46216cd..658fea1 100644 --- a/gridfinity-rebuilt-bins.scad +++ b/gridfinity-rebuilt-bins.scad @@ -25,7 +25,16 @@ https://github.com/kennetek/gridfinity-rebuilt-openscad $fa = 8; $fs = 0.25; -/* [General Settings] */ +/* [Objects to generate] */ + +// Generate a gridfinity bin +generate_bin = true; + +// Generate a gridfinity baseplate +generate_baseplate = false; + + +/* [General Settings (All Objects)] */ // number of bases along x-axis gridx = 2; // number of bases along y-axis @@ -35,13 +44,20 @@ gridz = 6; // base unit length = 42; -/* [Compartments] */ +/* [Base (All Objects)] */ +style_hole = 1; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit, 4: magnet and countersunk screw holes - (baseplate only)] +// 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) +div_base_y = 0; + +/* [Compartments (Bin)] */ // number of X Divisions divx = 1; // number of y Divisions divy = 1; -/* [Toggles] */ +/* [Toggles (Bin)] */ // internal fillet for easy part removal enable_scoop = true; // snap gridz height to nearest 7mm increment @@ -49,7 +65,7 @@ enable_zsnap = false; // enable upper lip for stacking other bins enable_lip = true; -/* [Other] */ +/* [Other (Bin)] */ // determine what the variable "gridz" applies to based on your use case 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 @@ -58,24 +74,29 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None] // overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm height_internal = 0; -/* [Base] */ -style_hole = 1; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit] -// 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) -div_base_y = 0; +/* [Base Plate (Baseplate)] */ +weigthed = true; +bottom_cutout = true; // ===== Commands ===== // color("tomato") { -gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), height_internal, length) { +//bin +if (generate_bin) { + 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, enable_scoop = enable_scoop); + } + gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole); +} + +//baseplate +if (generate_baseplate) { + baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weigthed, bottom_cutout); } -gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole); } From 0ec8fff90aa6fda7fd58219404bd8b6ce6dec4ed Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Tue, 11 Oct 2022 10:09:58 +0200 Subject: [PATCH 4/8] Moved baseplates to seperate file --- gridfinity-rebuild-baseplate.scad | 46 ++++++++++++++++++++++++++++++ gridfinity-rebuilt-bins.scad | 47 +++++++++---------------------- 2 files changed, 59 insertions(+), 34 deletions(-) create mode 100644 gridfinity-rebuild-baseplate.scad diff --git a/gridfinity-rebuild-baseplate.scad b/gridfinity-rebuild-baseplate.scad new file mode 100644 index 0000000..28a1c2e --- /dev/null +++ b/gridfinity-rebuild-baseplate.scad @@ -0,0 +1,46 @@ +include + +// ===== Info ===== // +/* + IMPORTANT: rendering will be better for analyzing the model if fast-csg is enabled. As of writing, this feature is only available in the development builds and not the official release of OpenSCAD, but it makes rendering only take a couple seconds, even for comically large bins. Enable it in Edit > Preferences > Features > fast-csg + +https://github.com/kennetek/gridfinity-rebuilt-openscad + +*/ + +/* [Setup Parameters] */ +$fa = 8; +$fs = 0.25; + +/* [General Settings] */ +// number of bases along x-axis +gridx = 2; +// number of bases along y-axis +gridy = 2; +// bin height. See bin height information and "gridz_define" below. +gridz = 6; +// base unit +length = 42; + +/* [Base] */ +style_hole = 1; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit, 4: magnet and countersunk screw holes] +// 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) +div_base_y = 0; + +/* [Togglles] */ + +// weigthed baseplate with possibility for magnet / screw holes +weigthed = true; + +// cutout in the bottom for weigthed baseplate only +bottom_cutout = true; + +// ===== Commands ===== // + +color("tomato") { + + baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weigthed, bottom_cutout); + +} \ No newline at end of file diff --git a/gridfinity-rebuilt-bins.scad b/gridfinity-rebuilt-bins.scad index 658fea1..46216cd 100644 --- a/gridfinity-rebuilt-bins.scad +++ b/gridfinity-rebuilt-bins.scad @@ -25,16 +25,7 @@ https://github.com/kennetek/gridfinity-rebuilt-openscad $fa = 8; $fs = 0.25; -/* [Objects to generate] */ - -// Generate a gridfinity bin -generate_bin = true; - -// Generate a gridfinity baseplate -generate_baseplate = false; - - -/* [General Settings (All Objects)] */ +/* [General Settings] */ // number of bases along x-axis gridx = 2; // number of bases along y-axis @@ -44,20 +35,13 @@ gridz = 6; // base unit length = 42; -/* [Base (All Objects)] */ -style_hole = 1; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit, 4: magnet and countersunk screw holes - (baseplate only)] -// 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) -div_base_y = 0; - -/* [Compartments (Bin)] */ +/* [Compartments] */ // number of X Divisions divx = 1; // number of y Divisions divy = 1; -/* [Toggles (Bin)] */ +/* [Toggles] */ // internal fillet for easy part removal enable_scoop = true; // snap gridz height to nearest 7mm increment @@ -65,7 +49,7 @@ enable_zsnap = false; // enable upper lip for stacking other bins enable_lip = true; -/* [Other (Bin)] */ +/* [Other] */ // determine what the variable "gridz" applies to based on your use case 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 @@ -74,29 +58,24 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None] // overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm height_internal = 0; -/* [Base Plate (Baseplate)] */ +/* [Base] */ +style_hole = 1; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit] +// 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) +div_base_y = 0; -weigthed = true; -bottom_cutout = true; // ===== Commands ===== // color("tomato") { -//bin -if (generate_bin) { - 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); - } - gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole); -} - -//baseplate -if (generate_baseplate) { - baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weigthed, bottom_cutout); + cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, enable_scoop = enable_scoop); } +gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole); } From d96415610b3d8f6be916026e3ce3153bedf7ce3e Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Tue, 11 Oct 2022 10:10:35 +0200 Subject: [PATCH 5/8] enabled no_holes for baseplate --- gridfinity-rebuilt-utility.scad | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 32d5f97..df782fc 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -405,8 +405,10 @@ module baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weigh pattern_linear(gridx, gridy, length) union() { - rotate([180,0,0]) - block_base_hole(style_hole, bp_h_bot - bp_z_offset - bp_csink_h); + if (style_hole != 0) { + rotate([180,0,0]) + block_base_hole(style_hole, bp_h_bot - bp_z_offset - bp_csink_h); + } if (bottom_cutout) { translate([0,0,-1*(bp_h_bot + bp_z_offset)]) From ee3fac92dfe8778dbc3dab38aeea83bcf31f55b9 Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Tue, 11 Oct 2022 10:20:57 +0200 Subject: [PATCH 6/8] removed gridz var from baseplates --- gridfinity-rebuild-baseplate.scad | 2 -- 1 file changed, 2 deletions(-) diff --git a/gridfinity-rebuild-baseplate.scad b/gridfinity-rebuild-baseplate.scad index 28a1c2e..3da6deb 100644 --- a/gridfinity-rebuild-baseplate.scad +++ b/gridfinity-rebuild-baseplate.scad @@ -17,8 +17,6 @@ $fs = 0.25; gridx = 2; // number of bases along y-axis gridy = 2; -// bin height. See bin height information and "gridz_define" below. -gridz = 6; // base unit length = 42; From b717689c32ef7e361c9db686e13410a12f9dcf6e Mon Sep 17 00:00:00 2001 From: kennetek Date: Tue, 11 Oct 2022 18:34:02 -0700 Subject: [PATCH 7/8] moved func to baseplate file, organized features functions in the utility file should be more applicable to "extension" modules, so the baseplate generation was moved to its file. Removed some constants that should be defined by already existing constants. Altered the base generator function to make an accurate model instead of using a scale. --- gridfinity-constants.scad | 29 ++++---- gridfinity-rebuild-baseplate.scad | 108 ++++++++++++++++++++++++++---- gridfinity-rebuilt-utility.scad | 77 +++------------------ 3 files changed, 119 insertions(+), 95 deletions(-) diff --git a/gridfinity-constants.scad b/gridfinity-constants.scad index 3207641..7726bf7 100644 --- a/gridfinity-constants.scad +++ b/gridfinity-constants.scad @@ -49,24 +49,9 @@ d_magic = -2*d_clear-2*d_wall+d_div; // Baseplate constants -// Baseplate top part height (weigthed=false part) -bp_h_top = 4.65; - // Baseplate bottom part height (part added with weigthed=true) bp_h_bot = 6.4; -// Baseplate z offset -bp_z_offset = 0.1; - -// Baaseplate fitting clearance -bp_clear = 0.5; - -// Baseplate countersink hole biggest diameter -bp_csink_d1 = 8.5; - -// Baseplate countersink hole height -bp_csink_h = 2.5; - // Baseplate bottom cutout rectangle size bp_cut_size = 21.4; @@ -80,4 +65,16 @@ bp_rcut_width = 8.5; bp_rcut_length = 4.25; // Baseplate bottom cutout rounded thingy depth -bp_rcut_depth = 2; \ No newline at end of file +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; diff --git a/gridfinity-rebuild-baseplate.scad b/gridfinity-rebuild-baseplate.scad index 3da6deb..e2553b9 100644 --- a/gridfinity-rebuild-baseplate.scad +++ b/gridfinity-rebuild-baseplate.scad @@ -20,25 +20,107 @@ gridy = 2; // base unit length = 42; -/* [Base] */ -style_hole = 1; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit, 4: magnet and countersunk screw holes] -// 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) -div_base_y = 0; +/* [Styles] */ -/* [Togglles] */ +// baseplate styles +style_plate = 2; // [0: thin, 1:weighted, 2:skeletonized] -// weigthed baseplate with possibility for magnet / screw holes -weigthed = true; +// enable magnet hole +style_magnet = true; + +// hole styles +style_hole = 2; // [0:none, 1:contersink, 2:counterbore] -// cutout in the bottom for weigthed baseplate only -bottom_cutout = true; // ===== Commands ===== // -color("tomato") { +color("tomato") +gridfinityBaseplate(gridx, gridy, length, style_plate, style_magnet, style_hole); - baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weigthed, bottom_cutout); +// Baseplate modules +module gridfinityBaseplate(gridx, gridy, length, sp, sm, sh) { + + off = (sp==0?0:sp==1?bp_h_bot:1+(sm?h_hole:0)+(sh==0?0:sh==1?d_cs:h_cb)); + difference() { + translate([0,0,h_base]) + mirror([0,0,1]) + rounded_rectangle(gridx*length-0.5, gridy*length-0.5, h_base+off, r_base); + + gridfinityBase(gridx, gridy, length, 1, 1, 0, 0.5, false); + + translate([0,0,h_base-0.6]) + rounded_rectangle(gridx*length*2, gridy*length*2, h_base*2, r_base); + + pattern_linear(gridx, gridy, length) { + if (sm) + block_base_hole(1); + + if (sp == 1) { + translate([0,0,-off]) + cutter_weight(); + } else if (sp == 2) { + linear_extrude(10*(h_base+off), center = true) + profile_skeleton(); + } + + if (sh == 1) { + pattern_circular(4) + translate([d_hole/2, d_hole/2, 0]) { + cylinder(r = r_hole1+d_clear, h = 10*(h_base+off), center = true); + + translate([0,0,d_cs-off]) + mirror([0,0,1]) + hull() { + cylinder(h = d_cs+10, r=r_hole1+d_clear); + translate([0,0,d_cs]) + cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs); + } + } + } else if (sh == 2) { + pattern_circular(4) + translate([d_hole/2,d_hole/2,-off]) { + cylinder(h=10*(h_base+off), r=r_hole1+d_clear, center=true); + difference() { + cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true); + copy_mirror([0,1,0]) + translate([-1.5*r_cb,r_hole1+0.1,h_cb]) + cube([r_cb*3,r_cb*3, 0.4]); + } + } + } + + } + } +} + +module cutter_weight(){ + union() { + linear_extrude(bp_cut_depth*2,center=true) + square(bp_cut_size, center=true); + pattern_circular(4) + translate([0,10,0]) + linear_extrude(bp_rcut_depth*2,center=true) + union() { + square([bp_rcut_width, bp_rcut_length], center=true); + translate([0,bp_rcut_length/2,0]) + circle(d=bp_rcut_width); + } + } +} + +module profile_skeleton() { + l = length-2*r_c2-2*r_c1; + minkowski() { + difference() { + square([l-2*r_skel+2*d_clear,l-2*r_skel+2*d_clear], center = true); + pattern_circular(4) + translate([d_hole/2,d_hole/2,0]) + minkowski() { + square([l,l]); + circle(r_hole2+r_skel+2); + } + } + circle(r_skel); + } } \ No newline at end of file diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index df782fc..0f0f9bc 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -79,7 +79,7 @@ module profile_base() { ]); } -module gridfinityBase(gx, gy, l, dx, dy, style_hole, block_scale=1, final_cut=true) { +module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) { 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)); @@ -91,15 +91,14 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, block_scale=1, final_cut=tr rounded_rectangle(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001); intersection(){ - if(final_cut) { + if (final_cut) translate([0,0,-1]) rounded_rectangle(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001); - } + render() difference() { pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l) - scale([block_scale,block_scale,1]) - block_base_solid(dbnx, dbny, l); + block_base_solid(dbnx, dbny, l, off); if (style_hole > 0) pattern_linear(gx, gy, l) @@ -108,25 +107,26 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, block_scale=1, final_cut=tr } } -module block_base_solid(dbnx, dbny, l) { +module block_base_solid(dbnx, dbny, l, o) { xx = dbnx*l-0.05; yy = dbny*l-0.05; + oo = (o/2)*(sqrt(2)-1); translate([0,0,h_base]) mirror([0,0,1]) union() { hull() { - rounded_rectangle(xx-2*r_c2-2*r_c1,yy-2*r_c2-2*r_c1, h_base, r_fo3/2); - rounded_rectangle(xx-2*r_c2, yy-2*r_c2, h_base-r_c1, r_fo2/2); + rounded_rectangle(xx-2*r_c2-2*r_c1+o,yy-2*r_c2-2*r_c1+o, h_base+oo, r_fo3/2); + rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o, h_base-r_c1+oo, r_fo2/2); } hull() { - rounded_rectangle(xx-2*r_c2, yy-2*r_c2,r_c2, r_fo2/2); + rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o,r_c2+oo, r_fo2/2); mirror([0,0,1]) - rounded_rectangle(xx, yy, h_bot/2, r_fo1/2); + rounded_rectangle(xx+o, yy+o, h_bot/2+oo, r_fo1/2); } } } -module block_base_hole(style_hole, cs_z=0) { +module block_base_hole(style_hole) { pattern_circular(4) translate([d_hole/2, d_hole/2, 0]) union() { @@ -140,11 +140,6 @@ module block_base_hole(style_hole, cs_z=0) { } if (style_hole > 1) cylinder(h = 3*h_base, r = r_hole1, center=true); - - if (style_hole == 4 && cs_z != 0) - translate([0,0,cs_z]) - cylinder(bp_csink_h, d2=bp_csink_d1, r1=r_hole1); - } } @@ -385,56 +380,6 @@ module profile_cutter_tab(h, tab, ang) { } -// Baseplate modules -module baseplate(gridx, gridy, length, div_base_x, div_base_y, style_hole, weighted, bottom_cutout) { - - scale_factor = (bp_clear / (length /100)) /100 + 1; - - union() { - difference(){ - rounded_rectangle(gridx*length, gridy*length, bp_h_top + bp_z_offset - 0.001, r_base); - translate([0,0,-bp_z_offset]) - - gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, 0, scale_factor, false); - } - - if(weighted) { - difference() { - translate([0,0,-1*(bp_h_bot - bp_clear)]) - rounded_rectangle(gridx*length, gridy*length, bp_h_bot, r_base); - - pattern_linear(gridx, gridy, length) - union() { - if (style_hole != 0) { - rotate([180,0,0]) - block_base_hole(style_hole, bp_h_bot - bp_z_offset - bp_csink_h); - } - - if (bottom_cutout) { - translate([0,0,-1*(bp_h_bot + bp_z_offset)]) - bottom_cutout(); - } - } - } - } - } -} - -module bottom_cutout(){ - union() { - linear_extrude(bp_cut_depth) - square(bp_cut_size, center=true); - pattern_circular(4) - translate([0,10,0]) - linear_extrude(bp_rcut_depth) - union() { - square([bp_rcut_width, bp_rcut_length], center=true); - translate([0,bp_rcut_length/2,0]) - circle(d=bp_rcut_width); - } - } -} - // ==== Utilities ===== function clp(x,a,b) = min(max(x,a),b); From 12e1b6c9454c9de793c83a1cafcf174630e5ba4d Mon Sep 17 00:00:00 2001 From: kennetek Date: Tue, 11 Oct 2022 19:05:18 -0700 Subject: [PATCH 8/8] separated out modules, added additional length people had requested being able to have spacers at the edges so the baseplates would with their drawers, so I added that --- gridfinity-constants.scad | 3 + gridfinity-rebuild-baseplate.scad | 101 ++++++++++++++++++------------ 2 files changed, 63 insertions(+), 41 deletions(-) diff --git a/gridfinity-constants.scad b/gridfinity-constants.scad index 7726bf7..1c50d20 100644 --- a/gridfinity-constants.scad +++ b/gridfinity-constants.scad @@ -78,3 +78,6 @@ r_cb = 2.75; // baseplate counterbore depth h_cb = 3; + +// minimum baseplate thickness (when skeletonized) +h_skel = 1; diff --git a/gridfinity-rebuild-baseplate.scad b/gridfinity-rebuild-baseplate.scad index e2553b9..4e82d98 100644 --- a/gridfinity-rebuild-baseplate.scad +++ b/gridfinity-rebuild-baseplate.scad @@ -20,76 +20,67 @@ gridy = 2; // base unit length = 42; +/* [Fit to Drawer] */ +// minimum length of baseplate along x (leave zero to ignore, will automatically fill area if gridx is zero) +distancex = 0; +// minimum length of baseplate along y (leave zero to ignore, will automatically fill area if gridy is zero) +distancey = 0; + /* [Styles] */ // baseplate styles -style_plate = 2; // [0: thin, 1:weighted, 2:skeletonized] +style_plate = 1; // [0: thin, 1:weighted, 2:skeletonized] // enable magnet hole -style_magnet = true; +enable_magnet = true; // hole styles -style_hole = 2; // [0:none, 1:contersink, 2:counterbore] +style_hole = 1; // [0:none, 1:contersink, 2:counterbore] // ===== Commands ===== // color("tomato") -gridfinityBaseplate(gridx, gridy, length, style_plate, style_magnet, style_hole); +gridfinityBaseplate(gridx, gridy, length, distancex, distancey, style_plate, enable_magnet, style_hole); -// Baseplate modules -module gridfinityBaseplate(gridx, gridy, length, sp, sm, sh) { + + +// ===== Construction ===== // + +module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { - off = (sp==0?0:sp==1?bp_h_bot:1+(sm?h_hole:0)+(sh==0?0:sh==1?d_cs:h_cb)); + assert(gridx > 0 || dx > 0, "Must have positive x grid amount!"); + assert(gridy > 0 || dy > 0, "Must have positive y grid amount!"); + gx = gridx == 0 ? floor(dix/length) : gridx; + gy = gridy == 0 ? floor(diy/length) : gridy; + dx = max(gx*length-0.5, dix); + dy = max(gy*length-0.5, diy); + off = (sp==0?0:sp==1?bp_h_bot:h_skel+(sm?h_hole:0)+(sh==0?0:sh==1?d_cs:h_cb)); difference() { translate([0,0,h_base]) mirror([0,0,1]) - rounded_rectangle(gridx*length-0.5, gridy*length-0.5, h_base+off, r_base); + rounded_rectangle(dx, dy, h_base+off, r_base); - gridfinityBase(gridx, gridy, length, 1, 1, 0, 0.5, false); + gridfinityBase(gx, gy, length, 1, 1, 0, 0.5, false); translate([0,0,h_base-0.6]) - rounded_rectangle(gridx*length*2, gridy*length*2, h_base*2, r_base); + rounded_rectangle(dx*2, dy*2, h_base*2, r_base); - pattern_linear(gridx, gridy, length) { - if (sm) - block_base_hole(1); + pattern_linear(gx, gy, length) { + if (sm) block_base_hole(1); - if (sp == 1) { + if (sp == 1) translate([0,0,-off]) cutter_weight(); - } else if (sp == 2) { + else if (sp == 2) linear_extrude(10*(h_base+off), center = true) profile_skeleton(); - } - if (sh == 1) { - pattern_circular(4) - translate([d_hole/2, d_hole/2, 0]) { - cylinder(r = r_hole1+d_clear, h = 10*(h_base+off), center = true); - - translate([0,0,d_cs-off]) - mirror([0,0,1]) - hull() { - cylinder(h = d_cs+10, r=r_hole1+d_clear); - translate([0,0,d_cs]) - cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs); - } - } - } else if (sh == 2) { - pattern_circular(4) - translate([d_hole/2,d_hole/2,-off]) { - cylinder(h=10*(h_base+off), r=r_hole1+d_clear, center=true); - difference() { - cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true); - copy_mirror([0,1,0]) - translate([-1.5*r_cb,r_hole1+0.1,h_cb]) - cube([r_cb*3,r_cb*3, 0.4]); - } - } + translate([0,0,-off]) { + if (sh == 1) cutter_countersink(); + else if (sh == 2) cutter_counterbore(); } - } } } @@ -109,6 +100,34 @@ module cutter_weight(){ } } +module cutter_countersink() { + pattern_circular(4) + translate([d_hole/2, d_hole/2, 0]) { + cylinder(r = r_hole1+d_clear, h = 100*h_base, center = true); + + translate([0,0,d_cs]) + mirror([0,0,1]) + hull() { + cylinder(h = d_cs+10, r=r_hole1+d_clear); + translate([0,0,d_cs]) + cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs); + } + } +} + +module cutter_counterbore() { + pattern_circular(4) + translate([d_hole/2,d_hole/2,0]) { + cylinder(h=100*h_base, r=r_hole1+d_clear, center=true); + difference() { + cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true); + copy_mirror([0,1,0]) + translate([-1.5*r_cb,r_hole1+0.1,h_cb]) + cube([r_cb*3,r_cb*3, 0.4]); + } + } +} + module profile_skeleton() { l = length-2*r_c2-2*r_c1; minkowski() {