eps = 0.01; infty = 100; wall = 1.5; cyl_r = 8 + 0.5; cyl_x = 26.4 / 2; cyl_h = 8; // above pcb, max 13.8; pcb_x = 45.6 + 1.2; pcb_y = 20.2 + 1.0; xtal_h = 5; pcb_supp = 3; // side support thickness pcb_h = 8; // 1.2 + space for connector etc pcb_thick = 2.5; cyl_base = pcb_x/2 + wall - cyl_x; conn_x = 18 + 2*wall; conn_z0 = 8; conn_y = 5; conn_x0 = conn_x - 1.5*conn_z0; conn_len = 35; screw_head = 7.5; screw_d = 4; screw_base = 2*wall; clip_r = 1; clip_h = 8; module sensor() { hull() { // space above pcb translate([-pcb_x/2, -pcb_y/2, -eps]) cube([pcb_x, pcb_y, pcb_h-pcb_thick+eps]); // connector translate([-conn_x/2, pcb_y/2-eps, -eps]) cube([conn_x, conn_y+eps, pcb_h-pcb_thick+eps]); } // cable cover hole hull() { translate([-conn_x0/2+wall, pcb_y/2-eps, conn_z0-1.5*wall-eps]) cube([conn_x0-2*wall, conn_y+conn_len+2*eps, pcb_h+cyl_h+wall+eps-conn_z0]); translate([-conn_x/2+1.5*wall, pcb_y/2-eps, -wall]) cube([conn_x-3*wall, conn_y+conn_len+2*eps, pcb_h+cyl_h+wall-conn_z0]); } // cylinders for (x = [-1, 1]) translate([cyl_x*x, 0, pcb_h - eps]) cylinder(r = cyl_r, h = cyl_h + 2+wall + eps); // pcb translate([-pcb_x/2, -pcb_y/2, pcb_h-pcb_thick-eps]) cube([pcb_x, pcb_y, pcb_thick+eps]); // space below the pcb (xtal, etc) translate([-pcb_x/2+pcb_supp, -pcb_y/2, pcb_h-pcb_thick - eps]) cube([pcb_x - 2*pcb_supp, pcb_y, xtal_h+pcb_thick+eps]); }; module case_body() { hull() { // pcb translate([-pcb_x/2-wall, -pcb_y/2-wall, 0]) cube([pcb_x+2*wall, pcb_y+2*wall, pcb_h+wall]); // cylinders for (x = [-1, 1]) translate([cyl_x*x, 0, pcb_h + cyl_h]) cylinder(r = cyl_base, h = wall); // front (see cable cover) translate([-conn_x0/2, conn_y+pcb_y/2, conn_z0-eps]) cube([conn_x0, wall, pcb_h+cyl_h+wall+eps-conn_z0]); translate([-conn_x/2, conn_y+pcb_y/2, 0]) cube([conn_x, wall, pcb_h+cyl_h+wall-conn_z0]); // screw mounts for (x = [1, -1]) scale([x, 1, 1]) translate([pcb_x/2+wall, -screw_head/2-wall, 0]) cube([screw_head, screw_head+2*wall, screw_base]); } // cable cover hull() { translate([-conn_x0/2, conn_y+pcb_y/2, conn_z0-eps]) cube([conn_x0, conn_len, pcb_h+cyl_h+wall+eps-conn_z0]); translate([-conn_x/2, conn_y+pcb_y/2, 0]) cube([conn_x, conn_len, pcb_h+cyl_h+wall-conn_z0]); } } module case() { difference() { case_body(); difference() { sensor(); // pcb clip translate([-clip_h/2, -pcb_y/2, pcb_h-pcb_thick-clip_r/2]) rotate([0, 90, 0]) cylinder(r=clip_r, h = clip_h, $fn = 4); } // mount holes for (x = [-1, 1]) scale([x, 1, 1]) { translate([pcb_x/2+wall, -screw_head/2, screw_base]) cube([screw_head+eps, screw_head, infty]); // screw hole translate([pcb_x/2+wall+screw_head/2-screw_d/2, -screw_head/2, -eps]) cube([screw_d, screw_head, infty]); } // text translate([0, 3.5, pcb_h + cyl_h + eps]) rotate([0, 0, 90]) linear_extrude(height=wall) text("CVT FI", font="DejaVu Sans:style=Bold", size=5, halign="center", valign="center"); } } rotate([180, 0, 0]) // rotate it for easier print case();