epd_case.scad 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // GDEY0583T81 — Waveshare 5.83" ePaper Display Case
  2. use <GDEY0583T81.scad>
  3. // Display slides in from Y-; no Y- side wall
  4. // FPC cable exits toward Y+ then bends 90° toward Z- through backplate slot
  5. // --- Display Dimensions ---
  6. DISP_W = 125.4; // overall width (X)
  7. DISP_D = 99.5; // overall depth (Y)
  8. DISP_T = 1.2; // thickness (Z)
  9. // --- Active (Visible) Area ---
  10. ACT_W = 118.78; // active area width (X)
  11. ACT_D = 88.22; // active area depth (Y)
  12. // --- Case Parameters ---
  13. WALL = 2.0; // wall and backplate thickness
  14. LIP = 1.5; // front bezel lip thickness (Z, sits on top of display)
  15. TOL = 0.3; // per-side clearance for display fit (0.3 mm suits FDM sliding tolerances)
  16. CHAM = 1.0; // chamfer Z height at window opening
  17. CHAM_ANGLE = 60; // chamfer face angle from vertical (deg); 45 = equal bevel, lower = less overhang
  18. CORNER_R = 2.5; // XY corner fillet radius (matches EE04 case)
  19. BEZEL_Y = 2.5; // extra Y- bezel beyond the display's natural 3.30 mm border
  20. EXPLODE = 0; // mm to pull display mockup toward Y- in preview
  21. SHOW_DISP = true; // show GDEY0583T81 mockup in preview
  22. FPC_BEND_R = 4.0; // FPC cable bend radius toward Z- (starting at display Y+ edge)
  23. CLIP_Z = 0; // preview-only: mm to remove from Z+ (0 = full model; LIP reveals cavity; LIP+DISP_T reveals floor)
  24. // --- Derived Dimensions ---
  25. cav_w = DISP_W + TOL * 2;
  26. cav_d = DISP_D + TOL; // tolerance on Y+ side only; Y- is open
  27. case_w = cav_w + WALL * 2;
  28. case_h = WALL + DISP_T + LIP;
  29. // FPC slot geometry — cable dims from 583.scad (12.5 mm wide, 0.3 mm thick;
  30. // right edge 55.47 mm from display right edge)
  31. _fpc_x1 = WALL + TOL + DISP_W - 55.47 - 12.50 - 2.5; // slot left edge (2.5 mm wider each side)
  32. _fpc_xw = 12.50 + 5.0; // slot width (5 mm wider than cable)
  33. _fpc_ro = FPC_BEND_R + 0.30 + TOL; // outer clearance radius (bend_r + fpc_t + tol)
  34. // max Y reached by arc at Z=0 (backplate bottom); drives minimum case_d
  35. _bend_my = BEZEL_Y + DISP_D + sqrt(_fpc_ro*_fpc_ro - (FPC_BEND_R - WALL)*(FPC_BEND_R - WALL));
  36. case_d = max(cav_d + WALL + BEZEL_Y, _bend_my + WALL);
  37. _cham_xy = CHAM * tan(CHAM_ANGLE); // horizontal expansion derived from angle
  38. // Active window position in case coordinates
  39. // X: symmetric (3.31 mm border each side)
  40. // Y: offset per drawing — 3.30 mm from Y- entry edge, 7.98 mm from Y+ (FPC) edge
  41. win_x = WALL + TOL + (DISP_W - ACT_W) / 2;
  42. win_y = 3.30 + BEZEL_Y;
  43. module rounded_box(l, w, h, r) {
  44. hull()
  45. for (dx = [r, l-r], dy = [r, w-r])
  46. translate([dx, dy, 0]) cylinder(r=r, h=h, $fn=32);
  47. }
  48. module epd_case() {
  49. difference() {
  50. // Solid case body — open at Y=0 (no Y- wall) by construction
  51. rounded_box(case_w, case_d, case_h, CORNER_R);
  52. // Display cavity: slides in from Y=0; BEZEL_Y extends depth so display seats at Y=BEZEL_Y
  53. translate([WALL, -0.01, WALL])
  54. cube([cav_w, BEZEL_Y + cav_d + 0.01, DISP_T + TOL]);
  55. // Active area window: straight portion + chamfered top edges
  56. // Extends 0.01 mm into the display cavity to avoid a coplanar face with the mockup
  57. translate([win_x, win_y, WALL + DISP_T - 0.01])
  58. cube([ACT_W, ACT_D, LIP - CHAM + 0.02]);
  59. hull() {
  60. translate([win_x, win_y, case_h - CHAM])
  61. cube([ACT_W, ACT_D, 0.01]);
  62. translate([win_x - _cham_xy, win_y - _cham_xy, case_h])
  63. cube([ACT_W + 2*_cham_xy, ACT_D + 2*_cham_xy, 0.01]);
  64. }
  65. // FPC cable slot — quarter-cylinder swept volume of cable arc from horizontal to vertical.
  66. // Arc center at (Y=DISP_D, Z=WALL−FPC_BEND_R); first-quadrant slice (Y≥DISP_D, Z≥arc_center_z).
  67. // Creates opening through backplate floor and clears Y+ wall material for bend.
  68. translate([_fpc_x1, BEZEL_Y + DISP_D, WALL - FPC_BEND_R])
  69. intersection() {
  70. rotate([0, 90, 0])
  71. cylinder(r=_fpc_ro, h=_fpc_xw, $fn=32);
  72. cube([_fpc_xw, _fpc_ro + 1, _fpc_ro + 1]);
  73. }
  74. }
  75. }
  76. color("#004B49")
  77. intersection() {
  78. epd_case();
  79. cube([case_w + 1, case_d + 1,
  80. ($preview && CLIP_Z > 0) ? max(0.01, case_h - CLIP_Z) : case_h + 1]);
  81. }
  82. // Display mockup — seated at case origin; EXPLODE pulls it toward Y-
  83. if ($preview && SHOW_DISP)
  84. translate([WALL + TOL, BEZEL_Y - EXPLODE, WALL])
  85. GDEY0583T81(fpc_bend_start=0, fpc_bend_r=FPC_BEND_R, fpc_post_clip=2);