add chamfer as an option

This commit is contained in:
Louis Beal 2024-01-08 22:00:00 +00:00
parent e16353c03f
commit afa4b3e47e
2 changed files with 9 additions and 7 deletions

4
gridfinity-rebuilt-bins.scad Normal file → Executable file
View file

@ -72,6 +72,8 @@ style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and
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;
// chamfer out magnet holes for easier magnet insertion
chamfer_holes = true;
/* [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]
@ -96,7 +98,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);
}
}
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, style_hole, only_corners=only_corners, chamfer_holes=chamfer_holes);
}

View file

@ -113,7 +113,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, style_hole, off=0, final_cut=true, only_corners=false, chamfer_holes=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));
@ -133,19 +133,19 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only
if(only_corners) {
difference(){
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
block_base(gx, gy, l, dbnx, dbny, 0, off);
block_base(gx, gy, l, dbnx, dbny, 0, off, chamfer_holes);
pattern_linear(2, 2, (gx-1)*l_grid+d_hole, (gy-1)*l_grid+d_hole)
block_base_hole(style_hole, off);
block_base_hole(style_hole, off, chamfer_holes);
}
}
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, style_hole, off, chamfer_holes);
}
}
}
module block_base(gx, gy, l, dbnx, dbny, style_hole, off) {
module block_base(gx, gy, l, dbnx, dbny, style_hole, off, chamfer_holes) {
render(convexity = 2)
difference() {
block_base_solid(dbnx, dbny, l, off);
@ -157,7 +157,7 @@ module block_base(gx, gy, l, dbnx, dbny, style_hole, off) {
refined_hole();
else
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0])
block_base_hole(style_hole, off);
block_base_hole(style_hole, off, chamfer_holes);
}
}