lid.scad 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // Sliding lid for EE04 case — integrates epd_case as ceiling
  2. // z=0 = bottom of flanges; ceiling at z=LID_T (epd_case backplate) or z=FLANGE_H (flat test plate)
  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. difference() {
  98. union() {
  99. // Flat ceiling plate for EPD_ANGLE > 0
  100. color("#004B49")
  101. translate([0, -WALL, FLANGE_H])
  102. rounded_box(OUT_L, OUT_W, LID_T, CORNER_R);
  103. if (EPD_IS_LID)
  104. translate([OUT_L/2 - epd_case_w/2, OUT_W - WALL, LID_T + WALL])
  105. rotate([-EPD_ANGLE, 0, 0])
  106. translate([0, -epd_case_d, 0])
  107. epd_case();
  108. // Y- lip — same rounded_box profile clipped to the Y- wall zone so the
  109. // lip corners match the base exterior corners
  110. color("#004B49")
  111. intersection() {
  112. translate([0, -WALL, FLANGE_H - LIP_H - SLIDE_CLEAR])
  113. rounded_box(OUT_L, OUT_W, LIP_H + SLIDE_CLEAR, CORNER_R);
  114. translate([-0.1, -WALL - 0.1, FLANGE_H - LIP_H - SLIDE_CLEAR - 0.1])
  115. cube([OUT_L + 0.2, WALL + 0.2, LIP_H + SLIDE_CLEAR + 0.2]);
  116. }
  117. }
  118. // FPC cable slot — through flat ceiling plate (test-fit lid only; EPD_IS_LID uses epd_case slot)
  119. translate([PCB_OX + FPC_CX - FPC_NOTCH_W/2,
  120. LID_Y_LEN - 3 - FPC_U_DEPTH + FPC_U_T,
  121. FLANGE_H - 0.1])
  122. cube([FPC_NOTCH_W, FPC_SLOT_W, LID_T + 0.2]);
  123. }
  124. }
  125. // ============================================================
  126. // RENDER
  127. // ============================================================
  128. lid();