From 754f7ec965782b777f628e5cbf4495b9d5dc5b7d Mon Sep 17 00:00:00 2001 From: kennetek Date: Sat, 1 Oct 2022 13:13:51 -0700 Subject: [PATCH] bases can be divided gridx and gridy can be real numbers, and the bases can be divided so maintain symmetry. --- gridfinity-rebuilt-base.scad | 77 ++++++++++++++++++++++-------------- gridfinity-rebuilt.scad | 10 ++++- 2 files changed, 56 insertions(+), 31 deletions(-) diff --git a/gridfinity-rebuilt-base.scad b/gridfinity-rebuilt-base.scad index b0f813f..a83acc1 100644 --- a/gridfinity-rebuilt-base.scad +++ b/gridfinity-rebuilt-base.scad @@ -134,41 +134,52 @@ module block_base() { intersection(){ translate([0,0,-1]) rounded_rectangle(gridx*length-0.5+0.005, gridy*length-0.5+0.005, h_base+h_bot/2*10, r_fo1/2+0.001); - pattern_linear(gridx, gridy, length) + render() difference() { - translate([0,0,h_base]) - mirror([0,0,1]) - union() { - hull() { - rounded_square(length-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2); - rounded_square(length-0.05-2*r_c2, h_base-r_c1, r_fo2/2); - } - hull() { - rounded_square(length-0.05-2*r_c2, r_c2, r_fo2/2); - mirror([0,0,1]) - rounded_square(length-0.05, h_bot/2, r_fo1/2); - } - } + pattern_linear2(gridx/divbasex, gridy/divbasey, divbasex*length, divbasey*length) + block_base_solid(); + if (enable_holes) - pattern_circular(4) - translate([d_hole/2, d_hole/2, 0]) { - union() { - difference() { - cylinder(h = 2*(h_hole+(enable_hole_slit?0.2:0)), r = r_hole2, center=true); - if (enable_hole_slit) - copy_mirror([0,1,0]) - translate([-1.5*r_hole2,r_hole1+0.1,h_hole]) - cube([r_hole2*3,r_hole2*3, 0.4]); - } - cylinder(h = 3*h_base, r = r_hole1, center=true); - } - } + pattern_linear(gridx,gridy,length) + block_base_hole(); } } } +module block_base_solid() { + translate([0,0,h_base]) + mirror([0,0,1]) + union() { + hull() { + rounded_rectangle(divbasex*length-0.05-2*r_c2-2*r_c1,divbasey*length-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2); + rounded_rectangle(divbasex*length-0.05-2*r_c2, divbasey*length-0.05-2*r_c2, h_base-r_c1, r_fo2/2); + } + hull() { + rounded_rectangle(divbasex*length-0.05-2*r_c2, divbasey*length-0.05-2*r_c2,r_c2, r_fo2/2); + mirror([0,0,1]) + rounded_rectangle(divbasex*length-0.05, divbasey*length-0.05, h_bot/2, r_fo1/2); + } + } +} + +module block_base_hole() { + pattern_circular(4) + translate([d_hole/2, d_hole/2, 0]) { + union() { + difference() { + cylinder(h = 2*(h_hole+(enable_hole_slit?0.2:0)), r = r_hole2, center=true); + if (enable_hole_slit) + copy_mirror([0,1,0]) + translate([-1.5*r_hole2,r_hole1+0.1,h_hole]) + cube([r_hole2*3,r_hole2*3, 0.4]); + } + cylinder(h = 3*h_base, r = r_hole1, center=true); + } + } +} + module profile_wall_sub_sub() { polygon([ [0,0], @@ -429,12 +440,20 @@ module copy_mirror(vec=[0,1,0]) { module pattern_linear(x = 1, y = 1, spacing = 0) { translate([-(x-1)*spacing/2,-(y-1)*spacing/2,0]) - for (i = [1:x]) - for (j = [1:y]) + for (i = [1:ceil(x)]) + for (j = [1:ceil(y)]) translate([(i-1)*spacing,(j-1)*spacing,0]) children(); } +module pattern_linear2(x = 1, y = 1, xs = 0, ys = 0) { + translate([-(x-1)*xs/2,-(y-1)*ys/2,0]) + for (i = [1:ceil(x)]) + for (j = [1:ceil(y)]) + translate([(i-1)*xs,(j-1)*ys,0]) + children(); +} + module pattern_circular(n=2) { for (i = [1:n]) rotate(i*360/n) diff --git a/gridfinity-rebuilt.scad b/gridfinity-rebuilt.scad index 902481c..158b90a 100644 --- a/gridfinity-rebuilt.scad +++ b/gridfinity-rebuilt.scad @@ -27,9 +27,9 @@ $fs = 0.25; /* [General Settings] */ // number of bases along x-axis -gridx = 1; +gridx = 2; // number of bases along y-axis -gridy = 1; +gridy = 2; // bin height. See bin height information and "gridz_define" below. gridz = 6; // base unit @@ -63,6 +63,12 @@ tab_style = 0; //[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; +/* [Test] */ +// multiplier for bases along X axis. For example, if you wanted a gridx of 1.5, setting this to 0.5 would get you 3 bases divided along X that are compatible with the provided length. (default: 1, intended to work between 0 and 1) +divbasex = 1; +// multiplier for bases along Y axis. For example, if you wanted a gridy of 1.5, setting this to 0.5 would get you 3 bases divided along Y that are compatible with the provided length. (default: 1, intended to work between 0 and 1) +divbasey = 1; + // ===== Commands ===== // color("tomato")