generalized lite version

This commit is contained in:
kennetek 2022-11-05 23:19:56 -07:00
parent 189795a23f
commit 705ab42ff3
3 changed files with 100 additions and 60 deletions

View file

@ -27,9 +27,9 @@ $fs = 0.25;
/* [General Settings] */ /* [General Settings] */
// number of bases along x-axis // number of bases along x-axis
gridx = 2; gridx = 1;
// number of bases along y-axis // number of bases along y-axis
gridy = 2; gridy = 1;
// bin height. See bin height information and "gridz_define" below. // bin height. See bin height information and "gridz_define" below.
gridz = 6; gridz = 6;
// base unit // base unit
@ -48,7 +48,7 @@ enable_scoop = 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;
// remove flat bottom // remove flat bottom to save material
lite_mode = true; lite_mode = true;
/* [Other] */ /* [Other] */
@ -61,7 +61,7 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
height_internal = 0; height_internal = 0;
/* [Base] */ /* [Base] */
style_hole = 1; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit] style_hole = 3; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit]
// number of divisions per 1 unit of base along the X axis. (default 1, only use integers. 0 means automatically guess the right division) // 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; 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) // number of divisions per 1 unit of base along the Y axis. (default 1, only use integers. 0 means automatically guess the right division)
@ -71,8 +71,7 @@ div_base_y = 0;
// ===== Commands ===== // // ===== Commands ===== //
/* color("tomato") {
*color("tomato") {
gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), height_internal, length) { gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), height_internal, length) {
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, enable_scoop = enable_scoop); cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, enable_scoop = enable_scoop);
@ -80,25 +79,6 @@ gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsna
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole); gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole);
} }
*/
color("tomato")
gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), height_internal, length) {
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, enable_scoop = enable_scoop);
if(lite_mode)
block_base_cutout();
}
if(lite_mode) {
difference() {
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole);
block_base_cutout();
}
}
else {
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole);
}
// ===== Examples ===== // ===== Examples =====

View file

@ -0,0 +1,79 @@
include <gridfinity-rebuilt-utility.scad>
/* [Setup Parameters] */
$fa = 8;
$fs = 0.25;
/* [General Settings] */
// number of bases along x-axis
gridx = 3;
// number of bases along y-axis
gridy = 3;
// bin height. See bin height information and "gridz_define" below.
gridz = 6;
// base unit
length = 42;
/* [Compartments] */
// number of X Divisions
divx = 2;
// number of y Divisions
divy = 2;
/* [Toggles] */
// snap gridz height to nearest 7mm increment
enable_zsnap = false;
// enable upper lip for stacking other bins
enable_lip = true;
/* [Other] */
// determine what the variable "gridz" applies to based on your use case
gridz_define = 0; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters]
// the type of tabs
style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
/* [Base] */
style_hole = 3; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit]
// 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;
// Input all the cutter types in here
module cutterInput() {
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, enable_scoop = false);
}
// Does the necessary operations to get the base geometry
color("tomato")
difference() {
union() {
gridfinityInit(gridx, gridy, height(gridz, gridz_define, enable_lip, enable_zsnap), 0, length) {
cutterInput();
}
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole);
}
difference() {
union() {
intersection() {
difference() {
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, -d_wall*2, false);
translate([-gridx*length/2,-gridy*length/2,2*h_base])
cube([gridx*length,gridy*length,1000]);
}
translate([0,0,-1])
rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2);
}
translate([0,0,h_base+d_clear])
rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, h_base, r_f2);
}
translate([0,0,-4*h_base])
gridfinityInit(gridx, gridy, height(20,0), 0, length)
cutterInput();
}
}

View file

@ -27,6 +27,7 @@ module gridfinityInit(gx, gy, h, h0 = 0, l) {
$gxx = gx; $gxx = gx;
$gyy = gy; $gyy = gy;
$dh = h; $dh = h;
$dh0 = h0;
color("tomato") { color("tomato") {
difference() { difference() {
color("firebrick") color("firebrick")
@ -61,7 +62,7 @@ module cut(x=0, y=0, w=1, h=1, t=1, s=true) {
// Translates an object from the origin point to the center of the requested compartment block, can be used to add custom cuts in the bin // Translates an object from the origin point to the center of the requested compartment block, can be used to add custom cuts in the bin
// See cut() module for parameter descriptions // See cut() module for parameter descriptions
module cut_move(x, y, w, h) { module cut_move(x, y, w, h) {
translate([0,0,height_internal==0?$dh+h_base:height_internal+h_base]) translate([0,0,$dh0==0?$dh+h_base:$dh0+h_base])
cut_move_unsafe(clp(x,0,$gxx), clp(y,0,$gyy), clp(w,0,$gxx-x), clp(h,0,$gyy-y)) cut_move_unsafe(clp(x,0,$gxx), clp(y,0,$gyy), clp(w,0,$gxx-x), clp(h,0,$gyy-y))
children(); children();
} }
@ -87,6 +88,7 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) {
xx = gx*l-0.5; xx = gx*l-0.5;
yy = gy*l-0.5; yy = gy*l-0.5;
if (final_cut)
translate([0,0,h_base]) translate([0,0,h_base])
rounded_rectangle(xx+0.002, yy+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);
@ -102,7 +104,7 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) {
if (style_hole > 0) if (style_hole > 0)
pattern_linear(gx, gy, l) pattern_linear(gx, gy, l)
block_base_hole(style_hole); block_base_hole(style_hole, off);
} }
} }
} }
@ -118,52 +120,31 @@ module block_base_solid(dbnx, dbny, l, o) {
rounded_rectangle(xx-2*r_c2-2*r_c1+o, yy-2*r_c2-2*r_c1+o, h_base+oo, r_fo3/2); rounded_rectangle(xx-2*r_c2-2*r_c1+o, yy-2*r_c2-2*r_c1+o, h_base+oo, r_fo3/2);
rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o, h_base-r_c1+oo, r_fo2/2); rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o, h_base-r_c1+oo, r_fo2/2);
} }
translate([0,0,oo])
hull() { hull() {
rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o,r_c2+oo, r_fo2/2); rounded_rectangle(xx-2*r_c2+o, yy-2*r_c2+o, r_c2, r_fo2/2);
mirror([0,0,1]) mirror([0,0,1])
rounded_rectangle(xx+o, yy+o, h_bot/2+oo, r_fo1/2); rounded_rectangle(xx+o, yy+o, h_bot/2+abs(10*o), r_fo1/2);
} }
} }
} }
module block_base_hole(style_hole) { module block_base_hole(style_hole, o) {
r1 = r_hole1-o/2;
r2 = r_hole2-o/2;
pattern_circular(4) pattern_circular(4)
translate([d_hole/2, d_hole/2, 0]) translate([d_hole/2, d_hole/2, 0])
union() { union() {
difference() { difference() {
cylinder(h = 2*(h_hole+(style_hole==3?0.2:0)), r=r_hole2, center=true); cylinder(h = 2*(h_hole-o+(style_hole==3?0.2:0)), r=r2, center=true);
if (style_hole==3) if (style_hole==3)
copy_mirror([0,1,0]) copy_mirror([0,1,0])
translate([-1.5*r_hole2,r_hole1+0.1,h_hole]) translate([-1.5*r2,r1+0.1,h_hole-o])
cube([r_hole2*3,r_hole2*3, 0.4]); cube([r2*3,r2*3, 0.4]);
} }
if (style_hole > 1) if (style_hole > 1)
cylinder(h = 3*h_base, r = r_hole1, center=true); cylinder(h = 2*h_base-o, r = r1, center=true);
}
}
module block_base_cutout(){
squidge=-2.5;
translate([0,0,h_base-2.5])
//rounded_rectangle(gridx*length-0.5+0.002, gridy*length-0.5+0.002, h_bot/1.5, r_fo1/2+0.001);
pattern_linear(gridx, gridy, length)
render()
difference() {
translate([0,0,h_base])
mirror([0,0,1])
union() {
hull() {
rounded_square(squidge+length-0.5-2*r_c2-2*r_c1, h_base+0.5, r_fo3/2);
rounded_square(squidge+length-0.5-2*r_c2, h_base-r_c1+0.5, r_fo2/2);
}
hull() {
rounded_square(squidge+length-0.5-2*r_c2, r_c2, r_fo2/2);
mirror([0,0,1])
rounded_square(squidge+length-0.5, h_bot/2, r_fo1/2);
}
}
} }
} }