ZiB 4 months ago
parent
commit
596bc5dd89
1 changed files with 23 additions and 14 deletions
  1. 23 14
      cpu_case.scad

+ 23 - 14
cpu_case.scad

@@ -46,6 +46,10 @@ SCREW_D       =  3.2;   // M3 tap drill diameter
 BOSS_D        =  6.0;   // PCB standoff boss outer diameter
 BOSS_H        =  2.0;   // standoff boss height; PCB bottom sits flush on boss top
 
+/* [Locating Studs] */
+STUD_CLEAR  =  0.10;   // radial clearance per side — close (non-interference) fit in SLA resin
+STUD_H      =  PCB_T + 1.0;   // stud height above boss top: through PCB + 1 mm proud
+
 /* [PCB Standoff Positions — relative to PCB origin] */
 PCB_BOSS_X1   =  2.5;
 PCB_BOSS_X2   =  PCB_L - 2.5;
@@ -92,14 +96,20 @@ module rounded_box(l, w, h, r) {
             translate([dx, dy, 0]) cylinder(r=r, h=h, $fn=32);
 }
 
-// Standoff boss: solid cylinder with through-hole (hole continues into floor via base diff)
-module pcb_boss(px, py) {
-    translate([PCB_OX + px, PCB_OY + py, FLOOR])
+// Standoff boss: screw variant has through-hole; stud variant has locating pin instead.
+// Diagonal (X1,Y1)+(X2,Y2) → studs; (X1,Y2)+(X2,Y1) → screws.
+module pcb_boss(px, py, stud=false) {
+    translate([PCB_OX + px, PCB_OY + py, FLOOR]) {
         difference() {
             cylinder(d=BOSS_D, h=BOSS_H + 0.01, $fn=24);
-            translate([0, 0, -0.1])
-                cylinder(d=SCREW_D * 0.7, h=BOSS_H + 0.2, $fn=18);
+            if (!stud)
+                translate([0, 0, -0.1])
+                    cylinder(d=SCREW_D * 0.7, h=BOSS_H + 0.2, $fn=18);
         }
+        if (stud)
+            translate([0, 0, BOSS_H])
+                cylinder(d=SCREW_D - 2*STUD_CLEAR, h=STUD_H, $fn=24);
+    }
 }
 
 // ============================================================
@@ -114,11 +124,10 @@ module base() {
             translate([WALL, WALL, FLOOR])
                 cube([CAV_L, CAV_W, BASE_H]);
 
-            // ---- Boss screw holes through 50 % of floor ----
-            for (bx = [PCB_BOSS_X1, PCB_BOSS_X2])
-                for (by = [PCB_BOSS_Y1, PCB_BOSS_Y2])
-                    translate([PCB_OX + bx, PCB_OY + by, FLOOR * 0.5 - 0.1])
-                        cylinder(d=SCREW_D * 0.7, h=FLOOR * 0.5 + 0.2, $fn=18);
+            // ---- Boss screw holes through 50 % of floor (screw diagonal only) ----
+            for (pos = [[PCB_BOSS_X1, PCB_BOSS_Y2], [PCB_BOSS_X2, PCB_BOSS_Y1]])
+                translate([PCB_OX + pos[0], PCB_OY + pos[1], FLOOR * 0.5 - 0.1])
+                    cylinder(d=SCREW_D * 0.7, h=FLOOR * 0.5 + 0.2, $fn=18);
 
             // ---- +Y wall cutouts ----
 
@@ -150,10 +159,10 @@ module base() {
         }
 
         // Standoff bosses (added outside diff so cavity doesn't subtract them)
-        pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y1);
-        pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y1);
-        pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y2);
-        pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y2);
+        pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y1, stud=true);   // stud diagonal
+        pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y2, stud=true);   // stud diagonal
+        pcb_boss(PCB_BOSS_X1, PCB_BOSS_Y2, stud=false);  // screw diagonal
+        pcb_boss(PCB_BOSS_X2, PCB_BOSS_Y1, stud=false);  // screw diagonal
     }
 
     // Lid-retention flanges — right triangles, wide face flush with case top (z=BASE_H),