Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gridfinity-rebuilt-bins.scad
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ crush_ribs = true;
chamfer_holes = true;
// Magnet/Screw holes will be printed so supports are not needed.
printable_hole_top = true;
// Wether the plastic is printed around the magnet and it is embedded
embedded=false;

hole_options = bundle_hole_options(refined_holes, magnet_holes, screw_holes, crush_ribs, chamfer_holes, printable_hole_top);
hole_options = bundle_hole_options(refined_holes, magnet_holes, screw_holes, crush_ribs, chamfer_holes,
printable_hole_top, embedded);

// ===== IMPLEMENTATION ===== //

Expand Down
27 changes: 24 additions & 3 deletions gridfinity-rebuilt-holes.scad
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,11 @@ module screw_hole(radius, height, supportless=false, chamfer_radius=0, chamfer_a
* @param crush_ribs If the magnet hole should have crush ribs for a press fit.
* @param chamfer Add a chamfer to the magnet/screw hole.
* @param supportless If the magnet/screw hole should be printed in such a way that the screw hole does not require supports.
* @param embedded If the magent is inserted during the print.
*/
function bundle_hole_options(refined_hole=false, magnet_hole=false, screw_hole=false, crush_ribs=false, chamfer=false, supportless=false) =
[refined_hole, magnet_hole, screw_hole, crush_ribs, chamfer, supportless];
function bundle_hole_options(refined_hole=false, magnet_hole=false, screw_hole=false, crush_ribs=false, chamfer=false,
supportless=false, embedded=false) =
[refined_hole, magnet_hole, screw_hole, crush_ribs, chamfer, supportless, embedded];

/**
* @brief A single magnet/screw hole. To be cut out of the base.
Expand All @@ -253,6 +255,8 @@ module block_base_hole(hole_options, o=0) {
crush_ribs = hole_options[3];
chamfer = hole_options[4];
supportless = hole_options[5];
embedded = hole_options[6];
embedded_extra_layers = 3;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move this to the Magnet/Screw constants section of "standard.scad". That file is where all constant / magic values live.


// Validate said options
if(refined_hole) {
Expand All @@ -268,6 +272,11 @@ module block_base_hole(hole_options, o=0) {
magnet_depth = MAGNET_HOLE_DEPTH - o +
(supportless ? supportless_additional_layers*LAYER_HEIGHT : 0);

embedded_depth = embedded_extra_layers*LAYER_HEIGHT;
if(embedded) {
magnet_depth = magnet_depth + embedded_depth;
}

union() {
if(refined_hole) {
refined_hole();
Expand All @@ -278,7 +287,19 @@ module block_base_hole(hole_options, o=0) {
if(crush_ribs) {
ribbed_cylinder(magnet_radius, magnet_inner_radius, magnet_depth, MAGNET_HOLE_CRUSH_RIB_COUNT);
} else {
cylinder(h = magnet_depth, r=magnet_radius);
if(embedded) {
// Leave a gap for the screwdriver for recycling
intersection() {
translate([-magnet_radius,-magnet_radius * 0.15,0])
cube([2*magnet_radius, magnet_radius * 0.3, embedded_depth]);
cylinder(h = embedded_depth, r=magnet_radius);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given this is inside a difference(), have you confirmed if this works correctly with other options? If it is not supposed to be used with anything else, then you will need to add checks similar to those which currently exist for refined_hole.


translate([0, 0, embedded_depth])
cylinder(h = magnet_depth, r=magnet_radius);
} else {
cylinder(h = magnet_depth, r=magnet_radius);
}
}

if(supportless) {
Expand Down