LED Enclosure.scad 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. // -----------------------------------------------------------------------
  2. // Modular 6-Part Enclosure for 10mm Pitch LED Matrix WITH DOVETAILS
  3. // -----------------------------------------------------------------------
  4. // NATIVE LANDSCAPE LAYOUT (3 columns x 2 rows)
  5. // Select which tile to generate:
  6. // 1 = Top Left | 2 = Top Mid | 3 = Top Right
  7. // 4 = Bottom Left | 5 = Bottom Mid | 6 = Bottom Right
  8. part = 1; // [1:6]
  9. // --- Core Math ---
  10. cellsX = 16;
  11. cellsY = 16;
  12. pitch = 10;
  13. gridWidth = cellsX * pitch;
  14. gridHeight = cellsY * pitch;
  15. borderWidth = 10;
  16. // Internal depth is 51mm (clearing the 49mm box height)
  17. depth = 55;
  18. wall = 4;
  19. // Logic for 3x2 Landscape Grid
  20. hasLeft = (part == 1 || part == 4) ? 1 : 0;
  21. hasRight = (part == 3 || part == 6) ? 1 : 0;
  22. hasTop = (part == 1 || part == 2 || part == 3) ? 1 : 0;
  23. hasBottom = (part == 4 || part == 5 || part == 6) ? 1 : 0;
  24. leftOffset = hasLeft * borderWidth;
  25. bottomOffset = hasBottom * borderWidth;
  26. totalWidth = gridWidth + (hasLeft * borderWidth) + (hasRight * borderWidth);
  27. totalHeight = gridHeight + (hasTop * borderWidth) + (hasBottom * borderWidth);
  28. $fn = 24;
  29. // --- Dovetail Joint Geometry ---
  30. module dovetail(clearance=0) {
  31. linear_extrude(wall)
  32. polygon([
  33. [-0.1, -6 - clearance],
  34. [8, -10 - clearance],
  35. [8, 10 + clearance],
  36. [-0.1, 6 + clearance]
  37. ]);
  38. }
  39. module posts() {
  40. holeRad = 1.4; // Sized for M3 self-tapping screws
  41. postRad = 4;
  42. // Left Border
  43. if (hasLeft) {
  44. for (i = [1 : 3]) {
  45. translate([borderWidth / 2, bottomOffset + (i * gridHeight/4), 0])
  46. difference() {
  47. cylinder(h=depth, r=postRad);
  48. translate([0, 0, wall]) cylinder(h=depth, r=holeRad);
  49. }
  50. }
  51. }
  52. // Right Border
  53. if (hasRight) {
  54. for (i = [1 : 3]) {
  55. translate([totalWidth - (borderWidth / 2), bottomOffset + (i * gridHeight/4), 0])
  56. difference() {
  57. cylinder(h=depth, r=postRad);
  58. translate([0, 0, wall]) cylinder(h=depth, r=holeRad);
  59. }
  60. }
  61. }
  62. // Top Border
  63. if (hasTop) {
  64. for (i = [1 : 3]) {
  65. translate([leftOffset + (i * gridWidth/4), totalHeight - (borderWidth / 2), 0])
  66. difference() {
  67. cylinder(h=depth, r=postRad);
  68. translate([0, 0, wall]) cylinder(h=depth, r=holeRad);
  69. }
  70. }
  71. }
  72. // Bottom Border
  73. if (hasBottom) {
  74. for (i = [1 : 3]) {
  75. translate([leftOffset + (i * gridWidth/4), borderWidth / 2, 0])
  76. difference() {
  77. cylinder(h=depth, r=postRad);
  78. translate([0, 0, wall]) cylinder(h=depth, r=holeRad);
  79. }
  80. }
  81. }
  82. }
  83. module keyhole() {
  84. cylinder(r=4, h=wall+2, center=true);
  85. translate([0, 6, 0]) cylinder(r=2.2, h=wall+2, center=true);
  86. translate([0, 3, 0]) cube([4.4, 6, wall+2], center=true);
  87. }
  88. difference() {
  89. union() {
  90. // Main block
  91. cube([totalWidth, totalHeight, depth]);
  92. // Add Male Dovetail Tabs on internal edges
  93. if (!hasRight) {
  94. for(i=[1:3]) translate([totalWidth, totalHeight * 0.25 * i, 0]) dovetail(0);
  95. }
  96. if (!hasBottom) {
  97. for(i=[1:3]) translate([totalWidth * 0.25 * i, 0, 0]) rotate([0, 0, -90]) dovetail(0);
  98. }
  99. }
  100. // Cavity cutout
  101. cutX = hasLeft ? wall : -1;
  102. cutY = hasBottom ? wall : -1;
  103. cutW = totalWidth - (hasLeft ? wall : -1) - (hasRight ? wall : -1);
  104. cutH = totalHeight - (hasBottom ? wall : -1) - (hasTop ? wall : -1);
  105. translate([cutX, cutY, wall])
  106. cube([cutW, cutH, depth]);
  107. // Subtract Female Dovetail Cuts on internal edges
  108. if (!hasLeft) {
  109. for(i=[1:3]) translate([0, totalHeight * 0.25 * i, 0]) dovetail(0.3);
  110. }
  111. if (!hasTop) {
  112. for(i=[1:3]) translate([totalWidth * 0.25 * i, totalHeight, 0]) rotate([0, 0, -90]) dovetail(0.3);
  113. }
  114. // Power Jack (9mm hole) straight through the right wall
  115. if (part == 6) {
  116. // Y = 17.5 (slot start) + 12.5 (center of 25mm controller) = 30
  117. // Z = 4 (floor) + 19 = 23
  118. translate([totalWidth + 1, 30, 23])
  119. rotate([0, -90, 0])
  120. cylinder(h=wall + 20, r=4.5);
  121. }
  122. // Wall mount keyholes on top parts
  123. if (hasTop && hasLeft) {
  124. translate([totalWidth/2, totalHeight/2, wall/2])
  125. keyhole();
  126. }
  127. if (hasTop && hasRight) {
  128. translate([totalWidth/2, totalHeight/2, wall/2])
  129. keyhole();
  130. }
  131. }
  132. // Add mounting posts back into the cavity
  133. posts();
  134. // =================================================================
  135. // PERPENDICULAR CONTROLLER SLOT
  136. // Exclusively generated on Part 6.
  137. // Mounts the 25x49 face dead flush against the internal right wall.
  138. // Controller extends 90mm inward along the X-axis.
  139. // =================================================================
  140. if (part == 6) {
  141. // Left retaining wall (X-axis inner stop at 90mm length)
  142. translate([73, 15.5, wall])
  143. cube([2, 30, 20]);
  144. // Top retaining wall (Y-axis upper stop)
  145. translate([73, 43.5, wall])
  146. cube([93, 2, 20]);
  147. // Bottom retaining wall (Y-axis lower stop)
  148. translate([73, 15.5, wall])
  149. cube([93, 2, 20]);
  150. }