lid.scad 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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. /* [Preview] */
  7. SHOW_DISP = true;
  8. // Hinge drum — EPD_ANGLE-swept partial cylinder filling the gap between the flat
  9. // plate and the tilted epd_case back. Radius reaches WALL past the Y- edge of the
  10. // flat-plate FPC slot so a cable path can later be cut inside it.
  11. FPC_SLOT_Y0 = LID_Y_LEN - 3 - FPC_U_DEPTH + FPC_U_T;
  12. HINGE_R = (OUT_W - WALL) - FPC_SLOT_Y0 + WALL;
  13. // ============================================================
  14. // LID (slide-on; enters from Y- face, closes toward Y+)
  15. // Flanges sit inside cavity and ride on base retention flange hypotenuses.
  16. // ============================================================
  17. module lid() {
  18. // Flanges: right triangles in XZ; hypotenuse at reciprocal angle to base retention flanges.
  19. // Wide vertical face at x=WALL+FLANGE_W (inner), tip at bottom-wall-face — same
  20. // (-FLANGE_W, -FLANGE_H) hypotenuse slope as base flanges so they mate when lid slides in.
  21. color("#2C3863") {
  22. // Left (X-) flange
  23. hull() {
  24. translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, 0, 0])
  25. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  26. translate([WALL + SLIDE_CLEAR, 0, -0.005])
  27. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
  28. }
  29. // Right (X+) flange
  30. hull() {
  31. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, 0, 0])
  32. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  33. translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, 0, -0.005])
  34. cube([0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0.01]);
  35. }
  36. // Interior ribs — 2 mm wide
  37. translate([WALL + FLANGE_W - SLIDE_CLEAR, 0, 0])
  38. cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
  39. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR - 2.0, 0, 0])
  40. cube([2.0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, FLANGE_H]);
  41. // Y+ locking flange — single angled wedge matching side-flange profile.
  42. // Spans the whole face (the old FPC notch split is no longer needed thanks
  43. // to the Y- clearance) and shields the cable from pinching during assembly.
  44. _ypf_x0 = FLANGE_W - SLIDE_CLEAR + 2.0;
  45. _ypf_w = OUT_L - FLANGE_W + SLIDE_CLEAR - 2.0 - _ypf_x0;
  46. hull() {
  47. translate([_ypf_x0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 0.01, 0])
  48. cube([_ypf_w, 0.01, FLANGE_H - SLIDE_CLEAR]);
  49. translate([_ypf_x0, LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  50. cube([_ypf_w, 0.01, 0.01]);
  51. }
  52. // Backing rib — 2 mm deep on cavity face of flange, matches side-rib style
  53. translate([_ypf_x0, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 2.0, 0])
  54. cube([_ypf_w, 2.0, FLANGE_H]);
  55. // Y+ corners — intersection of the X-prism and Y-prism in the corner region.
  56. // Equivalent to: cube with the X-flange relief cut AND the Y-flange relief cut applied.
  57. // Result tapers to zero height along both wall faces, producing a single shared edge.
  58. // Left corner (X-)
  59. intersection() {
  60. hull() {
  61. translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  62. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  63. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, -0.005])
  64. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, 0.01]);
  65. }
  66. hull() {
  67. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  68. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, FLANGE_H - SLIDE_CLEAR]);
  69. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  70. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, 0.01]);
  71. }
  72. }
  73. // Right corner (X+)
  74. intersection() {
  75. hull() {
  76. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  77. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  78. translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, -0.005])
  79. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, 0.01]);
  80. }
  81. hull() {
  82. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  83. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, FLANGE_H - SLIDE_CLEAR]);
  84. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  85. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, 0.01]);
  86. }
  87. }
  88. }
  89. difference() {
  90. union() {
  91. // Flat ceiling plate for EPD_ANGLE > 0
  92. color("#2C3863")
  93. translate([0, -WALL, FLANGE_H])
  94. rounded_box(OUT_L, OUT_W, LID_T, CORNER_R);
  95. if (EPD_IS_LID) {
  96. translate([OUT_L/2 - epd_case_w/2, OUT_W - WALL, LID_T + LIP])
  97. rotate([-EPD_ANGLE, 0, 0])
  98. translate([0, -epd_case_d, 0])
  99. epd_case();
  100. // Hinge drum — axis along X at the epd_case pivot line; swept from the
  101. // flat-plate plane up through EPD_ANGLE to sit flush against the case back.
  102. // Inset CORNER_R from each end so it stays clear of the corner rounding.
  103. if (EPD_ANGLE > 0)
  104. color("#004B49")
  105. translate([OUT_L/2 - epd_case_w/2 + CORNER_R, OUT_W - WALL, LID_T + LIP])
  106. rotate([0, 90, 0])
  107. pie_slice(ang=EPD_ANGLE, l=epd_case_w - 2*CORNER_R, r=HINGE_R,
  108. spin=270 - EPD_ANGLE, anchor=BOT, $fn=96);
  109. }
  110. // Y- lip — same rounded_box profile clipped to the Y- wall zone so the
  111. // lip corners match the base exterior corners
  112. color("#004B49")
  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 — through flat ceiling plate (test-fit lid only; EPD_IS_LID uses epd_case slot)
  121. translate([PCB_OX + FPC_CX - FPC_NOTCH_W/2,
  122. FPC_SLOT_Y0,
  123. FLANGE_H - 0.1])
  124. cube([FPC_NOTCH_W, FPC_SLOT_W, LID_T + 0.2]);
  125. // Cable channel through hinge drum — straight tapered passage hulled between
  126. // the flat-plate slot mouth and the epd_case backplate slot exit on the tilted
  127. // face. Both mouths share the same X extent; the hull stays >1.9 mm inside the
  128. // drum's curved surface.
  129. if (EPD_IS_LID && EPD_ANGLE > 0)
  130. hull() {
  131. translate([PCB_OX + FPC_CX - FPC_NOTCH_W/2, FPC_SLOT_Y0, FLANGE_H + LID_T - 0.1])
  132. cube([FPC_NOTCH_W, FPC_SLOT_W, 0.2]);
  133. translate([OUT_L/2 - epd_case_w/2, OUT_W - WALL, LID_T + LIP])
  134. rotate([-EPD_ANGLE, 0, 0])
  135. translate([_fpc_x1, BEZEL_Y + DISP_D + DISP_Y_EXTRA - epd_case_d, -0.1])
  136. cube([_fpc_xw, FPC_SLOT_W, 0.2]);
  137. }
  138. }
  139. }
  140. // ============================================================
  141. // RENDER
  142. // ============================================================
  143. lid();