mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-11-26 10:18:00 +00:00
fix holes only on corners
This commit is contained in:
parent
f8f3baefb0
commit
1b9f71b4b5
4 changed files with 22 additions and 20 deletions
|
@ -74,7 +74,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;
|
|
@ -59,7 +59,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]
|
||||
|
@ -78,7 +78,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, length, div_base_x, div_base_y, style_hole*(style_corners?p_corn:1));
|
||||
gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, only_corners=only_corners);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,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)
|
||||
|
@ -58,27 +58,26 @@ bottom_layer = 1;
|
|||
|
||||
// Input all the cutter types in here
|
||||
color("tomato")
|
||||
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole) {
|
||||
gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, 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]);
|
||||
}
|
||||
|
|
|
@ -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(d_hole)<0.001?1:4)
|
||||
translate([d_hole/2, d_hole/2, 0])
|
||||
block_base_hole(style_hole, off);
|
||||
|
|
Loading…
Reference in a new issue