lid.scad 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // Sliding lid for EE04 case — integrates epd_case as ceiling
  2. // z=0 = bottom of flanges; z=FLANGE_H = ceiling underside / epd_case backplate bottom
  3. include <params.scad>
  4. use <epd_case.scad>
  5. use <GDEY0583T81.scad>
  6. use <fpc_adapter.scad>
  7. /* [Preview] */
  8. SHOW_DISP = true;
  9. /* [FPC Adapter Mount] */
  10. ADAPT_SLOT_GAP = 10.0; // gap: adapter Y+ edge to slot Y- edge ← tune
  11. // Adapter board dimensions (must match fpc_adapter.scad PCB_W / PCB_H)
  12. _adpt_w = 32.0;
  13. _adpt_h = 18.0;
  14. // Derived adapter position in lid XY space
  15. _slot_y = LID_Y_LEN - 3 - FPC_U_DEPTH + FPC_U_T; // slot Y- edge
  16. _adapt_ox = PCB_OX + FPC_CX - _adpt_w / 2; // adapter PCB X- edge
  17. _adapt_oy = _slot_y - ADAPT_SLOT_GAP - _adpt_h; // adapter PCB Y- edge
  18. // ============================================================
  19. // LID (slide-on; enters from Y- face, closes toward Y+)
  20. // Flanges sit inside cavity and ride on base retention flange hypotenuses.
  21. // ============================================================
  22. module lid() {
  23. // Flanges: right triangles in XZ; hypotenuse at reciprocal angle to base retention flanges.
  24. // Wide vertical face at x=WALL+FLANGE_W (inner), tip at bottom-wall-face — same
  25. // (-FLANGE_W, -FLANGE_H) hypotenuse slope as base flanges so they mate when lid slides in.
  26. color("#2C3863") {
  27. // Left (X-) flange
  28. hull() {
  29. translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, 0, 0])
  30. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  31. translate([WALL + SLIDE_CLEAR, 0, -0.005])
  32. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
  33. }
  34. // Right (X+) flange
  35. hull() {
  36. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, 0, 0])
  37. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  38. translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, 0, -0.005])
  39. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
  40. }
  41. // Interior ribs — 2 mm wide
  42. translate([WALL + FLANGE_W - SLIDE_CLEAR, 0, 0])
  43. cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
  44. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR - 2.0, 0, 0])
  45. cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
  46. // Y+ locking flanges — angled wedge matching side-flange profile; split around FPC notch
  47. for (seg = [
  48. [FLANGE_W - SLIDE_CLEAR + 2.0,
  49. 2+PCB_OX + FPC_CX - FPC_NOTCH_W/2 - (WALL + FLANGE_W - SLIDE_CLEAR + 2.0)],
  50. [PCB_OX + FPC_CX + FPC_NOTCH_W/2,
  51. OUT_L - FLANGE_W + SLIDE_CLEAR - 2.0 - (PCB_OX + FPC_CX + FPC_NOTCH_W/2)]
  52. ]) {
  53. hull() {
  54. translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 0.01, 0])
  55. cube([seg[1], 0.01, FLANGE_H - SLIDE_CLEAR]);
  56. translate([seg[0], LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  57. cube([seg[1], 0.01, 0.01]);
  58. }
  59. // Backing rib — 2 mm deep on cavity face of flange, matches side-rib style
  60. translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 2.0, 0])
  61. cube([seg[1], 2.0, FLANGE_H]);
  62. }
  63. // Y+ corners — intersection of the X-prism and Y-prism in the corner region.
  64. // Equivalent to: cube with the X-flange relief cut AND the Y-flange relief cut applied.
  65. // Result tapers to zero height along both wall faces, producing a single shared edge.
  66. // Left corner (X-)
  67. intersection() {
  68. hull() {
  69. translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  70. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  71. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, -0.005])
  72. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, 0.01]);
  73. }
  74. hull() {
  75. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  76. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, FLANGE_H - SLIDE_CLEAR]);
  77. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  78. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, 0.01]);
  79. }
  80. }
  81. // Right corner (X+)
  82. intersection() {
  83. hull() {
  84. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  85. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  86. translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, -0.005])
  87. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, 0.01]);
  88. }
  89. hull() {
  90. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  91. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, FLANGE_H - SLIDE_CLEAR]);
  92. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  93. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, 0.01]);
  94. }
  95. }
  96. }
  97. color("#004B49")
  98. difference() {
  99. union() {
  100. if (!EPD_IS_LID)
  101. // Flat ceiling plate — test fit without epd_case geometry
  102. translate([0, -WALL, FLANGE_H])
  103. rounded_box(OUT_L, OUT_W, LID_T, CORNER_R);
  104. else
  105. translate([
  106. OUT_L/2 - epd_case_w/2,
  107. OUT_W - epd_case_d - WALL,
  108. LID_T
  109. ])
  110. epd_case();
  111. // Y- lip — same rounded_box profile clipped to the Y- wall zone so the
  112. // lip corners match the base exterior corners
  113. intersection() {
  114. translate([0, -WALL, FLANGE_H - LIP_H - SLIDE_CLEAR])
  115. rounded_box(OUT_L, OUT_W, LIP_H + SLIDE_CLEAR, CORNER_R);
  116. translate([-0.1, -WALL - 0.1, FLANGE_H - LIP_H - SLIDE_CLEAR - 0.1])
  117. cube([OUT_L + 0.2, WALL + 0.2, LIP_H + SLIDE_CLEAR + 0.2]);
  118. }
  119. }
  120. // FPC cable slot — from Y+ face of U-rib bottom bar, FPC_SLOT_W toward Y+
  121. translate([PCB_OX + FPC_CX - FPC_NOTCH_W/2,
  122. LID_Y_LEN - 3 - FPC_U_DEPTH + FPC_U_T,
  123. FLANGE_H - 0.1])
  124. cube([FPC_NOTCH_W, FPC_SLOT_W, LID_T + 0.2]);
  125. }
  126. // Display mockup — seated inside epd_case, preview only
  127. if ($preview && EPD_IS_LID && SHOW_DISP)
  128. translate([
  129. OUT_L/2 - epd_case_w/2 + WALL + TOL,
  130. OUT_W - epd_case_d - WALL + BEZEL_Y,
  131. LID_T + WALL
  132. ])
  133. GDEY0583T81(fpc_bend_start=0, fpc_bend_r=FPC_BEND_R, fpc_post_clip=2);
  134. // FPC adapter — bosses always (structural); PCB/connectors shown only in $preview.
  135. // rotate([0,180,0]) flips Z without disturbing ±Y connector exits; +_adpt_w re-centres X.
  136. translate([_adapt_ox + _adpt_w, _adapt_oy, FLANGE_H - BOSS_H])
  137. rotate([0, 180, 0])
  138. fpc_adapter(fpc_yp=14, fpc_yn=60);
  139. }
  140. // ============================================================
  141. // RENDER
  142. // ============================================================
  143. lid();