Made some hole constants more readable

This commit is contained in:
Arthur Moore 2024-04-21 22:05:06 -04:00
parent 88ad9dbf6c
commit 67ba594585
3 changed files with 46 additions and 33 deletions

View file

@ -6,48 +6,46 @@
include <standard.scad> include <standard.scad>
use <generic-helpers.scad> use <generic-helpers.scad>
module refined_hole() {
/** /**
* Refined hole based on Printables @grizzie17's Gridfinity Refined * @brief Refined hole based on Printables @grizzie17's Gridfinity Refined
* https://www.printables.com/model/413761-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() {
// Meassured magnet hole diameter to be 5.86mm (meassured in fusion360 refined_offset = LAYER_HEIGHT * REFINED_HOLE_BOTTOM_LAYERS;
r = r_hole2-0.32;
// Magnet height
m = 2;
mh = m-0.1;
// Poke through - For removing a magnet using a toothpick // Poke through - For removing a magnet using a toothpick
ptl = h_slit*3; // Poke Through Layers ptl = refined_offset + LAYER_HEIGHT; // Additional layer just in case
pth = mh+ptl; // Poke Through Height poke_through_height = REFINED_HOLE_HEIGHT+ptl; // Poke Through Height
ptr = 2.5; // Poke Through Radius poke_hole_radius = 2.5; // Poke Through Radius
magic_constant = 5.60;
poke_hole_center = [-12.53 + magic_constant, 0, -ptl];
union() { union() {
hull() { hull() {
// Magnet hole - smaller than the magnet to keep it squeezed // Magnet hole - smaller than the magnet to keep it squeezed
translate([10, -r, 0]) cube([1, r*2, mh]); translate([10, -REFINED_HOLE_RADIUS, 0]) cube([1, REFINED_HOLE_RADIUS*2, REFINED_HOLE_HEIGHT]);
cylinder(1.9, r=r); cylinder(1.9, r=REFINED_HOLE_RADIUS);
} }
hull() { hull() {
// Poke hole // Poke hole
translate([-9+5.60, -ptr/2, -ptl]) cube([1, ptr, pth]); translate([-9+magic_constant, -poke_hole_radius/2, -ptl]) cube([1, poke_hole_radius, poke_through_height]);
translate([-12.53+5.60, 0, -ptl]) cylinder(pth, d=ptr); translate(poke_hole_center) cylinder(poke_through_height, d=poke_hole_radius);
} }
} }
} }
module block_base_hole(style_hole, o=0) { module block_base_hole(style_hole, o=0) {
r1 = r_hole1-o/2; r1 = SCREW_HOLE_RADIUS-o/2;
r2 = r_hole2-o/2; r2 = MAGNET_HOLE_RADIUS-o/2;
union() { union() {
difference() { 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) if (style_hole==3)
copy_mirror([0,1,0]) 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]); cube([r2*3,r2*3, 10]);
} }
if (style_hole > 1) if (style_hole > 1)

View file

@ -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) pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
block_base(gx, gy, l, dbnx, dbny, 0, off); block_base(gx, gy, l, dbnx, dbny, 0, off);
if (style_hole == 4) { 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(); refined_hole();
mirror([1, 0, 0]) 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(); refined_hole();
mirror([0, 1, 0]) { 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(); refined_hole();
mirror([1, 0, 0]) 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(); 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 gx
* @param gy * @param gy
* @param l * @param l
* @param dbnx * @param dbnx
* @param dbny * @param dbny
* @param style_hole * @param style_hole @see block_base_hole.style_hole
* @param off * @param off
*/ */
module block_base(gx, gy, l, dbnx, dbny, style_hole, 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) if (style_hole > 0)
pattern_circular(abs(l-d_hole_from_side/2)<0.001?1:4) pattern_circular(abs(l-d_hole_from_side/2)<0.001?1:4)
if (style_hole == 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(); refined_hole();
else else
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0]) translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0])

View file

@ -21,10 +21,16 @@ l_grid = 42;
// Per spec, matches radius of upper base section. // Per spec, matches radius of upper base section.
r_base = r_fo1; r_base = r_fo1;
// screw hole radius // ****************************************
r_hole1 = 1.5; // Magnet / Screw Hole Constants
// magnet hole radius // ****************************************
r_hole2 = 3.25; 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 // center-to-center distance between holes
d_hole = 26; d_hole = 26;
// distance of hole from side of bin // distance of hole from side of bin
@ -34,6 +40,15 @@ h_hole = 2.4;
// slit depth (printer layer height) // slit depth (printer layer height)
h_slit = 0.2; 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 // top edge fillet radius
r_f1 = 0.6; r_f1 = 0.6;
// internal fillet radius // internal fillet radius