mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-11-10 18:40:50 +00:00
Support Chamfering Magnet Holes
Similar to ljbeal's Pull Request. However, the implementation is completely different. https://github.com/kennetek/gridfinity-rebuilt-openscad/pull/144
This commit is contained in:
parent
f222c262fc
commit
32f91a77ca
2 changed files with 32 additions and 8 deletions
|
@ -117,6 +117,28 @@ module refined_hole() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create a cone given a radius and an angle.
|
||||
* @param bottom_radius Radius of the bottom of the cone.
|
||||
* @param angle Angle as measured from the bottom of the cone.
|
||||
* @param max_height Optional maximum height. Cone will be cut off if higher.
|
||||
*/
|
||||
module cone(bottom_radius, angle, max_height=0) {
|
||||
assert(bottom_radius > 0);
|
||||
assert(angle > 0 && angle <= 90);
|
||||
assert(max_height >=0);
|
||||
|
||||
height = tan(angle) * bottom_radius;
|
||||
if(max_height == 0 || height < max_height) {
|
||||
// Normal Cone
|
||||
cylinder(h = height, r1 = bottom_radius, r2 = 0, center = false);
|
||||
} else {
|
||||
top_angle = 90 - angle;
|
||||
top_radius = bottom_radius - tan(top_angle) * max_height;
|
||||
cylinder(h = max_height, r1 = bottom_radius, r2 = top_radius, center = false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create an options list used to configure bin holes.
|
||||
* @param refined_hole Use gridfinity refined hole type. Not compatible with "magnet_hole".
|
||||
|
@ -148,7 +170,6 @@ module block_base_hole(hole_options, o=0) {
|
|||
if(refined_hole) {
|
||||
assert(!magnet_hole, "magnet_hole is not compatible with refined_hole");
|
||||
}
|
||||
assert(chamfer == false, "chamfer is not supported yet");
|
||||
|
||||
screw_radius = SCREW_HOLE_RADIUS - (o/2);
|
||||
magnet_radius = MAGNET_HOLE_RADIUS - (o/2);
|
||||
|
@ -176,7 +197,7 @@ module block_base_hole(hole_options, o=0) {
|
|||
}
|
||||
|
||||
if(chamfer) {
|
||||
// Not Implemented Yet
|
||||
cone(magnet_radius + MAGNET_HOLE_CHAMFER_ADDITIONAL_RADIUS, MAGNET_HOLE_CHAMFER_ANGLE, magnet_depth);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,10 +210,10 @@ module block_base_hole(hole_options, o=0) {
|
|||
//$fa = 8;
|
||||
//$fs = 0.25;
|
||||
//block_base_hole(bundle_hole_options(
|
||||
// refined_hole=true,
|
||||
// magnet_hole=false,
|
||||
// screw_hole=false,
|
||||
// supportless=false,
|
||||
// crush_ribs=false,
|
||||
// chamfer=false
|
||||
// refined_hole=false,
|
||||
// magnet_hole=true,
|
||||
// screw_hole=true,
|
||||
// supportless=true,
|
||||
// crush_ribs=true,
|
||||
// chamfer=true
|
||||
//));
|
||||
|
|
|
@ -50,6 +50,9 @@ MAGNET_HOLE_CRUSH_RIB_INNER_RADIUS = 5.9 / 2;
|
|||
// Anything 5 or under produces a hole that is not round.
|
||||
MAGNET_HOLE_CRUSH_RIB_COUNT = 8;
|
||||
|
||||
MAGNET_HOLE_CHAMFER_ADDITIONAL_RADIUS = 0.8;
|
||||
MAGNET_HOLE_CHAMFER_ANGLE = 45;
|
||||
|
||||
// ****************************************
|
||||
|
||||
// top edge fillet radius
|
||||
|
|
Loading…
Reference in a new issue