From 8d8827de6c97a4471fa844aac18cfb1639e674fc Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Wed, 11 Jan 2023 21:33:36 +0100 Subject: [PATCH] refactor rounded cuboids/planes --- gridfinity-rebuilt-baseplate.scad | 11 +++++++++-- gridfinity-rebuilt-lite.scad | 4 ++-- gridfinity-rebuilt-utility.scad | 28 ++++++++++++++++++---------- gridfinity-spiral-vase.scad | 12 ++++++------ 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index 871165a..b9a46ce 100644 --- a/gridfinity-rebuilt-baseplate.scad +++ b/gridfinity-rebuilt-baseplate.scad @@ -74,12 +74,12 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { difference() { translate([0,0,h_base]) mirror([0,0,1]) - rounded_rectangle(dx, dy, h_base+off, r_base); + rounded_rectangular_cuboid(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); + rounded_rectangular_cuboid(dx*2, dy*2, h_base*2, r_base); pattern_linear(gx, gy, length) { if (sm) block_base_hole(1); @@ -161,6 +161,13 @@ module profile_skeleton() { } } +module profile_skeleton_minimal() { + l = length - 6; + offset(r_fo3) + offset(-r_fo3) + square([l,l], center = true); +} + module cutter_screw_together(gx, gy, off) { screw(gx, gy); diff --git a/gridfinity-rebuilt-lite.scad b/gridfinity-rebuilt-lite.scad index b3f9e86..f6208bd 100644 --- a/gridfinity-rebuilt-lite.scad +++ b/gridfinity-rebuilt-lite.scad @@ -78,10 +78,10 @@ module gridfinityLite(gridx, gridy, gridz, gridz_define, enable_lip, enable_zsna cube([gridx*length,gridy*length,1000]); } translate([0,0,-1]) - rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2); + rounded_rectangular_cuboid(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2); } translate([0,0,h_base+d_clear]) - rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, h_base, r_f2); + rounded_rectangular_cuboid(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, h_base, r_f2); } translate([0,0,-4*h_base]) diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index f104225..216cccf 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -90,12 +90,12 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) { if (final_cut) translate([0,0,h_base]) - rounded_rectangle(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001); + rounded_rectangular_cuboid(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); + rounded_rectangular_cuboid(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001); render() difference() { @@ -117,14 +117,14 @@ module block_base_solid(dbnx, dbny, l, o) { mirror([0,0,1]) union() { hull() { - 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); + rounded_rectangular_cuboid(xx-2*r_c2-2*r_c1+o, yy-2*r_c2-2*r_c1+o, h_base+oo, r_fo3/2); + rounded_rectangular_cuboid(xx-2*r_c2+o, yy-2*r_c2+o, h_base-r_c1+oo, r_fo2/2); } translate([0,0,oo]) hull() { - rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o, r_c2, r_fo2/2); + rounded_rectangular_cuboid(xx-2*r_c2+o, yy-2*r_c2+o, r_c2, r_fo2/2); mirror([0,0,1]) - rounded_rectangle(xx+o, yy+o, h_bot/2+abs(10*o), r_fo1/2); + rounded_rectangular_cuboid(xx+o, yy+o, h_bot/2+abs(10*o), r_fo1/2); } } } @@ -201,7 +201,7 @@ module block_wall(gx, gy, l) { module block_bottom( h = 2.2, gx, gy, l ) { translate([0,0,h_base+0.1]) - rounded_rectangle(gx*l-0.5-d_wall/4, gy*l-0.5-d_wall/4, h, r_base+0.01); + rounded_rectangular_cuboid(gx*l-0.5-d_wall/4, gy*l-0.5-d_wall/4, h, r_base+0.01); } module cut_move_unsafe(x, y, w, h) { @@ -389,15 +389,23 @@ module profile_cutter_tab(h, tab, ang) { function clp(x,a,b) = min(max(x,a),b); -module rounded_rectangle(length, width, height, rad) { +module rounded_rectangular_cuboid(length, width, height, rad) { linear_extrude(height) + rounded_rectangle(length, width, rad); +} + +module rounded_cube(length, height, rad) { + rounded_rectangular_cuboid(length, length, height, rad); +} + +module rounded_rectangle(length, width, rad){ offset(rad) offset(-rad) square([length,width], center = true); } -module rounded_square(length, height, rad) { - rounded_rectangle(length, length, height, rad); +module rounded_square(length, rad){ + rounded_rectangle(length,length,rad); } module copy_mirror(vec=[0,1,0]) { diff --git a/gridfinity-spiral-vase.scad b/gridfinity-spiral-vase.scad index e1f5fca..f1a4121 100644 --- a/gridfinity-spiral-vase.scad +++ b/gridfinity-spiral-vase.scad @@ -157,7 +157,7 @@ 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_rectangular_cuboid(length-0.5-0.005, length-0.5-0.005, h_base*10, r_fo1/2+0.001); } translate([0,0,0.01]) difference() { @@ -211,13 +211,13 @@ 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_cube(length-o-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2); + rounded_cube(length-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_cube(length-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_cube(length-o-0.05, d_bottom, r_fo1/2); } } } @@ -515,7 +515,7 @@ module transform_scoop() { 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_rectangular_cuboid(gridx*length-0.5-nozzle, gridy*length-0.5-nozzle, h, r_base+0.01-nozzle/2); } module profile_x(x_f = 3) {