hat.scad 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // ============================================================
  2. // Button Extension Hat — development scratch file
  3. // Mirrors the +Y wall button-hole geometry from cpu_case.scad
  4. // ============================================================
  5. use <ee04.scad>
  6. // Parameters copied from cpu_case.scad
  7. WALL = 2.0; // wall thickness (depth of hole)
  8. BTN_CX = [48.4, 39.1, 29.8, 20.4]; // PCB-relative button X centres
  9. BTN_CZ = 3.85; // button centre height above PCB bottom (calibrated)
  10. PCB_W = 41.22; // board width (Y axis)
  11. // Wall section dimensions (just enough context around one hole)
  12. WALL_W = 20;
  13. WALL_H = 16;
  14. HOLE_CX = WALL_W / 2;
  15. HOLE_CZ = WALL_H / 2;
  16. /* [Physical button] */
  17. BTN_ACTUATOR_D = 2.0; // measured button actuator diameter (<2 mm on EE04)
  18. /* [Slip fit — SLA resin] */
  19. SLIP_CLEAR = 0.15; // radial clearance per side; SLA tolerances are tight so 0.15 gives easy slip without slop
  20. /* [Plunger] */
  21. PLUNGER_D = BTN_ACTUATOR_D; // body and head diameter — matches button actuator
  22. HOLE_D = PLUNGER_D + 2 * SLIP_CLEAR; // wall cutout — slip fit around plunger body
  23. FLANGE_D = 2.9; // retention flange OD — keep current value
  24. FLANGE_T = 1.2; // flange thickness (axial)
  25. HEAD_H = 1.5; // how far head protrudes past exterior wall face
  26. /* [Rest clearance] */
  27. CLR_YP_CONTACT = 1.565; // calibrated: plunger tip just touches button at this value
  28. REST_CLEAR = 0.40; // axial gap added so a slightly thick print doesn't pre-press button at rest
  29. CLR_YP = CLR_YP_CONTACT + REST_CLEAR;
  30. // Plunger — origin at hole centre on the interior wall face (y=0).
  31. // At rest: flange front face flush with interior wall face; button spring holds it there.
  32. module plunger() {
  33. color("orange") union() {
  34. // Body: runs from flange back face through wall to back of head
  35. translate([0, -FLANGE_T, 0])
  36. rotate([-90, 0, 0])
  37. cylinder(d = PLUNGER_D, h = FLANGE_T + WALL + HEAD_H, $fn = 32);
  38. // Inner flange: sits inside the case, stops plunger escaping outward
  39. translate([0, -FLANGE_T, 0])
  40. rotate([-90, 0, 0])
  41. cylinder(d = FLANGE_D, h = FLANGE_T, $fn = 32);
  42. // Outer head: finger-press cap proud of exterior wall face
  43. translate([0, WALL, 0])
  44. rotate([-90, 0, 0])
  45. cylinder(d = PLUNGER_D, h = HEAD_H, $fn = 32);
  46. }
  47. }
  48. // Wall section: positive Y face is the exterior (matching cpu_case +Y exterior)
  49. difference() {
  50. cube([WALL_W, WALL, WALL_H]);
  51. translate([HOLE_CX, WALL + 0.1, HOLE_CZ])
  52. rotate([90, 0, 0])
  53. cylinder(d = HOLE_D, h = WALL + 0.2, $fn = 32);
  54. }
  55. // Plunger at rest — flange flush with interior wall face
  56. translate([HOLE_CX, 0, HOLE_CZ]) plunger();
  57. // EE04 board — aligned so BTN_CX[0] lines up with HOLE_CX and
  58. // BTN_CZ lines up with HOLE_CZ; PCB +Y edge sits CLR_YP behind interior wall face.
  59. translate([
  60. HOLE_CX - BTN_CX[0],
  61. -(PCB_W + CLR_YP),
  62. HOLE_CZ - BTN_CZ
  63. ]) EE04();