diff --git a/gridfinity-rebuilt-bins.scad b/gridfinity-rebuilt-bins.scad index ea176a9..3e46932 100644 --- a/gridfinity-rebuilt-bins.scad +++ b/gridfinity-rebuilt-bins.scad @@ -153,6 +153,30 @@ gridfinityInit(3, 3, height(6), 0, 42) { gridfinityBase(3, 3, 42, 0, 0, 1); */ +// Shapes can also be cut in an indentation by using cut_indent() instead of cut_move(). To cut multiple shapes into one indented compartment use indent() in combination with cut_move(). +/* +gridfinityInit(2, 2, height(6), 0, 42) { + + cut_indent(14, 0, 0, 1, 1, enable_fillet=false) + sphere(12); + + indent(height(4), 1, 0, 1, 2) { + cut_move($indent_x, $indent_y, $indent_w, $indent_h/2) { + cube([20,20,20], true); + rotate([0,0,45]) cube([20,20,20], true); + } + + cut_move($indent_x, $indent_y+1, $indent_w, $indent_h/2) + translate([0, 0, -10]) + cylinder(20, r=12, true); + } + + cut(0, 1, 1, 1); +} +gridfinityBase(2, 2, 42, 0, 0, 1); +//*/ + + // You can use loops as well as the bin dimensions to make different parametric functions, such as this one, which divides the box into columns, with a small 1x1 top compartment and a long vertical compartment below /* gx = 3; diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 6404080..4a7e3d0 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -196,6 +196,46 @@ module cut_move(x, y, w, h) { children(); } + +// Cuts an indentation at the requested compartment block and moves objects down to the new top surface height +// Use in conjunction with cut_move() +// d: indent depth +// x: start coord. x=0 is the left side of the bin. +// y: start coord. y=0 is the bottom side of the bin. +// w: width of compartment, in # of bases covered +// h: height of compartment, in # of bases covered +// enable_fillet: add a fillet between the surface of the indentation and the wall +module indent(d, x = 0, y = 0, w = $gxx, h = $gyy, enable_fillet = true) { + + $indent_d = d; + $indent_x = x; + $indent_y = y; + $indent_w = w; + $indent_h = h; + + grid_to_mm = l_grid - d_wall*2; + + translate([0, 0, -d]) { + if (enable_fillet) + translate([0, 0, $dh - h_bot]) + cut(x, y, w, h, t=5, s=0); + else + cut_move(x, y, w, h) + rounded_rectangle(w*grid_to_mm, h*grid_to_mm, d*2, r_f2); + + children(); + } +} + +// Cuts an indentation at the requested compartment and translates objects from the origin point to the center of the indentation. Combines indent() and cut_move(). +// See indent() module for parameter descriptions +module cut_indent(d, x = 0, y = 0, w = $gxx, h = $gyy, enable_fillet = true) { + indent(d, x, y, w, h, enable_fillet) + cut_move(x, y, w, h) + children(); +} + + // ===== Modules ===== // module profile_base() {