// OpenSCAD generator values $fn=100; // facets // Given values pir_length = 32.6; // mm pir_width = 24.5; // mm pir_height = 30; // mm pir_diameter = pir_width; // mm roof_angle = 120; // degrees wire_diameter = 10; // mm wall_thickness = 4; // mm print_margin = 0.1; // mm fillet_angle = 2; // mm // Derived values total_length = 2 * (tan(roof_angle/2) * (pir_height + wall_thickness)) + pir_length + print_margin; // mm total_width = 2 * wall_thickness + pir_width + print_margin; //mm total_height = (total_length / 2) / tan(roof_angle/2); // -------------------------------- module screwhole() { union() { cylinder(h=30, r=3); cylinder(h=3, r1=6, r2=3); } } difference() { // main body polyhedron( points = [[-total_length/2, -total_width/2, 0], [total_length/2, -total_width/2, 0], [total_length/2, total_width/2, 0], [-total_length/2, total_width/2, 0], [0, -total_width/2, total_height], [0, total_width/2, total_height]], faces = [[0,1,2,3], // clockwise defined [4,1,0], [5,4,0,3], [4,5,2,1], [5,3,2]] ); // sensor union() { translate([(-pir_length-print_margin)/2, (-pir_width-print_margin)/2, wall_thickness]) cube([pir_length + print_margin, pir_width + print_margin, pir_height*2]); cylinder(h=wall_thickness, r=(pir_width+print_margin)/2); }; // screw hole left translate([-total_length/4,0, 0]) screwhole(); // screw hole right translate([total_length/4,0, 0]) screwhole(); // wire hole translate([0, -total_width/2 + wall_thickness, total_height-wire_diameter/2]) rotate([90, 0, 0]) cylinder(h=wall_thickness, r=(wire_diameter+print_margin)/2); };