//snapFitMale([100, 30, 30], 10); //snapFitMaleF([100, 30, 30], 10); module snapFitMale(wdh, edgeCutD) { eps = 0.001; d = wdh[1] + edgeCutD; a = atan(wdh[2] / d); translate([0, -edgeCutD,0]) { difference() { cube([wdh[0], d, wdh[2]]); translate([-eps, 0,0]) { rotate([a,0,0]) { cube([wdh[0]+eps*2, d*2, wdh[2]*2]); } } translate([-eps, 0, -eps]) { cube([wdh[0]+eps*2, edgeCutD, wdh[2] + eps]); } } // diff } // bring to 0,0,0 } module snapFitMaleF(wdh, edgeCutD) { translate([wdh[0], 0, wdh[2]]) rotate([0,180,0]) snapFitMale(wdh,edgeCutD); } module snapFitFemale(wdh, edgeCutD, pad = 0) { d = wdh[1] + edgeCutD; cube([wdh[0], d, wdh[2]+pad]); }