Simplify refined_hole()

This commit is contained in:
Arthur Moore 2024-04-21 22:25:48 -04:00
parent 67ba594585
commit a4200a04bd
3 changed files with 27 additions and 34 deletions

View file

@ -17,22 +17,23 @@ module refined_hole() {
// Poke through - For removing a magnet using a toothpick // Poke through - For removing a magnet using a toothpick
ptl = refined_offset + LAYER_HEIGHT; // Additional layer just in case ptl = refined_offset + LAYER_HEIGHT; // Additional layer just in case
poke_through_height = REFINED_HOLE_HEIGHT+ptl; // Poke Through Height poke_through_height = REFINED_HOLE_HEIGHT + ptl;
poke_hole_radius = 2.5; // Poke Through Radius poke_hole_radius = 2.5;
magic_constant = 5.60; magic_constant = 5.60;
poke_hole_center = [-12.53 + magic_constant, 0, -ptl]; poke_hole_center = [-12.53 + magic_constant, 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, -REFINED_HOLE_RADIUS, 0]) cube([1, REFINED_HOLE_RADIUS*2, REFINED_HOLE_HEIGHT]); cube([11, REFINED_HOLE_RADIUS*2, REFINED_HOLE_HEIGHT]);
cylinder(1.9, r=REFINED_HOLE_RADIUS); cylinder(REFINED_HOLE_HEIGHT, r=REFINED_HOLE_RADIUS);
}
hull() {
// Poke hole // Poke hole
translate([-9+magic_constant, -poke_hole_radius/2, -ptl]) cube([1, poke_hole_radius, poke_through_height]); translate([poke_hole_center.x, -poke_hole_radius/2, poke_hole_center.z])
translate(poke_hole_center) cylinder(poke_through_height, d=poke_hole_radius); cube([10 - magic_constant, poke_hole_radius, poke_through_height]);
} translate(poke_hole_center)
cylinder(poke_through_height, d=poke_hole_radius);
} }
} }

View file

@ -231,26 +231,23 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only
difference(){ difference(){
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);
copy_mirror([0, 1, 0]) {
copy_mirror([1, 0, 0]) {
translate([
(gx/2)*l_grid - d_hole_from_side,
(gy/2) * l_grid - d_hole_from_side,
0
])
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, LAYER_HEIGHT*REFINED_HOLE_BOTTOM_LAYERS])
refined_hole(); refined_hole();
mirror([1, 0, 0]) }else {
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, 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, LAYER_HEIGHT*REFINED_HOLE_BOTTOM_LAYERS])
refined_hole();
}
}
else {
pattern_linear(2, 2, (gx-1)*l_grid+d_hole, (gy-1)*l_grid+d_hole)
block_base_hole(style_hole, off); block_base_hole(style_hole, off);
} }
} }
} }
}
}
else { else {
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, style_hole, off); block_base(gx, gy, l, dbnx, dbny, style_hole, off);
@ -275,11 +272,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, 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])
block_base_hole(style_hole, off); block_base_hole(style_hole, off);
} }
} }

View file

@ -35,10 +35,6 @@ MAGNET_HOLE_DEPTH = MAGNET_HEIGHT + (LAYER_HEIGHT * 2);
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;
// magnet hole depth
h_hole = 2.4;
// slit depth (printer layer height)
h_slit = 0.2;
// Meassured diameter in Fusion360. // Meassured diameter in Fusion360.
// Smaller than the magnet to keep it squeezed. // Smaller than the magnet to keep it squeezed.