Merge pull request #89 from Ruudjhuu/hotfix/holes_at_corners

fix holes only on corners
This commit is contained in:
Ruud 2023-05-31 19:18:33 +02:00 committed by GitHub
commit 2fef9f6d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 21 deletions

View File

@ -92,7 +92,6 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
pattern_linear(gx, gy, length) {
render(convexity = 6) {
if (sm) block_base_hole(1);
if (sp == 1)
translate([0,0,-off])

View File

@ -57,7 +57,7 @@ style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and
// scoop weight percentage. 0 disables scoop, 1 is regular scoop. Any real number will scale the scoop.
scoop = 1; //[0:0.1:1]
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
style_corners = false;
only_corners = false;
/* [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]
@ -76,7 +76,7 @@ gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap
if (divx > 0 && divy > 0)
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop);
}
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole*(style_corners?p_corn:1));
gridfinityBase(gridx, gridy, l_grid, div_base_x, div_base_y, style_hole, only_corners=only_corners);
}

View File

@ -43,7 +43,7 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
/* [Base] */
style_hole = 0; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit]
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
style_corners = false;
only_corners = false;
// 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)
@ -56,27 +56,26 @@ bottom_layer = 1;
// Input all the cutter types in here
color("tomato")
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, l_grid, div_base_x, div_base_y, style_hole) {
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, l_grid, div_base_x, div_base_y, style_hole, only_corners) {
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = 0);
}
// ===== CONSTRUCTION ===== //
module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole) {
sh = style_hole*(style_corners?p_corn:1);
module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole, only_corners) {
difference() {
union() {
gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), 0, length)
children();
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, sh);
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, only_corners=only_corners);
}
difference() {
union() {
intersection() {
difference() {
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, sh, -d_wall*2, false);
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, -d_wall*2, false, only_corners=only_corners);
translate([-gridx*length/2,-gridy*length/2,2*h_base])
cube([gridx*length,gridy*length,1000]);
}

View File

@ -80,7 +80,7 @@ module profile_base() {
]);
}
module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) {
module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true, only_corners=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));
@ -97,8 +97,18 @@ module gridfinityBase(gx, gy, l, dx, dy, style_hole, off=0, final_cut=true) {
translate([0,0,-1])
rounded_rectangle(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001);
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
block_base(gx, gy, l, dbnx, dbny, style_hole, off);
if(only_corners) {
difference(){
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
block_base(gx, gy, l, dbnx, dbny, 0, off);
pattern_linear(2, 2, (gx-1)*length+d_hole, (gy-1)*length+d_hole)
block_base_hole(style_hole, off);
}
}
else {
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
block_base(gx, gy, l, dbnx, dbny, style_hole, off);
}
}
}
@ -107,11 +117,7 @@ module block_base(gx, gy, l, dbnx, dbny, style_hole, off) {
difference() {
block_base_solid(dbnx, dbny, l, off);
if (style_hole > 0)
if (style_hole % p_corn < 0.001)
pattern_linear(2, 2, (gx-1)*length+d_hole, (gy-1)*length+d_hole)
block_base_hole(style_hole / p_corn, off);
else
if (style_hole > 0)
pattern_circular(abs(l-d_hole_from_side/2)<0.001?1:4)
translate([l/2-d_hole_from_side, l/2-d_hole_from_side, 0])
block_base_hole(style_hole, off);

View File

@ -78,7 +78,4 @@ r_cb = 2.75;
// baseplate counterbore depth
h_cb = 3;
// minimum baseplate thickness (when skeletonized)
h_skel = 1;
// Prime numbers
p_corn = 401;
h_skel = 1;