gridfinity-rebuilt-openscad/gridfinity-rebuilt-holes.scad

61 lines
1.9 KiB
OpenSCAD
Raw Normal View History

/**
* @file gridfinity-rebuilt-holes.scad
* @brief Functions to create different types of holes in an object.
*/
include <standard.scad>
use <generic-helpers.scad>
2024-04-22 02:05:06 +00:00
/**
* @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() {
2024-04-22 02:05:06 +00:00
refined_offset = LAYER_HEIGHT * REFINED_HOLE_BOTTOM_LAYERS;
// Poke through - For removing a magnet using a toothpick
2024-04-22 02:05:06 +00:00
ptl = refined_offset + LAYER_HEIGHT; // Additional layer just in case
2024-04-22 02:25:48 +00:00
poke_through_height = REFINED_HOLE_HEIGHT + ptl;
poke_hole_radius = 2.5;
2024-04-22 02:05:06 +00:00
magic_constant = 5.60;
poke_hole_center = [-12.53 + magic_constant, 0, -ptl];
2024-04-22 02:25:48 +00:00
translate([0, 0, refined_offset])
union() {
2024-04-22 02:25:48 +00:00
// Magnet hole
translate([0, -REFINED_HOLE_RADIUS, 0])
cube([11, REFINED_HOLE_RADIUS*2, REFINED_HOLE_HEIGHT]);
cylinder(REFINED_HOLE_HEIGHT, r=REFINED_HOLE_RADIUS);
// Poke hole
translate([poke_hole_center.x, -poke_hole_radius/2, poke_hole_center.z])
cube([10 - magic_constant, 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) {
2024-04-22 02:05:06 +00:00
r1 = SCREW_HOLE_RADIUS-o/2;
r2 = MAGNET_HOLE_RADIUS-o/2;
union() {
difference() {
2024-04-22 02:05:06 +00:00
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])
2024-04-22 02:05:06 +00:00
translate([-1.5*r2,r1+0.1,MAGNET_HOLE_DEPTH-o])
cube([r2*3,r2*3, 10]);
}
if (style_hole > 1)
cylinder(h = 2*h_base-o, r = r1, center=true);
}
}
//$fa = 8;
//$fs = 0.25;
//block_base_hole(0);
//refined_hole();