mirror of
https://github.com/kennetek/gridfinity-rebuilt-openscad.git
synced 2024-11-29 19:43:57 +00:00
Merge branch 'main' into performance
This commit is contained in:
commit
adf460c6a1
1 changed files with 58 additions and 38 deletions
|
@ -58,6 +58,7 @@ style_hole = 2; // [0:none, 1:contersink, 2:counterbore]
|
||||||
|
|
||||||
|
|
||||||
// ===== IMPLEMENTATION ===== //
|
// ===== IMPLEMENTATION ===== //
|
||||||
|
screw_together = (style_plate == 3 || style_plate == 4);
|
||||||
|
|
||||||
color("tomato")
|
color("tomato")
|
||||||
gridfinityBaseplate(gridx, gridy, length, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
|
gridfinityBaseplate(gridx, gridy, length, distancex, distancey, style_plate, enable_magnet, style_hole, fitx, fity);
|
||||||
|
@ -75,7 +76,7 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
|
||||||
dx = max(gx*length-0.5, dix);
|
dx = max(gx*length-0.5, dix);
|
||||||
dy = max(gy*length-0.5, diy);
|
dy = max(gy*length-0.5, diy);
|
||||||
|
|
||||||
off = (sp==0?0:sp==1?bp_h_bot:h_skel+(sm?h_hole:0)+(sh==0?(sp!=3&&sp!=4)?0:d_screw:sh==1?d_cs:h_cb));
|
off = calculate_off(sp, sm, sh);
|
||||||
|
|
||||||
offsetx = dix < dx ? 0 : (gx*length-0.5-dix)/2*fitx*-1;
|
offsetx = dix < dx ? 0 : (gx*length-0.5-dix)/2*fitx*-1;
|
||||||
offsety = diy < dy ? 0 : (gy*length-0.5-diy)/2*fity*-1;
|
offsety = diy < dy ? 0 : (gy*length-0.5-diy)/2*fity*-1;
|
||||||
|
@ -104,7 +105,11 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
|
||||||
translate([0,0,-5*(h_base+off)])
|
translate([0,0,-5*(h_base+off)])
|
||||||
rounded_square(length-2*r_c2-2*r_c1, 10*(h_base+off), r_fo3);
|
rounded_square(length-2*r_c2-2*r_c1, 10*(h_base+off), r_fo3);
|
||||||
|
|
||||||
translate([0,0,-off]) {
|
|
||||||
|
hole_pattern(){
|
||||||
|
if (sm) block_base_hole(1);
|
||||||
|
|
||||||
|
translate([0,0,-off])
|
||||||
if (sh == 1) cutter_countersink();
|
if (sh == 1) cutter_countersink();
|
||||||
else if (sh == 2) cutter_counterbore();
|
else if (sh == 2) cutter_counterbore();
|
||||||
}
|
}
|
||||||
|
@ -115,6 +120,21 @@ module gridfinityBaseplate(gridx, gridy, length, dix, diy, sp, sm, sh, fitx, fit
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function calculate_off(sp, sm, sh) =
|
||||||
|
screw_together
|
||||||
|
? 6.75
|
||||||
|
:sp==0
|
||||||
|
?0
|
||||||
|
: sp==1
|
||||||
|
?bp_h_bot
|
||||||
|
:h_skel + (sm
|
||||||
|
?h_hole
|
||||||
|
: 0)+(sh==0
|
||||||
|
? d_screw
|
||||||
|
: sh==1
|
||||||
|
?d_cs
|
||||||
|
:h_cb);
|
||||||
|
|
||||||
module cutter_weight() {
|
module cutter_weight() {
|
||||||
union() {
|
union() {
|
||||||
linear_extrude(bp_cut_depth*2,center=true)
|
linear_extrude(bp_cut_depth*2,center=true)
|
||||||
|
@ -129,12 +149,16 @@ module cutter_weight() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
module hole_pattern(){
|
||||||
module cutter_countersink() {
|
|
||||||
pattern_circular(4)
|
pattern_circular(4)
|
||||||
translate([d_hole/2, d_hole/2, 0]) {
|
translate([d_hole/2, d_hole/2, 0]) {
|
||||||
cylinder(r = r_hole1+d_clear, h = 100*h_base, center = true);
|
render();
|
||||||
|
children();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module cutter_countersink(){
|
||||||
|
cylinder(r = r_hole1+d_clear, h = 100*h_base, center = true);
|
||||||
translate([0,0,d_cs])
|
translate([0,0,d_cs])
|
||||||
mirror([0,0,1])
|
mirror([0,0,1])
|
||||||
hull() {
|
hull() {
|
||||||
|
@ -143,11 +167,8 @@ module cutter_countersink() {
|
||||||
cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs);
|
cylinder(h=d_cs+10, r=r_hole1+d_clear+d_cs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
module cutter_counterbore(){
|
module cutter_counterbore(){
|
||||||
pattern_circular(4)
|
|
||||||
translate([d_hole/2,d_hole/2,0]) {
|
|
||||||
cylinder(h=100*h_base, r=r_hole1+d_clear, center=true);
|
cylinder(h=100*h_base, r=r_hole1+d_clear, center=true);
|
||||||
difference() {
|
difference() {
|
||||||
cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true);
|
cylinder(h = 2*(h_cb+0.2), r=r_cb, center=true);
|
||||||
|
@ -156,7 +177,6 @@ module cutter_counterbore() {
|
||||||
cube([r_cb*3,r_cb*3, 10]);
|
cube([r_cb*3,r_cb*3, 10]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
module profile_skeleton() {
|
module profile_skeleton() {
|
||||||
l = length-2*r_c2-2*r_c1;
|
l = length-2*r_c2-2*r_c1;
|
||||||
|
|
Loading…
Reference in a new issue