$fn = $preview ? 18 : 360; include use // dimensions of the esp esp_w = 23; esp_d = 19+4; lid_h = 0.75 ; // horizontal spacing between the case and the esp esp_s = 3; // wall thickness of the case wall_t = 2; // screw alignment wall thickness screw_wall_t = 2; inner_screw_t = 5; //make sure that this is thicker then the diameter of a wall edge //assert(screw_wall_t > sqrt(2*pow(wall_t,2)), "screw wall too thin, screw may intersect with the interiour of the case"); module case() { module esp_space(offset) { cube([ esp_w + esp_s + offset*2, esp_d + esp_s + offset*2, lid_h + offset + 0.001 ]); } esp_space(wall_t); } a = (sqrt(2)*(screw_wall_t*2 + inner_screw_t)*0.25)-wall_t; module screw_cylinder(d, h_diff, offset_x, offset_y) { translate([offset_x,offset_y,-h_diff/2]) cylinder( lid_h + wall_t+h_diff, d = d ); } difference() { union() { case(); screw_cylinder(screw_wall_t*2 + inner_screw_t, 0, -a, -a); //screw_cylinder(screw_wall_t*2 + inner_screw_t, 0, a+esp_w+esp_s+wall_t*2, -a); //screw_cylinder(screw_wall_t*2 + inner_screw_t, 0, -a, a+esp_d+esp_s+wall_t*2); screw_cylinder(screw_wall_t*2 + inner_screw_t, 0, a+esp_w+esp_s+wall_t*2, a+esp_d+esp_s+wall_t*2); } screw_cylinder(inner_screw_t, 0.01, -a, -a); //screw_cylinder(inner_screw_t, 0.01, a+esp_w+esp_s+wall_t*2, -a); //screw_cylinder(inner_screw_t, 0.01, -a, a+esp_d+esp_s+wall_t*2); screw_cylinder(inner_screw_t, 0.01, a+esp_w+esp_s+wall_t*2, a+esp_d+esp_s+wall_t*2); }