From 67ba594585bacdad23d4a7d20b32d04ce2cf7445 Mon Sep 17 00:00:00 2001 From: Arthur Moore Date: Sun, 21 Apr 2024 22:05:06 -0400 Subject: [PATCH] Made some hole constants more readable --- gridfinity-rebuilt-holes.scad | 42 ++++++++++++++++----------------- gridfinity-rebuilt-utility.scad | 14 +++++------ standard.scad | 23 ++++++++++++++---- 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/gridfinity-rebuilt-holes.scad b/gridfinity-rebuilt-holes.scad index eaffe20..25f3c5c 100644 --- a/gridfinity-rebuilt-holes.scad +++ b/gridfinity-rebuilt-holes.scad @@ -6,48 +6,46 @@ include use +/** +* @brief Refined hole based on Printables @grizzie17's Gridfinity Refined +* @details Magnet is pushed in from +X direction, and held in by friction. +* Small slit on the bottom allows removing the magnet. +* @see https://www.printables.com/model/413761-gridfinity-refined +*/ module refined_hole() { - /** - * Refined hole based on Printables @grizzie17's Gridfinity Refined - * https://www.printables.com/model/413761-gridfinity-refined - */ - - // Meassured magnet hole diameter to be 5.86mm (meassured in fusion360 - r = r_hole2-0.32; - - // Magnet height - m = 2; - mh = m-0.1; + refined_offset = LAYER_HEIGHT * REFINED_HOLE_BOTTOM_LAYERS; // Poke through - For removing a magnet using a toothpick - ptl = h_slit*3; // Poke Through Layers - pth = mh+ptl; // Poke Through Height - ptr = 2.5; // Poke Through Radius + ptl = refined_offset + LAYER_HEIGHT; // Additional layer just in case + poke_through_height = REFINED_HOLE_HEIGHT+ptl; // Poke Through Height + poke_hole_radius = 2.5; // Poke Through Radius + magic_constant = 5.60; + poke_hole_center = [-12.53 + magic_constant, 0, -ptl]; union() { hull() { // Magnet hole - smaller than the magnet to keep it squeezed - translate([10, -r, 0]) cube([1, r*2, mh]); - cylinder(1.9, r=r); + translate([10, -REFINED_HOLE_RADIUS, 0]) cube([1, REFINED_HOLE_RADIUS*2, REFINED_HOLE_HEIGHT]); + cylinder(1.9, r=REFINED_HOLE_RADIUS); } hull() { // Poke hole - translate([-9+5.60, -ptr/2, -ptl]) cube([1, ptr, pth]); - translate([-12.53+5.60, 0, -ptl]) cylinder(pth, d=ptr); + translate([-9+magic_constant, -poke_hole_radius/2, -ptl]) cube([1, poke_hole_radius, poke_through_height]); + translate(poke_hole_center) cylinder(poke_through_height, d=poke_hole_radius); } } } module block_base_hole(style_hole, o=0) { - r1 = r_hole1-o/2; - r2 = r_hole2-o/2; + r1 = SCREW_HOLE_RADIUS-o/2; + r2 = MAGNET_HOLE_RADIUS-o/2; union() { difference() { - cylinder(h = 2*(h_hole-o+(style_hole==3?h_slit:0)), r=r2, center=true); + cylinder(h = 2*(MAGNET_HOLE_DEPTH-o+(style_hole==3?h_slit:0)), r=r2, center=true); if (style_hole==3) copy_mirror([0,1,0]) - translate([-1.5*r2,r1+0.1,h_hole-o]) + translate([-1.5*r2,r1+0.1,MAGNET_HOLE_DEPTH-o]) cube([r2*3,r2*3, 10]); } if (style_hole > 1) diff --git a/gridfinity-rebuilt-utility.scad b/gridfinity-rebuilt-utility.scad index 79278cb..8caef04 100644 --- a/gridfinity-rebuilt-utility.scad +++ b/gridfinity-rebuilt-utility.scad @@ -232,16 +232,16 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l) block_base(gx, gy, l, dbnx, dbny, 0, off); if (style_hole == 4) { - translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2]) + translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, LAYER_HEIGHT*REFINED_HOLE_BOTTOM_LAYERS]) refined_hole(); mirror([1, 0, 0]) - translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2]) + translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, LAYER_HEIGHT*REFINED_HOLE_BOTTOM_LAYERS]) refined_hole(); mirror([0, 1, 0]) { - translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2]) + translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, LAYER_HEIGHT*REFINED_HOLE_BOTTOM_LAYERS]) refined_hole(); mirror([1, 0, 0]) - translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2]) + translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, LAYER_HEIGHT*REFINED_HOLE_BOTTOM_LAYERS]) refined_hole(); } } @@ -259,13 +259,13 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only } /** - * @brief A single Gridfinity base. + * @brief A single Gridfinity base. With holes (if set). * @param gx * @param gy * @param l * @param dbnx * @param dbny - * @param style_hole + * @param style_hole @see block_base_hole.style_hole * @param off */ module block_base(gx, gy, l, dbnx, dbny, style_hole, off) { @@ -276,7 +276,7 @@ module block_base(gx, gy, l, dbnx, dbny, style_hole, off) { if (style_hole > 0) pattern_circular(abs(l-d_hole_from_side/2)<0.001?1:4) if (style_hole == 4) - translate([l/2-d_hole_from_side, l/2-d_hole_from_side, h_slit*2]) + translate([l/2-d_hole_from_side, l/2-d_hole_from_side, LAYER_HEIGHT*REFINED_HOLE_BOTTOM_LAYERS]) refined_hole(); else translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0]) diff --git a/standard.scad b/standard.scad index 5da1046..8b2b4df 100644 --- a/standard.scad +++ b/standard.scad @@ -21,10 +21,16 @@ l_grid = 42; // Per spec, matches radius of upper base section. r_base = r_fo1; -// screw hole radius -r_hole1 = 1.5; -// magnet hole radius -r_hole2 = 3.25; +// **************************************** +// Magnet / Screw Hole Constants +// **************************************** +LAYER_HEIGHT = 0.2; +MAGNET_HEIGHT = 2; + +SCREW_HOLE_RADIUS = 3 / 2; +MAGNET_HOLE_RADIUS = 6.5 / 2; +MAGNET_HOLE_DEPTH = MAGNET_HEIGHT + (LAYER_HEIGHT * 2); + // center-to-center distance between holes d_hole = 26; // distance of hole from side of bin @@ -34,6 +40,15 @@ h_hole = 2.4; // slit depth (printer layer height) h_slit = 0.2; +// Meassured diameter in Fusion360. +// Smaller than the magnet to keep it squeezed. +REFINED_HOLE_RADIUS = 5.86 / 2; +REFINED_HOLE_HEIGHT = MAGNET_HEIGHT - 0.1; +// How many layers are between a Gridfinity Refined Hole and the bottom +REFINED_HOLE_BOTTOM_LAYERS = 2; + +// **************************************** + // top edge fillet radius r_f1 = 0.6; // internal fillet radius