diff --git a/gridfinity-constants.scad b/gridfinity-constants.scad index a6143d7..1c50d20 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 bottom part height (part added with weigthed=true) +bp_h_bot = 6.4; + +// 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; + +// 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; + +// minimum baseplate thickness (when skeletonized) +h_skel = 1; diff --git a/gridfinity-rebuild-baseplate.scad b/gridfinity-rebuild-baseplate.scad new file mode 100644 index 0000000..4e82d98 --- /dev/null +++ b/gridfinity-rebuild-baseplate.scad @@ -0,0 +1,145 @@ +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; +// 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 = 1; // [0: thin, 1:weighted, 2:skeletonized] + +// enable magnet hole +enable_magnet = true; + +// hole styles +style_hole = 1; // [0:none, 1:contersink, 2:counterbore] + + +// ===== Commands ===== // + +color("tomato") +gridfinityBaseplate(gridx, gridy, length, distancex, distancey, style_plate, enable_magnet, style_hole); + + + +// ===== Construction ===== // + +module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { + + 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(dx, dy, h_base+off, r_base); + + gridfinityBase(gx, gy, length, 1, 1, 0, 0.5, false); + + translate([0,0,h_base-0.6]) + rounded_rectangle(dx*2, dy*2, h_base*2, r_base); + + pattern_linear(gx, gy, 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(); + + translate([0,0,-off]) { + if (sh == 1) cutter_countersink(); + else if (sh == 2) cutter_counterbore(); + } + } + } +} + +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 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() { + 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 73493c8..c7c611c 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, 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,13 +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) - block_base_solid(dbnx, dbny, l); + block_base_solid(dbnx, dbny, l, off); if (style_hole > 0) pattern_linear(gx, gy, l) @@ -106,20 +107,21 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole) { } } -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); } } }