make all screw-togethers compatible in height

This commit is contained in:
Ruud Swinkels 2023-02-22 21:33:01 +01:00
parent b2104fbb97
commit ea426c4d40

View file

@ -58,6 +58,7 @@ style_hole = 1; // [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||sp==3||sp==4?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;
@ -115,6 +116,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)