lid.scad 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 flanges — angled wedge matching side-flange profile; split around FPC notch
  42. for (seg = [
  43. [FLANGE_W - SLIDE_CLEAR + 2.0,
  44. 2+PCB_OX + FPC_CX - FPC_NOTCH_W/2 - (WALL + FLANGE_W - SLIDE_CLEAR + 2.0)],
  45. [PCB_OX + FPC_CX + FPC_NOTCH_W/2,
  46. OUT_L - FLANGE_W + SLIDE_CLEAR - 2.0 - (PCB_OX + FPC_CX + FPC_NOTCH_W/2)]
  47. ]) {
  48. hull() {
  49. translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 0.01, 0])
  50. cube([seg[1], 0.01, FLANGE_H - SLIDE_CLEAR]);
  51. translate([seg[0], LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  52. cube([seg[1], 0.01, 0.01]);
  53. }
  54. // Backing rib — 2 mm deep on cavity face of flange, matches side-rib style
  55. translate([seg[0], LID_Y_LEN - FLANGE_W + SLIDE_CLEAR - 2.0, 0])
  56. cube([seg[1], 2.0, FLANGE_H]);
  57. }
  58. // Y+ corners — intersection of the X-prism and Y-prism in the corner region.
  59. // Equivalent to: cube with the X-flange relief cut AND the Y-flange relief cut applied.
  60. // Result tapers to zero height along both wall faces, producing a single shared edge.
  61. // Left corner (X-)
  62. intersection() {
  63. hull() {
  64. translate([WALL + FLANGE_W - SLIDE_CLEAR - 0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  65. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  66. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, -0.005])
  67. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, 0.01]);
  68. }
  69. hull() {
  70. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  71. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, FLANGE_H - SLIDE_CLEAR]);
  72. translate([WALL + SLIDE_CLEAR, LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  73. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, 0.01]);
  74. }
  75. }
  76. // Right corner (X+)
  77. intersection() {
  78. hull() {
  79. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  80. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, FLANGE_H - SLIDE_CLEAR]);
  81. translate([OUT_L - WALL - SLIDE_CLEAR - 0.01, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, -0.005])
  82. cube([0.01, FLANGE_W - 2*SLIDE_CLEAR, 0.01]);
  83. }
  84. hull() {
  85. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - FLANGE_W + SLIDE_CLEAR, 0])
  86. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, FLANGE_H - SLIDE_CLEAR]);
  87. translate([OUT_L - WALL - FLANGE_W + SLIDE_CLEAR, LID_Y_LEN - SLIDE_CLEAR - 0.01, -0.005])
  88. cube([FLANGE_W - 2*SLIDE_CLEAR, 0.01, 0.01]);
  89. }
  90. }
  91. }
  92. difference() {
  93. union() {
  94. // Flat ceiling plate for EPD_ANGLE > 0
  95. color("#2C3863")
  96. translate([0, -WALL, FLANGE_H])
  97. rounded_box(OUT_L, OUT_W, LID_T, CORNER_R);
  98. if (EPD_IS_LID) {
  99. translate([OUT_L/2 - epd_case_w/2, OUT_W - WALL, LID_T + LIP])
  100. rotate([-EPD_ANGLE, 0, 0])
  101. translate([0, -epd_case_d, 0])
  102. epd_case();
  103. // Hinge drum — axis along X at the epd_case pivot line; swept from the
  104. // flat-plate plane up through EPD_ANGLE to sit flush against the case back.
  105. // Inset CORNER_R from each end so it stays clear of the corner rounding.
  106. if (EPD_ANGLE > 0)
  107. color("#004B49")
  108. translate([OUT_L/2 - epd_case_w/2 + CORNER_R, OUT_W - WALL, LID_T + WALL])
  109. rotate([0, 90, 0])
  110. pie_slice(ang=EPD_ANGLE, l=epd_case_w - 2*CORNER_R, r=HINGE_R,
  111. spin=270 - EPD_ANGLE, anchor=BOT, $fn=96);
  112. }
  113. // Y- lip — same rounded_box profile clipped to the Y- wall zone so the
  114. // lip corners match the base exterior corners
  115. color("#004B49")
  116. intersection() {
  117. translate([0, -WALL, FLANGE_H - LIP_H - SLIDE_CLEAR])
  118. rounded_box(OUT_L, OUT_W, LIP_H + SLIDE_CLEAR, CORNER_R);
  119. translate([-0.1, -WALL - 0.1, FLANGE_H - LIP_H - SLIDE_CLEAR - 0.1])
  120. cube([OUT_L + 0.2, WALL + 0.2, LIP_H + SLIDE_CLEAR + 0.2]);
  121. }
  122. }
  123. // FPC cable slot — through flat ceiling plate (test-fit lid only; EPD_IS_LID uses epd_case slot)
  124. translate([PCB_OX + FPC_CX - FPC_NOTCH_W/2,
  125. FPC_SLOT_Y0,
  126. FLANGE_H - 0.1])
  127. cube([FPC_NOTCH_W, FPC_SLOT_W, LID_T + 0.2]);
  128. }
  129. }
  130. // ============================================================
  131. // RENDER
  132. // ============================================================
  133. lid();