From 8d8827de6c97a4471fa844aac18cfb1639e674fc Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Wed, 11 Jan 2023 21:33:36 +0100 Subject: [PATCH 1/7] 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) { From 7ec3f30ffe6805e22462e3e60c54eae567806a3c Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Wed, 11 Jan 2023 21:44:13 +0100 Subject: [PATCH 2/7] add baseplate screw together minimal --- gridfinity-rebuilt-baseplate.scad | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index b9a46ce..d82af7c 100644 --- a/gridfinity-rebuilt-baseplate.scad +++ b/gridfinity-rebuilt-baseplate.scad @@ -42,7 +42,7 @@ distancey = 0; /* [Styles] */ // baseplate styles -style_plate = 3; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together] +style_plate = 3; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal] // enable magnet hole enable_magnet = true; @@ -91,6 +91,10 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { linear_extrude(10*(h_base+off), center = true) profile_skeleton(); } + else if (sp == 4) { + linear_extrude(10*(h_base+off), center = true) + profile_skeleton_minimal(); + } translate([0,0,-off]) { if (sh == 1) cutter_countersink(); @@ -163,9 +167,7 @@ module profile_skeleton() { module profile_skeleton_minimal() { l = length - 6; - offset(r_fo3) - offset(-r_fo3) - square([l,l], center = true); + rounded_square(l,r_fo3); } module cutter_screw_together(gx, gy, off) { From 8dcb2077b9f78ecfc48c6eaae3f225bd042e7ef8 Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Wed, 11 Jan 2023 21:53:24 +0100 Subject: [PATCH 3/7] add screwholes to minimal base skeleton --- gridfinity-rebuilt-baseplate.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index d82af7c..4f5fb6a 100644 --- a/gridfinity-rebuilt-baseplate.scad +++ b/gridfinity-rebuilt-baseplate.scad @@ -101,7 +101,7 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { else if (sh == 2) cutter_counterbore(); } } - if (sp == 3) cutter_screw_together(gx, gy, off); + if (sp == 3 || sp ==4) cutter_screw_together(gx, gy, off); } } From 2297e3af36f4a9b874c666f9bb4c1cbc3f7b6bd1 Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Mon, 13 Feb 2023 11:52:11 +0100 Subject: [PATCH 4/7] Revert "refactor rounded cuboids/planes" This reverts commit 8d8827de6c97a4471fa844aac18cfb1639e674fc. --- gridfinity-rebuilt-baseplate.scad | 4 ++-- gridfinity-rebuilt-lite.scad | 4 ++-- gridfinity-rebuilt-utility.scad | 28 ++++++++++------------------ gridfinity-spiral-vase.scad | 12 ++++++------ 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index 4f5fb6a..165194b 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_rectangular_cuboid(dx, dy, h_base+off, r_base); + rounded_rectangle(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_rectangular_cuboid(dx*2, dy*2, h_base*2, r_base); + rounded_rectangle(dx*2, dy*2, h_base*2, r_base); pattern_linear(gx, gy, length) { if (sm) block_base_hole(1); diff --git a/gridfinity-rebuilt-lite.scad b/gridfinity-rebuilt-lite.scad index f6208bd..b3f9e86 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_rectangular_cuboid(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2); + rounded_rectangle(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_rectangular_cuboid(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, h_base, r_f2); + rounded_rectangle(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 216cccf..f104225 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_rectangular_cuboid(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001); + rounded_rectangle(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001); intersection(){ if (final_cut) translate([0,0,-1]) - rounded_rectangular_cuboid(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001); + rounded_rectangle(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_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); + 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); } translate([0,0,oo]) hull() { - rounded_rectangular_cuboid(xx-2*r_c2+o, yy-2*r_c2+o, r_c2, r_fo2/2); + rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o, r_c2, r_fo2/2); mirror([0,0,1]) - rounded_rectangular_cuboid(xx+o, yy+o, h_bot/2+abs(10*o), r_fo1/2); + rounded_rectangle(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_rectangular_cuboid(gx*l-0.5-d_wall/4, gy*l-0.5-d_wall/4, h, r_base+0.01); + rounded_rectangle(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,23 +389,15 @@ module profile_cutter_tab(h, tab, ang) { function clp(x,a,b) = min(max(x,a),b); -module rounded_rectangular_cuboid(length, width, height, rad) { +module rounded_rectangle(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, rad){ - rounded_rectangle(length,length,rad); +module rounded_square(length, height, rad) { + rounded_rectangle(length, length, height, rad); } module copy_mirror(vec=[0,1,0]) { diff --git a/gridfinity-spiral-vase.scad b/gridfinity-spiral-vase.scad index f1a4121..e1f5fca 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_rectangular_cuboid(length-0.5-0.005, length-0.5-0.005, h_base*10, r_fo1/2+0.001); + rounded_rectangle(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_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); + 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); } hull() { - rounded_cube(length-o-0.05-2*r_c2, r_c2, r_fo2/2); + rounded_square(length-o-0.05-2*r_c2, r_c2, r_fo2/2); mirror([0,0,1]) - rounded_cube(length-o-0.05, d_bottom, r_fo1/2); + rounded_square(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_rectangular_cuboid(gridx*length-0.5-nozzle, gridy*length-0.5-nozzle, h, r_base+0.01-nozzle/2); + rounded_rectangle(gridx*length-0.5-nozzle, gridy*length-0.5-nozzle, h, r_base+0.01-nozzle/2); } module profile_x(x_f = 3) { From 46feb59b0d20fadb8fe88c00abda457c8c233aef Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Mon, 13 Feb 2023 13:54:56 +0100 Subject: [PATCH 5/7] remove need of extra module --- gridfinity-rebuilt-baseplate.scad | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index 165194b..b6d3546 100644 --- a/gridfinity-rebuilt-baseplate.scad +++ b/gridfinity-rebuilt-baseplate.scad @@ -92,8 +92,8 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { profile_skeleton(); } else if (sp == 4) { - linear_extrude(10*(h_base+off), center = true) - profile_skeleton_minimal(); + translate([0,0,-off - 0.001]) + rounded_square(length-6, off + 0.002, r_fo3); } translate([0,0,-off]) { @@ -165,11 +165,6 @@ module profile_skeleton() { } } -module profile_skeleton_minimal() { - l = length - 6; - rounded_square(l,r_fo3); -} - module cutter_screw_together(gx, gy, off) { screw(gx, gy); From 6ad4204c100e613db6fb7c33da7e92349ecfd609 Mon Sep 17 00:00:00 2001 From: Ruud Swinkels Date: Wed, 15 Feb 2023 15:49:37 +0100 Subject: [PATCH 6/7] remove magic number --- gridfinity-rebuilt-baseplate.scad | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index b6d3546..d7986d8 100644 --- a/gridfinity-rebuilt-baseplate.scad +++ b/gridfinity-rebuilt-baseplate.scad @@ -92,8 +92,9 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { profile_skeleton(); } else if (sp == 4) { + l = length-2*r_c2-2*r_c1; translate([0,0,-off - 0.001]) - rounded_square(length-6, off + 0.002, r_fo3); + rounded_square(l, off + 0.002, r_fo3); } translate([0,0,-off]) { From 19a1504006595241d36a0c687fd32eb27c53e760 Mon Sep 17 00:00:00 2001 From: K Hodson Date: Wed, 15 Feb 2023 10:04:34 -0700 Subject: [PATCH 7/7] code formatting --- gridfinity-rebuilt-baseplate.scad | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/gridfinity-rebuilt-baseplate.scad b/gridfinity-rebuilt-baseplate.scad index d7986d8..344d9a8 100644 --- a/gridfinity-rebuilt-baseplate.scad +++ b/gridfinity-rebuilt-baseplate.scad @@ -42,7 +42,7 @@ distancey = 0; /* [Styles] */ // baseplate styles -style_plate = 3; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal] +style_plate = 0; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal] // enable magnet hole enable_magnet = true; @@ -87,15 +87,12 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh) { if (sp == 1) translate([0,0,-off]) cutter_weight(); - else if (sp == 2 || sp == 3) { + else if (sp == 2 || sp == 3) linear_extrude(10*(h_base+off), center = true) profile_skeleton(); - } - else if (sp == 4) { - l = length-2*r_c2-2*r_c1; - translate([0,0,-off - 0.001]) - rounded_square(l, off + 0.002, r_fo3); - } + else if (sp == 4) + translate([0,0,-5*(h_base+off)]) + rounded_square(length-2*r_c2-2*r_c1, 10*(h_base+off), r_fo3); translate([0,0,-off]) { if (sh == 1) cutter_countersink();