2022-10-11 08:09:58 +00:00
|
|
|
include <gridfinity-rebuilt-utility.scad>
|
2023-05-31 15:48:39 +00:00
|
|
|
include <standard.scad>
|
2022-10-11 08:09:58 +00:00
|
|
|
|
2022-11-17 19:58:46 +00:00
|
|
|
// ===== INFORMATION ===== //
|
2022-10-11 08:09:58 +00:00
|
|
|
/*
|
|
|
|
IMPORTANT: rendering will be better for analyzing the model if fast-csg is enabled. As of writing, this feature is only available in the development builds and not the official release of OpenSCAD, but it makes rendering only take a couple seconds, even for comically large bins. Enable it in Edit > Preferences > Features > fast-csg
|
|
|
|
|
|
|
|
https://github.com/kennetek/gridfinity-rebuilt-openscad
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2022-11-17 19:58:46 +00:00
|
|
|
// ===== PARAMETERS ===== //
|
|
|
|
|
2022-10-11 08:09:58 +00:00
|
|
|
/* [Setup Parameters] */
|
|
|
|
$fa = 8;
|
|
|
|
$fs = 0.25;
|
|
|
|
|
|
|
|
/* [General Settings] */
|
|
|
|
// number of bases along x-axis
|
2023-09-22 06:11:23 +00:00
|
|
|
gridx = 5;
|
|
|
|
// number of bases along y-axis
|
|
|
|
gridy = 5;
|
2022-10-11 08:09:58 +00:00
|
|
|
|
2022-12-27 21:22:36 +00:00
|
|
|
/* [Screw Together Settings - Defaults work for M3 and 4-40] */
|
|
|
|
// screw diameter
|
2022-12-30 18:55:26 +00:00
|
|
|
d_screw = 3.35;
|
2022-12-27 21:22:36 +00:00
|
|
|
// screw head diameter
|
2022-12-30 18:55:26 +00:00
|
|
|
d_screw_head = 5;
|
2022-12-27 21:22:36 +00:00
|
|
|
// screw spacing distance
|
2022-12-30 18:55:26 +00:00
|
|
|
screw_spacing = .5;
|
2022-12-27 21:22:36 +00:00
|
|
|
// number of screws per grid block
|
2022-12-30 20:45:06 +00:00
|
|
|
n_screws = 1; // [1:3]
|
2022-12-27 21:22:36 +00:00
|
|
|
|
|
|
|
|
2022-10-12 02:05:18 +00:00
|
|
|
/* [Fit to Drawer] */
|
2023-05-31 16:16:09 +00:00
|
|
|
// minimum length of baseplate along x (leave zero to ignore, will automatically fill area if gridx is zero)
|
2023-02-09 01:19:50 +00:00
|
|
|
distancex = 0;
|
2023-05-31 16:16:09 +00:00
|
|
|
// minimum length of baseplate along y (leave zero to ignore, will automatically fill area if gridy is zero)
|
2023-02-09 01:19:50 +00:00
|
|
|
distancey = 0;
|
2022-10-12 02:05:18 +00:00
|
|
|
|
2023-02-15 00:02:12 +00:00
|
|
|
// where to align extra space along x
|
|
|
|
fitx = 0; // [-1:0.1:1]
|
|
|
|
// where to align extra space along y
|
|
|
|
fity = 0; // [-1:0.1:1]
|
2023-01-27 18:37:58 +00:00
|
|
|
|
2022-10-12 02:05:18 +00:00
|
|
|
|
2022-10-12 01:34:02 +00:00
|
|
|
/* [Styles] */
|
2022-10-11 08:09:58 +00:00
|
|
|
|
2022-10-12 01:34:02 +00:00
|
|
|
// baseplate styles
|
2023-02-15 17:04:34 +00:00
|
|
|
style_plate = 0; // [0: thin, 1:weighted, 2:skeletonized, 3: screw together, 4: screw together minimal]
|
2022-10-11 08:09:58 +00:00
|
|
|
|
2022-10-12 01:34:02 +00:00
|
|
|
// enable magnet hole
|
2023-09-22 06:11:23 +00:00
|
|
|
enable_magnet = true;
|
2022-10-12 01:34:02 +00:00
|
|
|
|
2022-12-31 06:36:00 +00:00
|
|
|
// hole styles
|
2023-11-11 06:28:53 +00:00
|
|
|
style_hole = 2; // [0:none, 1:countersink, 2:counterbore]
|
2022-10-11 08:09:58 +00:00
|
|
|
|
|
|
|
|
2022-11-17 19:58:46 +00:00
|
|
|
// ===== IMPLEMENTATION ===== //
|
2023-02-22 20:33:01 +00:00
|
|
|
screw_together = (style_plate == 3 || style_plate == 4);
|
2022-10-11 08:09:58 +00:00
|
|
|
|
2023-09-22 06:11:23 +00:00
|
|
|
color("tomato")
|
2023-05-31 15:46:30 +00:00
|
|
|
gridfinityBaseplate(gridx, gridy, l_grid, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
|
2022-10-12 02:05:18 +00:00
|
|
|
|
|
|
|
|
2022-11-17 19:58:46 +00:00
|
|
|
// ===== CONSTRUCTION ===== //
|
2022-10-12 02:05:18 +00:00
|
|
|
|
2023-01-27 18:37:58 +00:00
|
|
|
module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fity) {
|
2023-09-22 06:11:23 +00:00
|
|
|
|
2022-12-19 19:26:42 +00:00
|
|
|
assert(gridx > 0 || dix > 0, "Must have positive x grid amount!");
|
|
|
|
assert(gridy > 0 || diy > 0, "Must have positive y grid amount!");
|
2022-12-30 20:46:33 +00:00
|
|
|
|
2023-09-22 06:11:23 +00:00
|
|
|
gx = gridx == 0 ? floor(dix/length) : gridx;
|
|
|
|
gy = gridy == 0 ? floor(diy/length) : gridy;
|
2024-01-06 01:04:01 +00:00
|
|
|
dx = max(gx*length-bp_xy_clearence, dix);
|
|
|
|
dy = max(gy*length-bp_xy_clearence, diy);
|
2023-02-16 01:57:02 +00:00
|
|
|
|
2023-02-22 20:33:01 +00:00
|
|
|
off = calculate_off(sp, sm, sh);
|
2022-10-12 01:34:02 +00:00
|
|
|
|
2024-01-06 01:04:01 +00:00
|
|
|
offsetx = dix < dx ? 0 : (gx*length-bp_xy_clearence-dix)/2*fitx*-1;
|
|
|
|
offsety = diy < dy ? 0 : (gy*length-bp_xy_clearence-diy)/2*fity*-1;
|
2024-01-06 16:37:37 +00:00
|
|
|
|
2022-10-12 01:34:02 +00:00
|
|
|
difference() {
|
2023-01-27 18:37:58 +00:00
|
|
|
translate([offsetx,offsety,h_base])
|
2022-10-12 01:34:02 +00:00
|
|
|
mirror([0,0,1])
|
2022-10-12 02:05:18 +00:00
|
|
|
rounded_rectangle(dx, dy, h_base+off, r_base);
|
2023-09-22 06:11:23 +00:00
|
|
|
|
2022-10-12 02:05:18 +00:00
|
|
|
gridfinityBase(gx, gy, length, 1, 1, 0, 0.5, false);
|
2023-09-22 06:11:23 +00:00
|
|
|
|
2023-01-27 18:37:58 +00:00
|
|
|
translate([offsetx,offsety,h_base-0.6])
|
2022-10-12 02:05:18 +00:00
|
|
|
rounded_rectangle(dx*2, dy*2, h_base*2, r_base);
|
2023-09-22 06:11:23 +00:00
|
|
|
|
2022-10-12 02:05:18 +00:00
|
|
|
pattern_linear(gx, gy, length) {
|
2023-04-23 02:33:27 +00:00
|
|
|
render(convexity = 6) {
|
2023-02-18 13:09:31 +00:00
|
|
|
|
2023-03-17 16:39:43 +00:00
|
|
|
if (sp == 1)
|
|
|
|
translate([0,0,-off])
|
|
|
|
cutter_weight();
|
2023-09-22 06:11:23 +00:00
|
|
|
else if (sp == 2 || sp == 3)
|
2023-03-17 16:39:43 +00:00
|
|
|
linear_extrude(10*(h_base+off), center = true)
|
|
|
|
profile_skeleton();
|
2023-09-22 06:11:23 +00:00
|
|
|
else if (sp == 4)
|
2023-03-17 16:39:43 +00:00
|
|
|
translate([0,0,-5*(h_base+off)])
|
|
|
|
rounded_square(length-2*r_c2-2*r_c1, 10*(h_base+off), r_fo3);
|
|
|
|
|
|
|
|
|
|
|
|
hole_pattern(){
|
|
|
|
if (sm) block_base_hole(1);
|
|
|
|
|
|
|
|
translate([0,0,-off])
|
|
|
|
if (sh == 1) cutter_countersink();
|
|
|
|
else if (sh == 2) cutter_counterbore();
|
|
|
|
}
|
2023-02-21 21:31:48 +00:00
|
|
|
}
|
2022-10-12 01:34:02 +00:00
|
|
|
}
|
2023-09-22 06:11:23 +00:00
|
|
|
if (sp == 3 || sp ==4) cutter_screw_together(gx, gy, off);
|
2022-12-27 21:22:36 +00:00
|
|
|
}
|
|
|
|
|
2022-10-12 01:34:02 +00:00
|
|
|
}
|
2022-10-11 08:09:58 +00:00
|
|
|
|
2023-09-22 06:11:23 +00:00
|
|
|
function calculate_off(sp, sm, sh) =
|
2023-02-22 20:33:01 +00:00
|
|
|
screw_together
|
|
|
|
? 6.75
|
|
|
|
:sp==0
|
|
|
|
?0
|
|
|
|
: sp==1
|
|
|
|
?bp_h_bot
|
|
|
|
:h_skel + (sm
|
|
|
|
?h_hole
|
|
|
|
: 0)+(sh==0
|
|
|
|
? d_screw
|
|
|
|
: sh==1
|
|
|
|
?d_cs
|
|
|
|
:h_cb);
|
|
|
|
|
2022-11-17 19:58:46 +00:00
|
|
|
module cutter_weight() {
|
2022-10-12 01:34:02 +00:00
|
|
|
union() {
|
|
|
|
linear_extrude(bp_cut_depth*2,center=true)
|
|
|
|
square(bp_cut_size, center=true);
|
|
|
|
pattern_circular(4)
|
|
|
|
translate([0,10,0])
|
|
|
|
linear_extrude(bp_rcut_depth*2,center=true)
|
|
|
|
union() {
|
2023-05-31 16:13:56 +00:00
|
|
|
square([bp_rcut_width, bp_rcut_length], center=true);
|
|
|
|
translate([0,bp_rcut_length/2,0])
|
2022-10-12 01:34:02 +00:00
|
|
|
circle(d=bp_rcut_width);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-02-18 13:09:31 +00:00
|
|
|
module hole_pattern(){
|
|
|
|
pattern_circular(4)
|
2023-05-31 15:46:30 +00:00
|
|
|
translate([l_grid/2-d_hole_from_side, l_grid/2-d_hole_from_side, 0]) {
|
2023-02-18 13:09:31 +00:00
|
|
|
render();
|
|
|
|
children();
|
|
|
|
}
|
|
|
|
}
|
2022-10-11 08:09:58 +00:00
|
|
|
|
2023-02-18 13:09:31 +00:00
|
|
|
module cutter_countersink(){
|
2023-09-22 06:11:23 +00:00
|
|
|
cylinder(r = r_hole1+d_clear, h = 100*h_base, center = true);
|
2023-02-18 13:09:31 +00:00
|
|
|
translate([0,0,d_cs])
|
|
|
|
mirror([0,0,1])
|
2023-09-22 06:11:23 +00:00
|
|
|
hull() {
|
2023-02-18 13:09:31 +00:00
|
|
|
cylinder(h = d_cs+10, r=r_hole1+d_clear);
|
2022-10-12 02:05:18 +00:00
|
|
|
translate([0,0,d_cs])
|
2023-02-18 13:09:31 +00:00
|
|
|
cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs);
|
2022-10-12 02:05:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-18 13:09:31 +00:00
|
|
|
module cutter_counterbore(){
|
|
|
|
cylinder(h=100*h_base, r=r_hole1+d_clear, center=true);
|
|
|
|
difference() {
|
|
|
|
cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true);
|
|
|
|
copy_mirror([0,1,0])
|
2023-09-22 06:11:23 +00:00
|
|
|
translate([-1.5*r_cb,r_hole1+d_clear+0.1,h_cb-h_slit])
|
2023-02-18 13:09:31 +00:00
|
|
|
cube([r_cb*3,r_cb*3, 10]);
|
2022-10-12 02:05:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-12 01:34:02 +00:00
|
|
|
module profile_skeleton() {
|
2023-09-22 06:11:23 +00:00
|
|
|
l = l_grid-2*r_c2-2*r_c1;
|
|
|
|
minkowski() {
|
2022-10-12 01:34:02 +00:00
|
|
|
difference() {
|
|
|
|
square([l-2*r_skel+2*d_clear,l-2*r_skel+2*d_clear], center = true);
|
|
|
|
pattern_circular(4)
|
2023-05-31 15:46:30 +00:00
|
|
|
translate([l_grid/2-d_hole_from_side,l_grid/2-d_hole_from_side,0])
|
2022-10-12 01:34:02 +00:00
|
|
|
minkowski() {
|
|
|
|
square([l,l]);
|
|
|
|
circle(r_hole2+r_skel+2);
|
2023-09-22 06:11:23 +00:00
|
|
|
}
|
2022-10-12 01:34:02 +00:00
|
|
|
}
|
|
|
|
circle(r_skel);
|
|
|
|
}
|
2022-12-27 21:22:36 +00:00
|
|
|
}
|
|
|
|
|
2022-12-30 18:55:26 +00:00
|
|
|
module cutter_screw_together(gx, gy, off) {
|
|
|
|
|
|
|
|
screw(gx, gy);
|
|
|
|
rotate([0,0,90])
|
|
|
|
screw(gy, gx);
|
2023-09-22 06:11:23 +00:00
|
|
|
|
2022-12-30 18:55:26 +00:00
|
|
|
module screw(a, b) {
|
|
|
|
copy_mirror([1,0,0])
|
2023-05-31 15:46:30 +00:00
|
|
|
translate([a*l_grid/2, 0, -off/2])
|
|
|
|
pattern_linear(1, b, 1, l_grid)
|
2022-12-30 18:55:26 +00:00
|
|
|
pattern_linear(1, n_screws, 1, d_screw_head + screw_spacing)
|
|
|
|
rotate([0,90,0])
|
2023-05-31 15:46:30 +00:00
|
|
|
cylinder(h=l_grid/2, d=d_screw, center = true);
|
2022-12-27 21:22:36 +00:00
|
|
|
}
|
2023-02-11 17:33:26 +00:00
|
|
|
}
|