From 015daff2e8bb4032f0462eb43337e8b3d01a4f0f Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Sat, 24 Feb 2024 03:54:17 -0500 Subject: [PATCH 1/4] Update Stacking Lip Profile Profile is now based on https://gridfinity.xyz/specification/ This does not change the final profile, merely how it is created. Fixes #168 - Cura watertight issue. Paritally fixes #169 - FreeCad errors. --- gridfinity-rebuilt-utility.scad | 93 ++++++++++++++++++++------------- standard.scad | 19 +++++++ 2 files changed, 76 insertions(+), 36 deletions(-) diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index b74779b..a39dd1f 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -125,7 +125,6 @@ module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid, sl = 0) { $dh = h; $dh0 = h0; $style_lip = sl; - color("tomato") { difference() { color("firebrick") block_bottom(h0==0?$dh-0.1:h0, gx, gy, l); @@ -133,9 +132,8 @@ module gridfinityInit(gx, gy, h, h0 = 0, l = l_grid, sl = 0) { } color("royalblue") block_wall(gx, gy, l) { - if ($style_lip == 0) profile_wall(); - else profile_wall2(); - } + if ($style_lip == 0) profile_wall(h); + else profile_wall2(h); } } // Function to include in the custom() module to individually slice bins @@ -362,51 +360,74 @@ module refined_hole() { } } -module profile_wall_sub_sub() { +/** + * @brief Stacking lip based on https://gridfinity.xyz/specification/ + * @details Also includes a support base. + */ +module stacking_lip() { + // Technique: Descriptive constant names are useful, but can be unweildy. + // Use abbreviations if they are going to be re-used repeatedly in a small piece of code. + inner_slope = stacking_lip_inner_slope_height_mm; + wall_height = stacking_lip_wall_height_mm; + + support_wall = stacking_lip_support_wall_height_mm; + s_total = stacking_lip_support_height_mm; + polygon([ - [0,0], - [d_wall/2,0], - [d_wall/2,$dh-1.2-d_wall2+d_wall/2], - [d_wall2-d_clear,$dh-1.2], - [d_wall2-d_clear,$dh+h_base], - [0,$dh+h_base] + [0, 0], // Inner tip + [inner_slope, inner_slope], // Go out 45 degrees + [inner_slope, inner_slope+wall_height], // Vertical increase + [stacking_lip_depth, stacking_lip_height], // Go out 45 degrees + [stacking_lip_depth, -s_total], // Down to support bottom + [0, -support_wall], // Up and in + [0, 0] // Close the shape. Tehcnically not needed. ]); } -module profile_wall_sub() { - difference() { - profile_wall_sub_sub(); - color("red") - offset(delta = d_clear) - translate([r_base-d_clear,$dh,0]) - mirror([1,0,0]) - profile_base(); +/** + * @brief Stacking lip with a rounded top. + */ +module stacking_lip_rounded_top() { + radius_center_y = h_lip - r_f1; + + union() { + // Create rounded top + intersection() { + translate([0, radius_center_y, 0]) + square([stacking_lip_depth, stacking_lip_height]); + offset(r = r_f1) + offset(delta = -r_f1) + stacking_lip(); + } + // Remove pointed top + difference(){ + stacking_lip(); + translate([0, radius_center_y, 0]) + square([stacking_lip_depth*2, stacking_lip_height*2]); + } } } -module profile_wall() { - translate([r_base,0,0]) - mirror([1,0,0]) - difference() { - profile_wall_sub(); - difference() { - translate([0, $dh+h_base-d_clear*sqrt(2), 0]) - circle(r_base/2); - offset(r = r_f1) - offset(delta = -r_f1) - profile_wall_sub(); - } - // remove any negtive geometry in edge cases - mirror([0,1,0]) - square(100*l_grid); +/** + * @brief External wall profile, with a stacking lip. + * @details The "1.4" constant is to match old behavior. + */ +module profile_wall(height_mm) { + assert(is_num(height_mm)) + translate([1.4, 0, 0]){ + translate([0, height_mm, 0]) + stacking_lip_rounded_top(); + translate([stacking_lip_depth-d_wall/2, 0, 0]) + square([d_wall/2, height_mm]); } } // lipless profile -module profile_wall2() { +module profile_wall2(height_mm) { + assert(is_num(height_mm)) translate([r_base,0,0]) mirror([1,0,0]) - square([d_wall,$dh]); + square([d_wall, height_mm]); } module block_wall(gx, gy, l) { diff --git a/standard.scad b/standard.scad index 0de6e36..354aa00 100644 --- a/standard.scad +++ b/standard.scad @@ -55,6 +55,25 @@ h_lip = 3.548; d_wall2 = r_base-r_c1-d_clear*sqrt(2); d_magic = -2*d_clear-2*d_wall+d_div; +// Stacking Lip +// Based on https://gridfinity.xyz/specification/ +stacking_lip_inner_slope_height_mm = 0.7; +stacking_lip_wall_height_mm = 1.8; +stacking_lip_outer_slope_height_mm = 1.9; +stacking_lip_depth = + stacking_lip_inner_slope_height_mm + + stacking_lip_outer_slope_height_mm; +stacking_lip_height = + stacking_lip_inner_slope_height_mm + + stacking_lip_wall_height_mm + + stacking_lip_outer_slope_height_mm; + +// Extracted from `profile_wall_sub_sub`. +stacking_lip_support_wall_height_mm = 1.2; +stacking_lip_support_height_mm = + stacking_lip_support_wall_height_mm + d_wall2; + + // Baseplate constants // Baseplate bottom part height (part added with weigthed=true) From 69cb64e98d8752f3e8e42a62f97167e3fadc2b26 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Sun, 10 Mar 2024 23:23:09 -0400 Subject: [PATCH 2/4] Rename chamfered profile to stacking_lip_chamfered() --- gridfinity-rebuilt-utility.scad | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index a39dd1f..1e6d54c 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -385,9 +385,11 @@ module stacking_lip() { } /** - * @brief Stacking lip with a rounded top. + * @brief Stacking lip with a with a chamfered (rounded) top. + * @details Based on https://gridfinity.xyz/specification/ + * Also includes a support base. */ -module stacking_lip_rounded_top() { +module stacking_lip_chamfered() { radius_center_y = h_lip - r_f1; union() { @@ -416,7 +418,7 @@ module profile_wall(height_mm) { assert(is_num(height_mm)) translate([1.4, 0, 0]){ translate([0, height_mm, 0]) - stacking_lip_rounded_top(); + stacking_lip_chamfered(); translate([stacking_lip_depth-d_wall/2, 0, 0]) square([d_wall/2, height_mm]); } From 5b25e2e11408b214f6cacb72a9c8d64c624807bd Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Sun, 10 Mar 2024 23:26:51 -0400 Subject: [PATCH 3/4] Replace "1.4" constant in profile_wall() with calculated value --- gridfinity-rebuilt-utility.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 1e6d54c..6cfb32e 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -412,11 +412,11 @@ module stacking_lip_chamfered() { /** * @brief External wall profile, with a stacking lip. - * @details The "1.4" constant is to match old behavior. + * @details Translated so a 90 degree rotation produces the expected outside radius. */ module profile_wall(height_mm) { assert(is_num(height_mm)) - translate([1.4, 0, 0]){ + translate([r_base - stacking_lip_depth, 0, 0]){ translate([0, height_mm, 0]) stacking_lip_chamfered(); translate([stacking_lip_depth-d_wall/2, 0, 0]) From 637b98577ff9c1fc29d006e91d72f65047b3e18d Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Sun, 10 Mar 2024 23:34:30 -0400 Subject: [PATCH 4/4] Match radius of bin to radius of base. Fixes #169, and #165. --- standard.scad | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/standard.scad b/standard.scad index 354aa00..5da1046 100644 --- a/standard.scad +++ b/standard.scad @@ -1,8 +1,6 @@ // height of the base h_base = 5; -// outside rounded radius of bin -r_base = 4; // lower base chamfer "radius" r_c1 = 0.8; // upper base chamfer "radius" @@ -18,6 +16,11 @@ r_fo3 = 1.6 / 2; // length of a grid unit l_grid = 42; + +// Outside rounded radius of bin +// Per spec, matches radius of upper base section. +r_base = r_fo1; + // screw hole radius r_hole1 = 1.5; // magnet hole radius