screw holes, file naming, and base dividing

- screw holes toggle
- renamed base file to utility to avoid confusion
- base dividing will now always be safe to use on baseplates (cannot divide into sections that cannot be multiplied by an integer to equal 1)
This commit is contained in:
kennetek 2022-10-01 23:10:19 -07:00
parent 754f7ec965
commit 5a4396f480
4 changed files with 145 additions and 112 deletions

View file

@ -1,22 +1,18 @@
// UTILITY FILE, DO NOT EDIT // UTILITY FILE, DO NOT EDIT
// EDIT OTHER FILES IN REPO FOR RESULTS
// ===== Extra Math ===== // dht = (gridz_define==0)?gridz*7 : (gridz_define==1)?h_bot+gridz+h_base : gridz-(enable_lip?3.8:0);
d_height = (enable_zsnap?((abs(dht)%7==0)?dht:dht+7-abs(dht)%7):dht)-h_base;
gzd = gridz_define;
dht = (gzd==0)?gridz*7 : (gzd==1)?h_bot+gridz+h_base : gridz-(enable_lip?3.8:0);
assert(dht > 0, "Height is too small!");
dht2 = enable_zsnap?((abs(dht)%7==0)?dht:dht+7-abs(dht)%7):dht;
d_height = dht2-h_base;
r_scoop = length*((d_height-2)/7+1)/12 - r_f2; // scoop radius
d_wall2 = r_base-r_c1-d_clear*sqrt(2); d_wall2 = r_base-r_c1-d_clear*sqrt(2);
xl = gridx*length-2*d_clear-2*d_wall+d_div; xl = gridx*length-2*d_clear-2*d_wall+d_div;
yl = gridy*length-2*d_clear-2*d_wall+d_div; yl = gridy*length-2*d_clear-2*d_wall+d_div;
echo("====="); //echo("=====");
echo(height_total=d_height+h_base+(enable_lip?3.8:0)); //echo(height_total=d_height+h_base+(enable_lip?3.8:0));
echo(effective_units=(d_height+h_base)/7); //echo(effective_units=(d_height+h_base)/7);
echo("====="); //echo("=====");
// ===== User Modules ===== // // ===== User Modules ===== //
// Creates an equally divided gridfinity bin. // Creates an equally divided gridfinity bin.
@ -37,7 +33,7 @@ module gridfinityEqual(n_divx=1, n_divy=1, style_tab=1, enable_scoop=true) {
// wrapper module // wrapper module
// DOES NOT CHECK FOR VALID COMPARTMENT STRUCTURE // DOES NOT CHECK FOR VALID COMPARTMENT STRUCTURE
module gridfinityCustom() { module gridfinityCustom() {
if (gridz > 0) { if (gridz > 0 && dht > 0) {
difference() { difference() {
color("firebrick") block_bottom(height_internal==0?d_height-0.1:height_internal); color("firebrick") block_bottom(height_internal==0?d_height-0.1:height_internal);
children(); children();
@ -72,48 +68,6 @@ module cut_move(x, y, w, h) {
children(); children();
} }
module block_negative_chamfer(depth = 10, top = 0, bot = 0) {
bc = abs(bot);
tc = abs(top);
hull() {
linear_extrude(2*(depth), center = true)
offset(-bc)
children();
linear_extrude(2*(depth-bc), center = true)
children();
}
if (tc != 0)
translate([0,0,tc])
block_negative_chamfer(depth = tc*2, bot = tc, top = 0)
offset(delta = tc-0.01)
children();
}
module block_negative_fillet(depth = 10, bot_fillet = 0) {
bf = abs(bot_fillet);
block_negative_chamfer(depth, 0, bf)
children();
minkowski() {
linear_extrude(2*(depth-bf), center = true)
offset(-bf)
children();
if (bf > 0) sphere(r = bf);
}
}
module block_negative(depth) {
linear_extrude(2*depth, center=true)
children();
}
// ===== Modules ===== // // ===== Modules ===== //
module profile_base() { module profile_base() {
@ -128,17 +82,24 @@ module profile_base() {
} }
module block_base() { module block_base() {
dbnxt = [for (i=[1:10]) if (abs(gridx*i)%1 < 0.001 || abs(gridx*i)%1 > 0.999) i];
dbnyt = [for (i=[1:10]) if (abs(gridy*i)%1 < 0.001 || abs(gridy*i)%1 > 0.999) i];
dbnx = 1/(div_base_auto ? len(dbnxt) > 0 ? dbnxt[0] : 1 : round(div_base_x));
dbny = 1/(div_base_auto ? len(dbnyt) > 0 ? dbnyt[0] : 1 : round(div_base_y));
xx = gridx*length-0.5;
yy = gridy*length-0.5;
translate([0,0,h_base]) translate([0,0,h_base])
rounded_rectangle(gridx*length-0.5+0.002, gridy*length-0.5+0.002, h_bot/1.5, r_fo1/2+0.001); rounded_rectangle(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001);
intersection(){ intersection(){
translate([0,0,-1]) translate([0,0,-1])
rounded_rectangle(gridx*length-0.5+0.005, gridy*length-0.5+0.005, h_base+h_bot/2*10, r_fo1/2+0.001); rounded_rectangle(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001);
render() render()
difference() { difference() {
pattern_linear2(gridx/divbasex, gridy/divbasey, divbasex*length, divbasey*length) pattern_linear2(gridx/dbnx, gridy/dbny, dbnx*length, dbny*length)
block_base_solid(); block_base_solid(dbnx, dbny);
if (enable_holes) if (enable_holes)
@ -148,20 +109,22 @@ module block_base() {
} }
} }
module block_base_solid() { module block_base_solid(dbnx, dbny) {
xx = dbnx*length-0.05;
yy = dbny*length-0.05;
translate([0,0,h_base]) translate([0,0,h_base])
mirror([0,0,1]) mirror([0,0,1])
union() { union() {
hull() { hull() {
rounded_rectangle(divbasex*length-0.05-2*r_c2-2*r_c1,divbasey*length-0.05-2*r_c2-2*r_c1, h_base, r_fo3/2); rounded_rectangle(xx-2*r_c2-2*r_c1,yy-2*r_c2-2*r_c1, h_base, r_fo3/2);
rounded_rectangle(divbasex*length-0.05-2*r_c2, divbasey*length-0.05-2*r_c2, h_base-r_c1, r_fo2/2); rounded_rectangle(xx-2*r_c2, yy-2*r_c2, h_base-r_c1, r_fo2/2);
}
hull() {
rounded_rectangle(divbasex*length-0.05-2*r_c2, divbasey*length-0.05-2*r_c2,r_c2, r_fo2/2);
mirror([0,0,1])
rounded_rectangle(divbasex*length-0.05, divbasey*length-0.05, h_bot/2, r_fo1/2);
}
} }
hull() {
rounded_rectangle(xx-2*r_c2, yy-2*r_c2,r_c2, r_fo2/2);
mirror([0,0,1])
rounded_rectangle(xx, yy, h_bot/2, r_fo1/2);
}
}
} }
module block_base_hole() { module block_base_hole() {
@ -170,11 +133,12 @@ module block_base_hole() {
union() { union() {
difference() { difference() {
cylinder(h = 2*(h_hole+(enable_hole_slit?0.2:0)), r = r_hole2, center=true); cylinder(h = 2*(h_hole+(enable_hole_slit?0.2:0)), r = r_hole2, center=true);
if (enable_hole_slit) if (enable_hole_slit && enable_screw)
copy_mirror([0,1,0]) copy_mirror([0,1,0])
translate([-1.5*r_hole2,r_hole1+0.1,h_hole]) translate([-1.5*r_hole2,r_hole1+0.1,h_hole])
cube([r_hole2*3,r_hole2*3, 0.4]); cube([r_hole2*3,r_hole2*3, 0.4]);
} }
if (enable_screw)
cylinder(h = 3*h_base, r = r_hole1, center=true); cylinder(h = 3*h_base, r = r_hole1, center=true);
} }
} }
@ -376,14 +340,14 @@ module fillet_cutter(t = 0, c = "goldenrod") {
} }
} }
module profile_cutter(h, length, s) { module profile_cutter(h, l, s) {
scoop = s ? r_scoop : 0; scoop = s ? (length*((d_height-2)/7+1)/12-r_f2) : 0;
translate([r_f2,r_f2]) translate([r_f2,r_f2])
hull() { hull() {
if (length-scoop-2*r_f2 > 0) if (l-scoop-2*r_f2 > 0)
square(0.1); square(0.1);
if (scoop < h) { if (scoop < h) {
translate([length-2*r_f2,h-r_f2/2]) translate([l-2*r_f2,h-r_f2/2])
mirror([1,1]) mirror([1,1])
square(0.1); square(0.1);
@ -392,18 +356,18 @@ module profile_cutter(h, length, s) {
square(0.1); square(0.1);
} }
difference() { difference() {
translate([length-scoop-2*r_f2, scoop]) translate([l-scoop-2*r_f2, scoop])
if (scoop != 0) { if (scoop != 0) {
intersection() { intersection() {
circle(scoop); circle(scoop);
mirror([0,1]) square(2*scoop); mirror([0,1]) square(2*scoop);
} }
} else mirror([1,0]) square(0.1); } else mirror([1,0]) square(0.1);
translate([length-scoop-2*r_f2,-1]) translate([l-scoop-2*r_f2,-1])
square([-(length-scoop-2*r_f2),2*h]); square([-(l-scoop-2*r_f2),2*h]);
translate([0,h]) translate([0,h])
square([2*length,scoop]); square([2*l,scoop]);
} }
} }
} }

View file

@ -27,7 +27,7 @@ $fs = 0.25;
/* [General Settings] */ /* [General Settings] */
// number of bases along x-axis // number of bases along x-axis
gridx = 2; gridx = 2.5;
// number of bases along y-axis // number of bases along y-axis
gridy = 2; gridy = 2;
// bin height. See bin height information and "gridz_define" below. // bin height. See bin height information and "gridz_define" below.
@ -50,6 +50,8 @@ enable_hole_slit = true;
enable_zsnap = false; enable_zsnap = false;
// enable upper lip for stacking other bins // enable upper lip for stacking other bins
enable_lip = true; enable_lip = true;
// disable the screw part of base holes
enable_screw = true;
// internal fillet for easy part removal // internal fillet for easy part removal
scoop = true; scoop = true;
@ -63,11 +65,12 @@ tab_style = 0; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
// overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm // overrides internal block height of bin (for solid containers). Leave zero for default height. Units: mm
height_internal = 0; height_internal = 0;
/* [Test] */ // Automatically guess the ideal base dividing values based on gridx and gridy (if they are integers, defaults to 1)
// multiplier for bases along X axis. For example, if you wanted a gridx of 1.5, setting this to 0.5 would get you 3 bases divided along X that are compatible with the provided length. (default: 1, intended to work between 0 and 1) div_base_auto = true;
divbasex = 1; // number of divisions per 1 unit of base along the X axis. For instance, a value of 3 would make 3 mini-bases per length. (default 1, only use integers)
// multiplier for bases along Y axis. For example, if you wanted a gridy of 1.5, setting this to 0.5 would get you 3 bases divided along Y that are compatible with the provided length. (default: 1, intended to work between 0 and 1) div_base_x = 1;
divbasey = 1; // number of divisions per 1 unit of base along the Y axis. For instance, a value of 3 would make 3 mini-bases per length. (default 1, only use integers)
div_base_y = 1;
// ===== Commands ===== // // ===== Commands ===== //
@ -76,34 +79,54 @@ color("tomato")
// ===== Reference Dimensions ===== // // ===== Reference Dimensions ===== //
/*[Other Miscellaneous Features]*/ /*[Other Miscellaneous Features]*/
h_base = 5; // height of the base // height of the base
r_base = 4; // outside rounded radius of bin h_base = 5;
r_c1 = 0.8; // lower base chamfer "radius" // outside rounded radius of bin
r_c2 = 2.4; // upper base chamfer "radius" r_base = 4;
h_bot = 2.2; // bottom thiccness of bin // lower base chamfer "radius"
r_fo1 = 7.5+1; // outside radii r_c1 = 0.8;
// upper base chamfer "radius"
r_c2 = 2.4;
// bottom thiccness of bin
h_bot = 2.2;
// outside radii 1
r_fo1 = 8.5;
// outside radii 2
r_fo2 = 3.2; r_fo2 = 3.2;
// outside radii 3
r_fo3 = 1.6; r_fo3 = 1.6;
r_hole1 = 1.5; // screw hole radius // screw hole radius
r_hole2 = 3.25; // magnet hole radius r_hole1 = 1.5;
d_hole = 26; // center-to-center distance between holes // magnet hole radius
h_hole = 2.4; // magnet hole depth r_hole2 = 3.25;
// center-to-center distance between holes
d_hole = 26;
// magnet hole depth
h_hole = 2.4;
r_f1 = 0.6; // top edge fillet radius // top edge fillet radius
r_f2 = 2.8; // internal fillet radius r_f1 = 0.6;
// internal fillet radius
r_f2 = 2.8;
d_div = 1.2; // width of divider between compartments // width of divider between compartments
d_wall = 0.95; // minimum wall thickness d_div = 1.2;
d_clear = 0.25; // tolerance fit factor // minimum wall thickness
d_wall = 0.95;
// tolerance fit factor
d_clear = 0.25;
d_tabh = 15.85; // height of tab (yaxis, measured from inner wall) // height of tab (yaxis, measured from inner wall)
d_tabw = length; // maximum width of tab d_tabh = 15.85;
// maximum width of tab
d_tabw = 42;
// angle of tab
a_tab = 36; a_tab = 36;
// ===== Include ===== // // ===== Include ===== //
include <gridfinity-rebuilt-base.scad> include <gridfinity-rebuilt-utility.scad>

View file

@ -0,0 +1,46 @@
{
"fileFormatVersion": "1",
"parameterSets": {
"New set 1": {
"$fa": "8",
"$fs": "0.25",
"a_tab": "40",
"bottom_layer": "3",
"d_clear": "0.25",
"d_div": "1.2",
"d_hole": "26",
"d_tabh": "15.85",
"d_wall": "0.94999999999999996",
"enable_funnel": "true",
"enable_holes": "true",
"enable_inset": "true",
"enable_lip": "true",
"enable_pinch": "true",
"enable_scoop_chamfer": "true",
"enable_zsnap": "false",
"gridx": "2",
"gridy": "2",
"gridz": "6",
"gridz_define": "0",
"h_base": "5",
"h_hole": "2.3999999999999999",
"layer": "0.34999999999999998",
"length": "42",
"n_divx": "3",
"nozzle": "0.59999999999999998",
"r_base": "4",
"r_c1": "0.80000000000000004",
"r_c2": "2.3999999999999999",
"r_f1": "0.59999999999999998",
"r_f2": "2.7999999999999998",
"r_fo1": "7.5",
"r_fo2": "3.2000000000000002",
"r_fo3": "1.6000000000000001",
"r_hole1": "1.5",
"r_hole2": "3.25",
"style_base": "0",
"style_tab": "0",
"type": "1"
}
}
}

View file

@ -2,15 +2,15 @@
$fa = 8; $fa = 8;
$fs = 0.25; $fs = 0.25;
/* [Bin or Base] */
type = 0; // [0:bin, 1:base]
// ===== COMMANDS ===== // // ===== COMMANDS ===== //
color("tomato") color("tomato")
// Generate a single base if (type != 0) gridfinityBaseVase(); // Generate a single base
//gridfinityBaseVase(); else gridfinityVase(); // Generate the bin
// Generate the bin
gridfinityVase();
// ==================== // // ==================== //
@ -116,7 +116,7 @@ a_tab = 40;
// ===== Include ===== // // ===== Include ===== //
include <../gridfinity-rebuilt-base.scad> include <../gridfinity-rebuilt-utility.scad>
// ===== Constants ===== // // ===== Constants ===== //
@ -128,7 +128,7 @@ f2c = sqrt(2)*(sqrt(2)-1); // fillet to chamfer ratio
me = ((gridx*length-0.5)/n_divx)-nozzle*4-r_fo1-12.7-4; me = ((gridx*length-0.5)/n_divx)-nozzle*4-r_fo1-12.7-4;
me2 = min(d_tabw/1.8 + max(0,me), d_tabw/1.25); me2 = min(d_tabw/1.8 + max(0,me), d_tabw/1.25);
m = me2; m = me2;
d_ramp = f2c*r_scoop+d_wall2; d_ramp = f2c*(length*((d_height-2)/7+1)/12-r_f2)+d_wall2;
d_edge = ((gridx*length-0.5)/n_divx-d_tabw-r_fo1)/2; d_edge = ((gridx*length-0.5)/n_divx-d_tabw-r_fo1)/2;
n_st = d_edge < 2 && style_tab != 0 && style_tab != 6 ? 1 : style_tab == 1 && n_divx <= 1? 0 : style_tab; n_st = d_edge < 2 && style_tab != 0 && style_tab != 6 ? 1 : style_tab == 1 && n_divx <= 1? 0 : style_tab;