Merge pull request #75 from Ruudjhuu/performance

improve performance
This commit is contained in:
Kenneth 2023-03-17 09:41:21 -07:00 committed by GitHub
commit f8f3baefb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 34 deletions

View file

@ -16,9 +16,9 @@ $fs = 0.25;
/* [General Settings] */
// number of bases along x-axis
gridx = 4;
gridx = 5;
// number of bases along y-axis
gridy = 4;
gridy = 5;
// base unit
length = 42;
@ -92,23 +92,27 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
rounded_rectangle(dx*2, dy*2, h_base*2, r_base);
pattern_linear(gx, gy, length) {
if (sp == 1)
translate([0,0,-off])
cutter_weight();
else if (sp == 2 || sp == 3)
linear_extrude(10*(h_base+off), center = true)
profile_skeleton();
else if (sp == 4)
translate([0,0,-5*(h_base+off)])
rounded_square(length-2*r_c2-2*r_c1, 10*(h_base+off), r_fo3);
hole_pattern(){
render() {
if (sm) block_base_hole(1);
translate([0,0,-off])
if (sh == 1) cutter_countersink();
else if (sh == 2) cutter_counterbore();
if (sp == 1)
translate([0,0,-off])
cutter_weight();
else if (sp == 2 || sp == 3)
linear_extrude(10*(h_base+off), center = true)
profile_skeleton();
else if (sp == 4)
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();
}
}
}
if (sp == 3 || sp ==4) cutter_screw_together(gx, gy, off);

View file

@ -29,9 +29,9 @@ $fs = 0.25;
/* [General Settings] */
// number of bases along x-axis
gridx = 1;
gridx = 5;
// number of bases along y-axis
gridy = 1;
gridy = 5;
// bin height. See bin height information and "gridz_define" below.
gridz = 6;
// base unit

View file

@ -97,24 +97,27 @@ 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);
render()
difference() {
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
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
pattern_linear(gx, gy, l)
pattern_circular(abs(d_hole)<0.001?1:4)
translate([d_hole/2, d_hole/2, 0])
block_base_hole(style_hole, off);
}
pattern_linear(gx/dbnx, gy/dbny, dbnx*l, dbny*l)
block_base(gx, gy, l, dbnx, dbny, style_hole, off);
}
}
module block_base(gx, gy, l, dbnx, dbny, style_hole, off) {
render()
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
pattern_circular(abs(d_hole)<0.001?1:4)
translate([d_hole/2, d_hole/2, 0])
block_base_hole(style_hole, off);
}
}
module block_base_solid(dbnx, dbny, l, o) {
xx = dbnx*l-0.05;
yy = dbny*l-0.05;