mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2025-01-05 05:29:39 +00:00
Merge pull request #89 from Ruudjhuu/hotfix/holes_at_corners
fix holes only on corners
This commit is contained in:
commit
2fef9f6d70
5 changed files with 22 additions and 21 deletions
|
@ -92,7 +92,6 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
|
||||||
|
|
||||||
pattern_linear(gx, gy, length) {
|
pattern_linear(gx, gy, length) {
|
||||||
render(convexity = 6) {
|
render(convexity = 6) {
|
||||||
if (sm) block_base_hole(1);
|
|
||||||
|
|
||||||
if (sp == 1)
|
if (sp == 1)
|
||||||
translate([0,0,-off])
|
translate([0,0,-off])
|
||||||
|
|
|
@ -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 weight percentage. 0 disables scoop, 1 is regular scoop. Any real number will scale the scoop.
|
||||||
scoop = 1; //[0:0.1:1]
|
scoop = 1; //[0:0.1:1]
|
||||||
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
|
// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
|
||||||
style_corners = false;
|
only_corners = false;
|
||||||
|
|
||||||
/* [Base] */
|
/* [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]
|
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)
|
if (divx > 0 && divy > 0)
|
||||||
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = scoop);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
|
||||||
/* [Base] */
|
/* [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]
|
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
|
// 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)
|
// 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)
|
||||||
|
@ -56,27 +56,26 @@ bottom_layer = 1;
|
||||||
|
|
||||||
// Input all the cutter types in here
|
// Input all the cutter types in here
|
||||||
color("tomato")
|
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);
|
cutEqual(n_divx = divx, n_divy = divy, style_tab = style_tab, scoop_weight = 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===== CONSTRUCTION ===== //
|
// ===== CONSTRUCTION ===== //
|
||||||
|
|
||||||
|
|
||||||
module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole) {
|
module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole, only_corners) {
|
||||||
sh = style_hole*(style_corners?p_corn:1);
|
|
||||||
difference() {
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), 0, length)
|
gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), 0, length)
|
||||||
children();
|
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() {
|
difference() {
|
||||||
union() {
|
union() {
|
||||||
intersection() {
|
intersection() {
|
||||||
difference() {
|
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])
|
translate([-gridx*length/2,-gridy*length/2,2*h_base])
|
||||||
cube([gridx*length,gridy*length,1000]);
|
cube([gridx*length,gridy*length,1000]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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];
|
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];
|
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));
|
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])
|
translate([0,0,-1])
|
||||||
rounded_rectangle(xx+0.005, yy+0.005, h_base+h_bot/2*10, r_fo1/2+0.001);
|
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)
|
if(only_corners) {
|
||||||
block_base(gx, gy, l, dbnx, dbny, style_hole, off);
|
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() {
|
difference() {
|
||||||
block_base_solid(dbnx, dbny, l, off);
|
block_base_solid(dbnx, dbny, l, off);
|
||||||
|
|
||||||
if (style_hole > 0)
|
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
|
|
||||||
pattern_circular(abs(l-d_hole_from_side/2)<0.001?1:4)
|
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])
|
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);
|
||||||
|
|
|
@ -78,7 +78,4 @@ r_cb = 2.75;
|
||||||
// baseplate counterbore depth
|
// baseplate counterbore depth
|
||||||
h_cb = 3;
|
h_cb = 3;
|
||||||
// minimum baseplate thickness (when skeletonized)
|
// minimum baseplate thickness (when skeletonized)
|
||||||
h_skel = 1;
|
h_skel = 1;
|
||||||
|
|
||||||
// Prime numbers
|
|
||||||
p_corn = 401;
|
|
Loading…
Reference in a new issue