bases can be divided

gridx and gridy can be real numbers, and the bases can be divided so maintain symmetry.
This commit is contained in:
kennetek 2022-10-01 13:13:51 -07:00
parent cd0b93b5ac
commit 754f7ec965
2 changed files with 56 additions and 31 deletions

View file

@ -134,24 +134,37 @@ module block_base() {
intersection(){ intersection(){
translate([0,0,-1]) 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); 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() render()
difference() { difference() {
pattern_linear2(gridx/divbasex, gridy/divbasey, divbasex*length, divbasey*length)
block_base_solid();
if (enable_holes)
pattern_linear(gridx,gridy,length)
block_base_hole();
}
}
}
module block_base_solid() {
translate([0,0,h_base]) translate([0,0,h_base])
mirror([0,0,1]) mirror([0,0,1])
union() { union() {
hull() { hull() {
rounded_square(length-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2); 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_square(length-0.05-2*r_c2, h_base-r_c1, r_fo2/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() { hull() {
rounded_square(length-0.05-2*r_c2, r_c2, r_fo2/2); 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]) mirror([0,0,1])
rounded_square(length-0.05, h_bot/2, r_fo1/2); rounded_rectangle(divbasex*length-0.05, divbasey*length-0.05, h_bot/2, r_fo1/2);
} }
} }
}
if (enable_holes) module block_base_hole() {
pattern_circular(4) pattern_circular(4)
translate([d_hole/2, d_hole/2, 0]) { translate([d_hole/2, d_hole/2, 0]) {
union() { union() {
@ -165,8 +178,6 @@ module block_base() {
cylinder(h = 3*h_base, r = r_hole1, center=true); cylinder(h = 3*h_base, r = r_hole1, center=true);
} }
} }
}
}
} }
module profile_wall_sub_sub() { module profile_wall_sub_sub() {
@ -429,12 +440,20 @@ module copy_mirror(vec=[0,1,0]) {
module pattern_linear(x = 1, y = 1, spacing = 0) { module pattern_linear(x = 1, y = 1, spacing = 0) {
translate([-(x-1)*spacing/2,-(y-1)*spacing/2,0]) translate([-(x-1)*spacing/2,-(y-1)*spacing/2,0])
for (i = [1:x]) for (i = [1:ceil(x)])
for (j = [1:y]) for (j = [1:ceil(y)])
translate([(i-1)*spacing,(j-1)*spacing,0]) translate([(i-1)*spacing,(j-1)*spacing,0])
children(); 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) { module pattern_circular(n=2) {
for (i = [1:n]) for (i = [1:n])
rotate(i*360/n) rotate(i*360/n)

View file

@ -27,9 +27,9 @@ $fs = 0.25;
/* [General Settings] */ /* [General Settings] */
// number of bases along x-axis // number of bases along x-axis
gridx = 1; gridx = 2;
// number of bases along y-axis // number of bases along y-axis
gridy = 1; gridy = 2;
// bin height. See bin height information and "gridz_define" below. // bin height. See bin height information and "gridz_define" below.
gridz = 6; gridz = 6;
// base unit // 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 // overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm
height_internal = 0; 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 ===== // // ===== Commands ===== //
color("tomato") color("tomato")