Compare commits

...

12 commits

Author SHA1 Message Date
Arthur Moore 8c1945e9ba
Merge 85a5a50c1d into fd4db5aa9f 2024-04-15 01:58:49 -04:00
Arthur Moore 85a5a50c1d Include a screenshot of all hole options. 2024-04-15 01:58:38 -04:00
Arthur Moore 058f1117c7 Add images of all the hole options.
Does not include all combinations.
2024-04-15 01:37:43 -04:00
Arthur Moore 1a06b39d7b Set MAGNET_HOLE_CHAMFER_ANGLE to 45 degrees 2024-04-15 01:21:54 -04:00
Arthur Moore dcdfa706f5 Fix refined_hole.
Accidentally removed a bit too much of the bottom layer.
2024-04-15 01:19:49 -04:00
Arthur Moore e9d33d7ad4 Allow mixing and matching hole options. 2024-04-15 01:06:26 -04:00
Arthur Moore f2a8e20c20 Re-named hole_crush_ribs to ribbed_cylinder 2024-04-14 23:27:45 -04:00
Arthur Moore 15e7e405d5 Add a chamfer option that matches ljbeal's Pull Request
Actual implementation is completely different.

https://github.com/kennetek/gridfinity-rebuilt-openscad/pull/144
2024-04-14 23:26:09 -04:00
Arthur Moore 4f4d7043f6 Further simplify hole creation 2024-04-14 16:02:49 -04:00
Arthur Moore 5d19b848da Moved refined_hole() to gridfinity-rebuilt-holes.scad
block_base_hole now handles all hole selection.
2024-04-14 15:53:38 -04:00
Arthur Moore fa11897638 Simplify refined_hole()
Makes it more self contained.
Moved some constants to standards.scad
2024-04-14 15:45:17 -04:00
Arthur Moore 0f5fb2d243 Add a magnet hole with crush ribs.
Also moved (most) hole functions to a separate file.
2024-04-14 14:28:12 -04:00
16 changed files with 277 additions and 92 deletions

View file

@ -72,17 +72,30 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and retain height]
// scoop weight percentage. 0 disables scoop, 1 is regular scoop. Any real number will scale the scoop.
scoop = 1; //[0:0.1:1]
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
only_corners = false;
/* [Base] */
style_hole = 4; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit, 4: Gridfinity Refined hole - no glue needed]
// number of divisions per 1 unit of base along the X axis. (default 1, only use integers. 0 means automatically guess the right division)
div_base_x = 0;
// number of divisions per 1 unit of base along the Y axis. (default 1, only use integers. 0 means automatically guess the right division)
div_base_y = 0;
/* [Base Hole Options] */
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
only_corners = false;
//Use gridfinity refined hole style. Not compatible with magnet_holes!
refined_hole = true;
// Base will have holes for 6mm Diameter x 2mm high magnets.
magnet_holes = false;
// Base will have holes for M3 screws.
screw_holes = false;
// Magnet holes will have crush ribs to hold the magnet.
crush_ribs = false;
// Magnet holes will have a chamfer to ease insertion.
chamfer_magnet_holes = false;
// Allows printing screw holes with magnet holes without using supports.
printable_magnet_hole_top = false;
hole_options = bundle_hole_options(refined_hole, magnet_holes, screw_holes, crush_ribs, chamfer_magnet_holes, printable_magnet_hole_top);
// ===== IMPLEMENTATION ===== //
@ -98,7 +111,7 @@ gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap
cutCylinders(n_divx=cdivx, n_divy=cdivy, cylinder_diameter=cd, cylinder_height=ch, coutout_depth=c_depth, orientation=c_orientation, chamfer=c_chamfer);
}
}
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole, only_corners=only_corners);
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, hole_options, only_corners=only_corners);
}

View file

@ -0,0 +1,212 @@
/**
* @file gridfinity-rebuilt-holes.scad
* @brief Functions to create different types of holes in an object.
*/
include <standard.scad>
/**
* @brief Wave generation function for wrapping a circle.
* @param t An angle of the circle. Between 0 and 360 degrees.
* @param count The number of **full** waves in a 360 degree circle.
* @param range **Half** the difference between minimum and maximum values.
* @param vertical_offset A simple offset.
* @details
* If plotted on an x/y graph this produces a standard sin wave.
* Range only seems weird because it describes half a wave.
* Mapped by doing [sin(t), cost(t)] * wave_function(...).
* When wrapping a circle:
* Final Outer radius is (wave_vertical_offset + wave_range).
* Final Inner radius is (wave_vertical_offset - wave_range).
*/
function wave_function(t, count, range, vertical_offset) =
(sin(t * count) * range) + vertical_offset;
/**
* @brief A circle with crush ribs to give a tighter press fit.
* @details Extrude and use as a negative modifier.
* Idea based on Slant3D's video at 5:20 https://youtu.be/Bd7Yyn61XWQ?t=320
* Implementaiton is completely different.
* Important: Lower ribs numbers just result in a deformed circle.
* @param outer_radius Final outer radius.
* @param inner_radius Final inner radius.
* @param ribs Number of crush ribs the circle has.
**/
module ribbed_circle(outer_radius, inner_radius, ribs) {
assert(outer_radius > 0, "outer_radius must be positive");
assert(inner_radius > 0, "inner_radius must be positive");
assert(ribs > 0, "ribs must be positive");
assert(outer_radius > inner_radius, "outer_radius must be larger than inner_radius");
wave_range = (outer_radius - inner_radius) / 2;
wave_vertical_offset = inner_radius + wave_range;
// Circe with a wave wrapped around it
wrapped_circle = [ for (i = [0:360])
[sin(i), cos(i)] * wave_function(i, ribs, wave_range, wave_vertical_offset)
];
polygon(wrapped_circle);
}
/**
* @brief A cylinder with crush ribs to give a tighter press fit.
* @details To be used as the negative for a hole.
* @see ribbed_circle
* @param outer_radius Outer Radius of the crush ribs.
* @param inner_radius Inner Radius of the crush ribs.
* @param height Cylinder's height.
* @param ribs Number of crush ribs.
*/
module ribbed_cylinder(outer_radius, inner_radius, height, ribs) {
assert(height > 0, "height must be positive");
linear_extrude(height)
ribbed_circle(
outer_radius,
inner_radius,
ribs
);
}
/**
* @brief Make a magnet hole printable without suports.
* @see https://www.youtube.com/watch?v=W8FbHTcB05w
* @param screw_radius Radius of the screw hole.
* @param magnet_radius Radius of the magnet hole.
* @param magnet_depth Depth of the magnet hole.
* @details This is the negative designed to be cut out of the magnet hole.
* Use it with `difference()`.
*/
module make_magnet_hole_printable(screw_radius, magnet_radius, magnet_depth) {
translate([-1.5*magnet_radius, screw_radius+0.1, magnet_depth - LAYER_HEIGHT])
cube([magnet_radius*3, magnet_radius*3, 10]);
// Equivalent to copy_mirror([0,1,0])
mirror([0,1,0])
translate([-1.5*magnet_radius, screw_radius+0.1, magnet_depth - LAYER_HEIGHT])
cube([magnet_radius*3, magnet_radius*3, 10]);
}
/**
* @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() {
refined_offset = LAYER_HEIGHT * REFINED_HOLE_BOTTOM_LAYERS;
// Poke through - For removing a magnet using a toothpick
ptl = refined_offset + LAYER_HEIGHT; // Additional layer just in case
poke_through_height = REFINED_HOLE_HEIGHT + ptl;
poke_hole_radius = 2.5;
magic_constant = 5.60;
poke_hole_center = [-12.53 + magic_constant, 0, -ptl];
translate([0, 0, refined_offset])
union() {
// 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);
}
}
/**
* @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".
* @param magnet_hole Create a hole for a 6mm magnet.
* @param screw_hole Create a hole for a M3 screw.
* @param crush_ribs If the magnet hole should have crush ribs for a press fit.
* @param chamfer Add a chamfer to the magnet hole.
* @param supportless If the magnet hole should be printed in such a way that the screw hole does not require supports.
*/
function bundle_hole_options(refined_hole=true, magnet_hole=false, screw_hole=false, crush_ribs=false, chamfer=false, supportless=false) =
[refined_hole, magnet_hole, screw_hole, crush_ribs, chamfer, supportless];
/**
* @brief A single magnet/screw hole. To be cut out of the base.
* @details Supports multiple options that can be mixed and matched.
* @pram hole_options @see bundle_hole_options
* @param o Offset
*/
module block_base_hole(hole_options, o=0) {
// Destructure the options
refined_hole = hole_options[0];
magnet_hole = hole_options[1];
screw_hole = hole_options[2];
crush_ribs = hole_options[3];
chamfer = hole_options[4];
supportless = hole_options[5];
// Validate said options
if(refined_hole) {
assert(!magnet_hole, "magnet_hole is not compatible with refined_hole");
}
screw_radius = SCREW_HOLE_RADIUS - (o/2);
magnet_radius = MAGNET_HOLE_RADIUS - (o/2);
magnet_inner_radius = MAGNET_HOLE_CRUSH_RIB_INNER_RADIUS - (o/2);
screw_depth = h_base-o;
// If using supportless / printable mode, need to add an additional layer, so it can be removed later
magnet_depth = MAGNET_HOLE_DEPTH - o + (supportless ? LAYER_HEIGHT : 0);
union() {
if(refined_hole) {
refined_hole();
}
if(magnet_hole) {
difference() {
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(supportless) {
make_magnet_hole_printable(screw_radius, magnet_radius, magnet_depth);
}
}
if(chamfer) {
cone(magnet_radius + MAGNET_HOLE_CHAMFER_ADDITIONAL_RADIUS, MAGNET_HOLE_CHAMFER_ANGLE, magnet_depth);
}
}
if(screw_hole) {
cylinder(h = screw_depth, r = screw_radius);
}
}
}

View file

@ -5,6 +5,7 @@
*/
include <standard.scad>
use <gridfinity-rebuilt-holes.scad>
// ===== User Modules ===== //
@ -210,7 +211,7 @@ module profile_base() {
]);
}
module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only_corners=false) {
module gridfinityBase(gx, gy, l, dx, dy, hole_options, off=0, final_cut=true, only_corners=false) {
dbnxt = [for (i=[1:5]) if (abs(gx*i)%1 < 0.001 || abs(gx*i)%1 > 0.999) i];
dbnyt = [for (i=[1:5]) if (abs(gy*i)%1 < 0.001 || abs(gy*i)%1 > 0.999) i];
dbnx = 1/(dx==0 ? len(dbnxt) > 0 ? dbnxt[0] : 1 : round(dx));
@ -231,57 +232,45 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only
difference(){
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
block_base(gx, gy, l, dbnx, dbny, 0, off);
if (style_hole == 4) {
translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2])
refined_hole();
mirror([1, 0, 0])
translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2])
refined_hole();
mirror([0, 1, 0]) {
translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2])
refined_hole();
mirror([1, 0, 0])
translate([(gx/2)*l_grid - d_hole_from_side, (gy/2) * l_grid - d_hole_from_side, h_slit*2])
refined_hole();
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
])
block_base_hole(hole_options, off);
}
}
else {
pattern_linear(2, 2, (gx-1)*l_grid+d_hole, (gy-1)*l_grid+d_hole)
block_base_hole(style_hole, off);
}
}
}
else {
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, hole_options, off);
}
}
}
/**
* @brief A single Gridfinity base.
* @brief A single Gridfinity base. With holes (if set).
* @param gx
* @param gy
* @param l
* @param dbnx
* @param dbny
* @param style_hole
* @param hole_options @see block_base_hole.hole_options
* @param off
*/
module block_base(gx, gy, l, dbnx, dbny, style_hole, off) {
module block_base(gx, gy, l, dbnx, dbny, hole_options, off) {
render(convexity = 2)
difference() {
block_base_solid(dbnx, dbny, l, off);
if (style_hole > 0)
pattern_circular(abs(l-d_hole_from_side/2)<0.001?1:4)
if (style_hole == 4)
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, h_slit*2])
refined_hole();
else
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0])
block_base_hole(style_hole, off);
}
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])
block_base_hole(hole_options, off);
}
}
/**
@ -312,56 +301,6 @@ module block_base_solid(dbnx, dbny, l, o) {
}
}
module block_base_hole(style_hole, o=0) {
r1 = r_hole1-o/2;
r2 = r_hole2-o/2;
union() {
difference() {
cylinder(h = 2*(h_hole-o+(style_hole==3?h_slit:0)), r=r2, center=true);
if (style_hole==3)
copy_mirror([0,1,0])
translate([-1.5*r2,r1+0.1,h_hole-o])
cube([r2*3,r2*3, 10]);
}
if (style_hole > 1)
cylinder(h = 2*h_base-o, r = r1, center=true);
}
}
module refined_hole() {
/**
* Refined hole based on Printables @grizzie17's Gridfinity Refined
* https://www.printables.com/model/413761-gridfinity-refined
*/
// Meassured magnet hole diameter to be 5.86mm (meassured in fusion360
r = r_hole2-0.32;
// Magnet height
m = 2;
mh = m-0.1;
// Poke through - For removing a magnet using a toothpick
ptl = h_slit*3; // Poke Through Layers
pth = mh+ptl; // Poke Through Height
ptr = 2.5; // Poke Through Radius
union() {
hull() {
// Magnet hole - smaller than the magnet to keep it squeezed
translate([10, -r, 0]) cube([1, r*2, mh]);
cylinder(1.9, r=r);
}
hull() {
// Poke hole
translate([-9+5.60, -ptr/2, -ptl]) cube([1, ptr, pth]);
translate([-12.53+5.60, 0, -ptl]) cylinder(pth, d=ptr);
}
}
}
module profile_wall_sub_sub() {
polygon([
[0,0],

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -18,18 +18,39 @@ r_fo3 = 1.6 / 2;
// length of a grid unit
l_grid = 42;
// screw hole radius
r_hole1 = 1.5;
// magnet hole radius
r_hole2 = 3.25;
// ****************************************
// Magnet / Screw Hole Constants
// ****************************************
LAYER_HEIGHT = 0.2;
MAGNET_HEIGHT = 2;
SCREW_HOLE_RADIUS = 3 / 2;
MAGNET_HOLE_RADIUS = 6.5 / 2;
MAGNET_HOLE_DEPTH = MAGNET_HEIGHT + (LAYER_HEIGHT * 2);
// center-to-center distance between holes
d_hole = 26;
// distance of hole from side of bin
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.
// 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.
MAGNET_HOLE_CRUSH_RIB_INNER_RADIUS = 5.9 / 2;
// Mostly arbitrarily chosen.
// 30 ribs does not print with a 0.4mm nozzle.
// 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
r_f1 = 0.6;