move length to constants file

This commit is contained in:
Ruud Swinkels 2023-05-31 17:46:30 +02:00
parent 812771eb4c
commit 99100b6600
6 changed files with 87 additions and 92 deletions

View file

@ -15,6 +15,8 @@ r_fo1 = 8.5;
r_fo2 = 3.2;
// outside radii 3
r_fo3 = 1.6;
// length of a grid unit
l_grid = 42;
// screw hole radius
r_hole1 = 1.5;

View file

@ -1,4 +1,5 @@
include <gridfinity-rebuilt-utility.scad>
include <gridfinity-constants.scad>
// ===== INFORMATION ===== //
/*
@ -19,8 +20,6 @@ $fs = 0.25;
gridx = 5;
// number of bases along y-axis
gridy = 5;
// base unit
length = 42;
/* [Screw Together Settings - Defaults work for M3 and 4-40] */
// screw diameter
@ -34,9 +33,9 @@ n_screws = 1; // [1:3]
/* [Fit to Drawer] */
// minimum length of baseplate along x (leave zero to ignore, will automatically fill area if gridx is zero)
// minimum l_grid 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)
// minimum l_grid of baseplate along y (leave zero to ignore, will automatically fill area if gridy is zero)
distancey = 0;
// where to align extra space along x
@ -61,7 +60,7 @@ style_hole = 2; // [0:none, 1:contersink, 2:counterbore]
screw_together = (style_plate == 3 || style_plate == 4);
color("tomato")
gridfinityBaseplate(gridx, gridy, length, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
// ===== CONSTRUCTION ===== //
@ -143,15 +142,15 @@ module cutter_weight() {
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])
square([bp_rcut_width, bp_rcut_l_grid], center=true);
translate([0,bp_rcut_l_grid/2,0])
circle(d=bp_rcut_width);
}
}
}
module hole_pattern(){
pattern_circular(4)
translate([length/2-d_hole_from_side, length/2-d_hole_from_side, 0]) {
translate([l_grid/2-d_hole_from_side, l_grid/2-d_hole_from_side, 0]) {
render();
children();
}
@ -179,12 +178,12 @@ module cutter_counterbore(){
}
module profile_skeleton() {
l = length-2*r_c2-2*r_c1;
l = l_grid-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([length/2-d_hole_from_side,length/2-d_hole_from_side,0])
translate([l_grid/2-d_hole_from_side,l_grid/2-d_hole_from_side,0])
minkowski() {
square([l,l]);
circle(r_hole2+r_skel+2);
@ -202,10 +201,10 @@ module cutter_screw_together(gx, gy, off) {
module screw(a, b) {
copy_mirror([1,0,0])
translate([a*length/2, 0, -off/2])
pattern_linear(1, b, 1, length)
translate([a*l_grid/2, 0, -off/2])
pattern_linear(1, b, 1, l_grid)
pattern_linear(1, n_screws, 1, d_screw_head + screw_spacing)
rotate([0,90,0])
cylinder(h=length/2, d=d_screw, center = true);
cylinder(h=l_grid/2, d=d_screw, center = true);
}
}

View file

@ -34,8 +34,6 @@ gridx = 5;
gridy = 5;
// bin height. See bin height information and "gridz_define" below.
gridz = 6;
// base unit
length = 42;
/* [Compartments] */
// number of X Divisions (set to zero to have solid bin)
@ -73,12 +71,12 @@ div_base_y = 0;
// ===== IMPLEMENTATION ===== //
color("tomato") {
gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal, length) {
gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), height_internal) {
if (divx > 0 && divy > 0)
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*(style_corners?p_corn:1));
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole*(style_corners?p_corn:1));
}

View file

@ -21,8 +21,6 @@ gridx = 3;
gridy = 3;
// bin height. See bin height information and "gridz_define" below.
gridz = 6;
// base unit
length = 42;
/* [Compartments] */
// number of X Divisions
@ -58,7 +56,7 @@ bottom_layer = 1;
// Input all the cutter types in here
color("tomato")
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole) {
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, l_grid, div_base_x, div_base_y, style_hole) {
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = 0);
}

View file

@ -23,7 +23,7 @@ module cutEqual(n_divx=1, n_divy=1, style_tab=1, scoop_weight=1) {
}
// initialize gridfinity
module gridfinityInit(gx, gy, h, h0 = 0, l) {
module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid) {
$gxx = gx;
$gyy = gy;
$dh = h;
@ -192,7 +192,7 @@ module profile_wall() {
}
// remove any negtive geometry in edge cases
mirror([0,1,0])
square(100*length);
square(100*l_grid);
}
}
@ -215,8 +215,8 @@ module block_bottom( h = 2.2, gx, gy, l ) {
}
module cut_move_unsafe(x, y, w, h) {
xx = ($gxx*length+d_magic);
yy = ($gyy*length+d_magic);
xx = ($gxx*l_grid+d_magic);
yy = ($gyy*l_grid+d_magic);
translate([(x)*xx/$gxx,(y)*yy/$gyy,0])
translate([(-xx+d_div)/2,(-yy+d_div)/2,0])
translate([(w*xx/$gxx-d_div)/2,(h*yy/$gyy-d_div)/2,0])
@ -238,8 +238,8 @@ module block_cutter(x,y,w,h,t,s) {
xcutlast = abs(x+w-$gxx)<0.001 && style_lip == 0;
zsmall = ($dh+h_base)/7 < 3;
ylen = h*($gyy*length+d_magic)/$gyy-d_div;
xlen = w*($gxx*length+d_magic)/$gxx-d_div;
ylen = h*($gyy*l_grid+d_magic)/$gyy-d_div;
xlen = w*($gxx*l_grid+d_magic)/$gxx-d_div;
height = $dh;
extent = (abs(s) > 0 && ycutfirst ? d_wall2-d_wall-d_clear : 0);

View file

@ -32,8 +32,6 @@ gridx = 1;
gridy = 1;
// bin height. See bin height information and "gridz_define" below.
gridz = 6;
// base unit
length = 42;
// number of compartments along x-axis
n_divx = 2;
@ -76,20 +74,20 @@ else gridfinityVase(); // Generate the bin
// ===== CONSTRUCTION ===== //
d_bottom = layer*(max(bottom_layer,1));
x_l = length/2;
x_l = l_grid/2;
dht = (gridz_define==0)?gridz*7 : (gridz_define==1)?h_bot+gridz+h_base : gridz-(enable_lip?3.8:0);
d_height = (enable_zsnap?((abs(dht)%7==0)?dht:dht+7-abs(dht)%7):dht)-h_base;
f2c = sqrt(2)*(sqrt(2)-1); // fillet to chamfer ratio
me = ((gridx*length-0.5)/n_divx)-nozzle*4-r_fo1-12.7-4;
me = ((gridx*l_grid-0.5)/n_divx)-nozzle*4-r_fo1-12.7-4;
m = min(d_tabw/1.8 + max(0,me), d_tabw/1.25);
d_ramp = f2c*(length*((d_height-2)/7+1)/12-r_f2)+d_wall2;
d_edge = ((gridx*length-0.5)/n_divx-d_tabw-r_fo1)/2;
d_ramp = f2c*(l_grid*((d_height-2)/7+1)/12-r_f2)+d_wall2;
d_edge = ((gridx*l_grid-0.5)/n_divx-d_tabw-r_fo1)/2;
n_st = gridz <= 3 ? 6 : d_edge < 2 && style_tab != 0 && style_tab != 6 ? 1 : style_tab == 1 && n_divx <= 1? 0 : style_tab;
n_x = (n_st==0?1:n_divx);
spacing = (gridx*length-0.5)/(n_divx);
spacing = (gridx*l_grid-0.5)/(n_divx);
shift = n_st==3?-1:n_st==5?1:0;
shiftauto = function (a,b) n_st!=2?0:a==1?-1:a==b?1:0;
@ -110,39 +108,39 @@ module gridfinityVase() {
if (n_st != 6)
transform_style()
transform_vtab_base((n_st<2?gridx*length/n_x-0.5-r_fo1:d_tabw)-nozzle*4)
transform_vtab_base((n_st<2?gridx*l_grid/n_x-0.5-r_fo1:d_tabw)-nozzle*4)
block_tab_base(-nozzle*sqrt(2));
}
if (enable_scoop_chamfer)
intersection() {
block_vase();
translate([0,gridy*length/2-0.25-d_wall2/2,d_height/2+0.1])
cube([gridx*length,d_wall2,d_height-0.2],center=true);
translate([0,gridy*l_grid/2-0.25-d_wall2/2,d_height/2+0.1])
cube([gridx*l_grid,d_wall2,d_height-0.2],center=true);
}
if (enable_funnel && gridz > 3)
pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*length-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1))
pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*l_grid-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1))
transform_funnel()
block_funnel_outside();
if (n_divx > 1)
pattern_linear(n_divx-1,1,(gridx*length-0.5)/(n_divx))
pattern_linear(n_divx-1,1,(gridx*l_grid-0.5)/(n_divx))
block_divider();
if (n_divx < 1)
pattern_linear(n_st == 0 ? n_divx>1 ? n_divx-1 : gridx-1 : 1, 1, (gridx*length-r_fo1)/((n_divx>1 ? n_divx : gridx)))
pattern_linear(n_st == 0 ? n_divx>1 ? n_divx-1 : gridx-1 : 1, 1, (gridx*l_grid-r_fo1)/((n_divx>1 ? n_divx : gridx)))
block_tabsupport();
}
if (enable_funnel && gridz > 3)
pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*length-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1))
pattern_linear((n_st==0?n_divx>1?n_divx:gridx:1), 1, (gridx*l_grid-r_fo1)/(n_st==0?n_divx>1?n_divx:gridx:1))
transform_funnel()
block_funnel_inside();
if (!enable_lip)
translate([0,0,1.5*d_height])
cube([gridx*length,gridy*length,d_height], center=true);
cube([gridx*l_grid,gridy*l_grid,d_height], center=true);
block_x();
block_inset();
@ -151,7 +149,7 @@ module gridfinityVase() {
if (bottom_layer <= 0)
translate([0,0,-50+layer+0.01])
cube([gridx*length*10,gridy*length*10,100], center=true);
cube([gridx*l_grid*10,gridy*l_grid*10,100], center=true);
}
}
@ -162,18 +160,18 @@ module gridfinityBaseVase() {
intersection() {
block_base_blank(0);
translate([0,0,-h_base-1])
rounded_rectangle(length-0.5-0.005, length-0.5-0.005, h_base*10, r_fo1/2+0.001);
rounded_rectangle(l_grid-0.5-0.005, l_grid-0.5-0.005, h_base*10, r_fo1/2+0.001);
}
translate([0,0,0.01])
difference() {
block_base_blank(nozzle*4);
translate([0,0,-h_base])
cube([length*2,length*2,d_bottom*2],center=true);
cube([l_grid*2,l_grid*2,d_bottom*2],center=true);
}
// magic slice
rotate([0,0,90])
translate([0,0,-h_base+d_bottom+0.01])
cube([0.001,length*gridx,d_height+d_bottom*2]);
cube([0.001,l_grid*gridx,d_height+d_bottom*2]);
}
@ -181,7 +179,7 @@ module gridfinityBaseVase() {
intersection() {
rotate([0,0,45])
translate([-nozzle,3,-h_base+d_bottom+0.01])
cube([nozzle*2,length*gridx,d_height+d_bottom*2]);
cube([nozzle*2,l_grid*gridx,d_height+d_bottom*2]);
block_base_blank(nozzle*4-0.1);
}
@ -194,7 +192,7 @@ module gridfinityBaseVase() {
block_magnet_blank(0, false);
translate([0,0,h_base/2])
cube([length*2, length*2, h_base], center = true);
cube([l_grid*2, l_grid*2, h_base], center = true);
}
if (style_base != 4)
@ -218,19 +216,19 @@ module block_magnet_blank(o = 0, half = true) {
module block_base_blank(o = 0) {
mirror([0,0,1]) {
hull() {
rounded_square(length-o-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2);
rounded_square(length-o-0.05-2*r_c2, h_base-r_c1, r_fo2/2);
rounded_square(l_grid-o-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2);
rounded_square(l_grid-o-0.05-2*r_c2, h_base-r_c1, r_fo2/2);
}
hull() {
rounded_square(length-o-0.05-2*r_c2, r_c2, r_fo2/2);
rounded_square(l_grid-o-0.05-2*r_c2, r_c2, r_fo2/2);
mirror([0,0,1])
rounded_square(length-o-0.05, d_bottom, r_fo1/2);
rounded_square(l_grid-o-0.05, d_bottom, r_fo1/2);
}
}
}
module block_pinch() {
sweep_rounded(gridx*length-2*r_base-0.5-0.001, gridy*length-2*r_base-0.5-0.001)
sweep_rounded(gridx*l_grid-2*r_base-0.5-0.001, gridy*l_grid-2*r_base-0.5-0.001)
translate([r_base,0,0])
mirror([1,0,0])
translate([0,-(-d_height-h_base/2+r_c1),0])
@ -257,9 +255,9 @@ module block_tabsupport() {
translate([0,0,0.1])
block_vase(d_height*4);
cube([nozzle*2, gridy*length, d_height*3], center=true);
cube([nozzle*2, gridy*l_grid, d_height*3], center=true);
transform_vtab_base(gridx*length*2)
transform_vtab_base(gridx*l_grid*2)
block_tab_base(-nozzle*sqrt(2));
}
}
@ -269,21 +267,21 @@ module block_divider() {
intersection() {
translate([0,0,0.1])
block_vase();
cube([nozzle*2, gridy*length, d_height*2], center=true);
cube([nozzle*2, gridy*l_grid, d_height*2], center=true);
}
if (n_st == 0) block_tab(0.1);
else block_divider_edgecut();
// cut divider clearance on negative Y side
translate([-gridx*length/2,-(gridy*length/2-0.25),0])
cube([gridx*length,nozzle*2+0.1,d_height*2]);
translate([-gridx*l_grid/2,-(gridy*l_grid/2-0.25),0])
cube([gridx*l_grid,nozzle*2+0.1,d_height*2]);
// cut divider clearance on positive Y side
mirror([0,1,0])
if (enable_scoop_chamfer)
translate([-gridx*length/2,-(gridy*length/2-0.25),0])
cube([gridx*length,d_wall2+0.1,d_height*2]);
translate([-gridx*l_grid/2,-(gridy*l_grid/2-0.25),0])
cube([gridx*l_grid,d_wall2+0.1,d_height*2]);
else block_divider_edgecut();
// cut divider to have clearance with scoop
@ -304,25 +302,25 @@ module block_divider() {
if (2*i*layer < d_height-layer/2-d_bottom-0.1)
mirror([0,1,0])
translate([0,(gridy*length/2-0.25-nozzle)/2,layer/2+d_bottom+2*i*layer])
cube([nozzle*2-0.01,gridy*length/2-0.25-nozzle,layer],center=true);
translate([0,(gridy*l_grid/2-0.25-nozzle)/2,layer/2+d_bottom+2*i*layer])
cube([nozzle*2-0.01,gridy*l_grid/2-0.25-nozzle,layer],center=true);
if ((2*i+1)*layer < d_height-layer/2-d_bottom-0.1)
translate([0,(gridy*length/2-0.25-nozzle)/2,layer/2+d_bottom+(2*i+1)*layer])
cube([nozzle*2-0.01,gridy*length/2-0.25-nozzle,layer],center=true);
translate([0,(gridy*l_grid/2-0.25-nozzle)/2,layer/2+d_bottom+(2*i+1)*layer])
cube([nozzle*2-0.01,gridy*l_grid/2-0.25-nozzle,layer],center=true);
}
// divider slices cut to tabs
if (n_st == 0)
transform_style()
transform_vtab_base((n_st<2?gridx*length/n_x-0.5-r_fo1:d_tabw)-nozzle*4)
transform_vtab_base((n_st<2?gridx*l_grid/n_x-0.5-r_fo1:d_tabw)-nozzle*4)
block_tab_base(-nozzle*sqrt(2));
}
}
module block_divider_edgecut() {
translate([-50,-gridy*length/2+0.25,0])
translate([-50,-gridy*l_grid/2+0.25,0])
rotate([90,0,90])
linear_extrude(100)
offset(delta = 0.1)
@ -359,9 +357,9 @@ module block_vase_base() {
translate([0,0,-h_base]) {
translate([0,0,-0.1])
color("firebrick")
block_bottom(d_bottom, gridx, gridy, length);
block_bottom(d_bottom, gridx, gridy, l_grid);
color("royalblue")
block_wall(gridx, gridy, length) {
block_wall(gridx, gridy, l_grid) {
if (enable_lip) profile_wall();
else profile_wall2();
}
@ -371,7 +369,7 @@ module block_vase_base() {
rotate([0,0,90])
mirror([0,1,0])
translate([0,0,d_bottom+0.001])
cube([0.001,length*gridx,d_height+d_bottom*2]);
cube([0.001,l_grid*gridx,d_height+d_bottom*2]);
}
// scoop piece
@ -392,7 +390,7 @@ module block_vase_base() {
translate([shiftauto(i,n_x)*d_edge + shift*d_edge,0,0])
intersection() {
block_vase();
transform_vtab_base(n_st<2?gridx*length/n_x-0.5-r_fo1:d_tabw)
transform_vtab_base(n_st<2?gridx*l_grid/n_x-0.5-r_fo1:d_tabw)
profile_tab();
}
}
@ -409,7 +407,7 @@ module profile_wall_sub_sub() {
}
module block_inset() {
ixx = (gridx*length-0.5)/2;
ixx = (gridx*l_grid-0.5)/2;
iyy = d_height/1.875;
izz = sqrt(ixx^2+iyy^2)*tan(40);
if (enable_scoop_chamfer && enable_inset)
@ -417,7 +415,7 @@ module block_inset() {
intersection() {
rotate([0,90,0])
translate([-iyy,0,0])
block_inset_sub(iyy, gridx*length, 45);
block_inset_sub(iyy, gridx*l_grid, 45);
rotate([0,90,0])
translate([-iyy,0,0])
@ -426,13 +424,13 @@ module block_inset() {
}
mirror([0,1,0])
translate([-gridx*length/2,-(gridy*length-0.5)/2+d_wall2-2*nozzle,0])
cube([gridx*length,izz,d_height*2]);
translate([-gridx*l_grid/2,-(gridy*l_grid-0.5)/2+d_wall2-2*nozzle,0])
cube([gridx*l_grid,izz,d_height*2]);
}
}
module block_inset_sub(x, y, ang) {
translate([0,(gridy*length-0.5)/2+r_fo1/2,0])
translate([0,(gridy*l_grid-0.5)/2+r_fo1/2,0])
mirror([0,1,0])
linear_extrude(y,center=true)
polygon([[-x,0],[x,0],[0,x*tan(ang)]]);
@ -447,11 +445,11 @@ module transform_style() {
}
module block_flushscoop() {
translate([0,gridy*length/2-d_wall2-nozzle/2-1,d_height/2])
translate([0,gridy*l_grid/2-d_wall2-nozzle/2-1,d_height/2])
linear_extrude(d_height)
union() {
copy_mirror([1,0,0])
polygon([[0,0],[gridx*length/2-r_fo1/2,0],[gridx*length/2-r_fo1/2,1],[gridx*length/2-r_fo1/2-r_c1*5,d_wall2-nozzle*2+1],[0,d_wall2-nozzle*2+1]]);
polygon([[0,0],[gridx*l_grid/2-r_fo1/2,0],[gridx*l_grid/2-r_fo1/2,1],[gridx*l_grid/2-r_fo1/2-r_c1*5,d_wall2-nozzle*2+1],[0,d_wall2-nozzle*2+1]]);
}
transform_scoop()
@ -470,27 +468,27 @@ module profile_tabscoop(m) {
}
module block_tabscoop(a=m, b=0, c=0, d=-1) {
translate([0,d_tabh*cos(a_tab)-length*gridy/2+0.25+b,0])
translate([0,d_tabh*cos(a_tab)-l_grid*gridy/2+0.25+b,0])
difference() {
translate([0,0,-d_tabh*sin(a_tab)*2+d_height+2.1])
profile_tabscoop(a);
translate([-gridx*length/2,-m,-m])
cube([gridx*length,m-d_tabh*cos(a_tab)+0.005+c,d_height*20]);
translate([-gridx*l_grid/2,-m,-m])
cube([gridx*l_grid,m-d_tabh*cos(a_tab)+0.005+c,d_height*20]);
if (d >= 0)
translate([0,0,-d_tabh*sin(a_tab)+d_height+m/2+d+2.1])
cube([gridx*length,gridy*length,m],center=true);
cube([gridx*l_grid,gridy*l_grid,m],center=true);
}
}
module transform_vtab(a=0,b=1) {
transform_vtab_base(gridx*length/b-0.5-r_fo1+a)
transform_vtab_base(gridx*l_grid/b-0.5-r_fo1+a)
children();
}
module transform_vtab_base(a) {
translate([0,d_tabh*cos(a_tab)-length*gridy/2+0.25,-d_tabh*sin(a_tab)+d_height+2.1])
translate([0,d_tabh*cos(a_tab)-l_grid*gridy/2+0.25,-d_tabh*sin(a_tab)+d_height+2.1])
rotate([90,0,270])
linear_extrude(a, center=true)
children();
@ -506,23 +504,23 @@ module block_tab_base(del) {
union() {
profile_tab();
translate([d_tabh*cos(a_tab),-d_tabh*sin(a_tab),0])
square([length,d_tabh*sin(a_tab)*2]);
square([l_grid,d_tabh*sin(a_tab)*2]);
}
}
module transform_scoop() {
intersection() {
block_vase();
translate([0,gridy*length/2-d_ramp,layer*max(bottom_layer*1)])
translate([0,gridy*l_grid/2-d_ramp,layer*max(bottom_layer*1)])
rotate([90,0,90])
linear_extrude(2*length*gridx,center=true)
linear_extrude(2*l_grid*gridx,center=true)
children();
}
}
module block_vase(h = d_height*2) {
translate([0,0,-0.1])
rounded_rectangle(gridx*length-0.5-nozzle, gridy*length-0.5-nozzle, h, r_base+0.01-nozzle/2);
rounded_rectangle(gridx*l_grid-0.5-nozzle, gridy*l_grid-0.5-nozzle, h, r_base+0.01-nozzle/2);
}
module profile_x(x_f = 3) {
@ -541,11 +539,11 @@ module profile_x(x_f = 3) {
}
module block_x() {
translate([-(gridx-1)*length/2,-(gridy-1)*length/2,0])
translate([-(gridx-1)*l_grid/2,-(gridy-1)*l_grid/2,0])
for (i = [1:gridx])
for (j = [1:gridy])
if (xFunc[style_base](i,j))
translate([(i-1)*length,(j-1)*length,0])
translate([(i-1)*l_grid,(j-1)*l_grid,0])
block_x_sub();
}