Simplify refined_hole()

Makes it more self contained.
Moved some constants to standards.scad
This commit is contained in:
Arthur Moore 2024-04-14 15:45:17 -04:00
parent 0f5fb2d243
commit fa11897638
3 changed files with 29 additions and 27 deletions

View file

@ -95,7 +95,7 @@ module magnet_and_screw_hole(screw_radius, magnet_radius, screw_depth, magnet_de
*/ */
module magnet_and_screw_hole_printable(screw_radius, magnet_radius, screw_depth, magnet_depth) { module magnet_and_screw_hole_printable(screw_radius, magnet_radius, screw_depth, magnet_depth) {
difference() { difference() {
magnet_and_screw_hole(screw_radius, magnet_radius, screw_depth, magnet_depth + h_slit); magnet_and_screw_hole(screw_radius, magnet_radius, screw_depth, magnet_depth + LAYER_HEIGHT);
translate([-1.5*magnet_radius, screw_radius+0.1, magnet_depth]) translate([-1.5*magnet_radius, screw_radius+0.1, magnet_depth])
cube([magnet_radius*3, magnet_radius*3, 10]); cube([magnet_radius*3, magnet_radius*3, 10]);

View file

@ -236,7 +236,7 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only
translate_coordinates = [ translate_coordinates = [
(gx/2)*l_grid - d_hole_from_side, (gx/2)*l_grid - d_hole_from_side,
(gy/2) * l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side,
h_slit*2 0
]; ];
translate(translate_coordinates) translate(translate_coordinates)
refined_hole(); refined_hole();
@ -281,11 +281,10 @@ 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)
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0])
if (style_hole == 4) if (style_hole == 4)
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, h_slit*2])
refined_hole(); refined_hole();
else else
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0])
block_base_hole(style_hole, off); block_base_hole(style_hole, off);
} }
} }
@ -325,29 +324,26 @@ module block_base_solid(dbnx, dbny, l, o) {
* @see https://www.printables.com/model/413761-gridfinity-refined * @see https://www.printables.com/model/413761-gridfinity-refined
*/ */
module refined_hole() { module refined_hole() {
// Meassured magnet hole diameter to be 5.86mm (meassured in fusion360 refined_offset = LAYER_HEIGHT * REFINED_HOLE_BOTTOM_LAYERS;
r = MAGNET_HOLE_RADIUS-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;
ptr = 2.5; // Poke Through Radius poke_hole_radius = 2.5;
poke_hole_center = [-12.53 + 5.60, 0, -ptl];
translate([0, 0, refined_offset])
union() { union() {
hull() { // Magnet hole
// Magnet hole - smaller than the magnet to keep it squeezed translate([0, -REFINED_HOLE_RADIUS, 0])
translate([10, -r, 0]) cube([1, r*2, mh]); cube([11, REFINED_HOLE_RADIUS*2, REFINED_HOLE_HEIGHT]);
cylinder(1.9, r=r); cylinder(REFINED_HOLE_HEIGHT, r=REFINED_HOLE_RADIUS);
}
hull() {
// Poke hole // Poke hole
translate([-9+5.60, -ptr/2, -ptl]) cube([1, ptr, pth]); translate([poke_hole_center.x, -poke_hole_radius/2, poke_hole_center.z])
translate([-12.53+5.60, 0, -ptl]) cylinder(pth, d=ptr); cube([abs(poke_hole_center.x), poke_hole_radius, poke_through_height]);
} translate(poke_hole_center)
cylinder(poke_through_height, d=poke_hole_radius);
} }
} }

View file

@ -21,23 +21,29 @@ l_grid = 42;
// **************************************** // ****************************************
// Magnet / Screw Hole Constants // Magnet / Screw Hole Constants
// **************************************** // ****************************************
LAYER_HEIGHT = 0.2;
MAGNET_HEIGHT = 2;
SCREW_HOLE_RADIUS = 3 / 2; SCREW_HOLE_RADIUS = 3 / 2;
MAGNET_HOLE_RADIUS = 6.5 / 2; MAGNET_HOLE_RADIUS = 6.5 / 2;
MAGNET_HOLE_DEPTH = 2.4; 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
d_hole_from_side=8; d_hole_from_side=8;
// 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;
// Experimentally chosen for a press fit. // Experimentally chosen for a press fit.
MAGNET_HOLE_CRUSH_RIB_INNER_RADIUS = 5.9 / 2; MAGNET_HOLE_CRUSH_RIB_INNER_RADIUS = 5.9 / 2;
// Mostly arbitrarily chosen. // Mostly arbitrarily chosen.
// 30 ribs does not print with a 0.4mm nozzle. // 30 ribs does not print with a 0.4mm nozzle.
// 10 ribs print well with a 0.4mm nozzle.
// Anything 5 or under produces a hole that is not round. // Anything 5 or under produces a hole that is not round.
MAGNET_HOLE_CRUSH_RIB_COUNT = 8; MAGNET_HOLE_CRUSH_RIB_COUNT = 8;