Merge pull request #19 from rcarmo/main

Gridfinity Lite support (closes #14)
This commit is contained in:
Kenneth 2022-11-06 12:22:29 -07:00 committed by GitHub
commit ad805fec39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 15 deletions

View file

@ -27,9 +27,9 @@ $fs = 0.25;
/* [General Settings] */
// number of bases along x-axis
gridx = 2;
gridx = 1;
// number of bases along y-axis
gridy = 2;
gridy = 1;
// bin height. See bin height information and "gridz_define" below.
gridz = 6;
// base unit
@ -48,6 +48,8 @@ enable_scoop = true;
enable_zsnap = false;
// enable upper lip for stacking other bins
enable_lip = true;
// remove flat bottom to save material
lite_mode = true;
/* [Other] */
// determine what the variable "gridz" applies to based on your use case
@ -59,7 +61,7 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
height_internal = 0;
/* [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)
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)
@ -70,7 +72,6 @@ div_base_y = 0;
// ===== Commands ===== //
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);

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;
$gyy = gy;
$dh = h;
$dh0 = h0;
color("tomato") {
difference() {
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
// See cut() module for parameter descriptions
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))
children();
}
@ -87,6 +88,7 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) {
xx = gx*l-0.5;
yy = gy*l-0.5;
if (final_cut)
translate([0,0,h_base])
rounded_rectangle(xx+0.002, yy+0.002, h_bot/1.5, r_fo1/2+0.001);
@ -102,12 +104,12 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) {
if (style_hole > 0)
pattern_linear(gx, gy, l)
block_base_hole(style_hole);
block_base_hole(style_hole, off);
}
}
}
module block_base_solid(dbnx, dbny, l, o) {
module block_base_solid(dbnx, dbny, l, o) {
xx = dbnx*l-0.05;
yy = dbny*l-0.05;
oo = (o/2)*(sqrt(2)-1);
@ -115,31 +117,34 @@ module block_base_solid(dbnx, dbny, l, o) {
mirror([0,0,1])
union() {
hull() {
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);
}
translate([0,0,oo])
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])
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)
translate([d_hole/2, d_hole/2, 0])
union() {
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)
copy_mirror([0,1,0])
translate([-1.5*r_hole2,r_hole1+0.1,h_hole])
cube([r_hole2*3,r_hole2*3, 0.4]);
translate([-1.5*r2,r1+0.1,h_hole-o])
cube([r2*3,r2*3, 0.4]);
}
if (style_hole > 1)
cylinder(h = 3*h_base, r = r_hole1, center=true);
cylinder(h = 2*h_base-o, r = r1, center=true);
}
}