LED Front grid.scad 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // -----------------------------------------------------------------------
  2. // Modular 10mm Pitch LED Matrix Grid WITH BORDER-ONLY BLIND SNAPS
  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. // --- Matrix Parameters ---
  10. cellsX = 16;
  11. cellsY = 16;
  12. pitch = 10;
  13. meshSolid = 2;
  14. meshSpace = pitch - meshSolid; // 8mm hole
  15. thickness = 5;
  16. // --- Frame Parameters ---
  17. borderWidth = 10;
  18. holeRad = 2;
  19. // --- Logic (Do not touch) ---
  20. // FIXED: Mapped to 3x2 Landscape Grid
  21. hasLeft = (part == 1 || part == 4) ? 1 : 0;
  22. hasRight = (part == 3 || part == 6) ? 1 : 0;
  23. hasTop = (part == 1 || part == 2 || part == 3) ? 1 : 0;
  24. hasBottom = (part == 4 || part == 5 || part == 6) ? 1 : 0;
  25. gridWidth = cellsX * pitch;
  26. gridHeight = cellsY * pitch;
  27. leftOffset = hasLeft * borderWidth;
  28. bottomOffset = hasBottom * borderWidth;
  29. totalWidth = gridWidth + (hasLeft * borderWidth) + (hasRight * borderWidth);
  30. totalHeight = gridHeight + (hasTop * borderWidth) + (hasBottom * borderWidth);
  31. $fn = 16;
  32. // --- Border Insert Geometry (FDM friendly tapered hexagonal pegs) ---
  33. module tab_x() {
  34. rotate([0, 90, 0]) rotate([0, 0, 30])
  35. cylinder(h=5, r1=1.8, r2=1.3, $fn=6);
  36. }
  37. module hole_x() {
  38. translate([-0.1, 0, 0])
  39. rotate([0, 90, 0]) rotate([0, 0, 30])
  40. cylinder(h=5.5, r1=2.0, r2=1.5, $fn=6);
  41. }
  42. module tab_y() {
  43. rotate([-90, 0, 0]) rotate([0, 0, 30])
  44. cylinder(h=5, r1=1.8, r2=1.3, $fn=6);
  45. }
  46. module hole_y() {
  47. translate([0, -0.1, 0])
  48. rotate([-90, 0, 0]) rotate([0, 0, 30])
  49. cylinder(h=5.5, r1=2.0, r2=1.5, $fn=6);
  50. }
  51. difference() {
  52. union() {
  53. // Base solid plate
  54. cube([totalWidth, totalHeight, thickness], center=false);
  55. // Add Male pegs ONLY on the thick outer borders
  56. if (!hasRight) {
  57. if (hasTop) {
  58. translate([totalWidth, totalHeight - borderWidth/2, thickness/2]) tab_x();
  59. }
  60. if (hasBottom) {
  61. translate([totalWidth, borderWidth/2, thickness/2]) tab_x();
  62. }
  63. }
  64. if (!hasTop) {
  65. if (hasLeft) {
  66. translate([borderWidth/2, totalHeight, thickness/2]) tab_y();
  67. }
  68. if (hasRight) {
  69. translate([totalWidth - borderWidth/2, totalHeight, thickness/2]) tab_y();
  70. }
  71. }
  72. }
  73. // Punch out the LED cells
  74. for (x = [0 : cellsX - 1]) {
  75. for (y = [0 : cellsY - 1]) {
  76. translate([
  77. leftOffset + (meshSolid/2) + (x * pitch),
  78. bottomOffset + (meshSolid/2) + (y * pitch),
  79. -1
  80. ])
  81. cube([meshSpace, meshSpace, thickness + 2], center=false);
  82. }
  83. }
  84. // Cut Female holes ONLY on the thick outer borders
  85. if (!hasLeft) {
  86. if (hasTop) {
  87. translate([0, totalHeight - borderWidth/2, thickness/2]) hole_x();
  88. }
  89. if (hasBottom) {
  90. translate([0, borderWidth/2, thickness/2]) hole_x();
  91. }
  92. }
  93. if (!hasBottom) {
  94. if (hasLeft) {
  95. translate([borderWidth/2, 0, thickness/2]) hole_y();
  96. }
  97. if (hasRight) {
  98. translate([totalWidth - borderWidth/2, 0, thickness/2]) hole_y();
  99. }
  100. }
  101. // --- Mounting Holes ---
  102. // Left Border
  103. if (hasLeft) {
  104. for (i = [1 : 3]) {
  105. translate([borderWidth / 2, bottomOffset + (i * gridHeight/4), -1])
  106. cylinder(h=thickness + 2, r=holeRad);
  107. }
  108. }
  109. // Right Border
  110. if (hasRight) {
  111. for (i = [1 : 3]) {
  112. translate([totalWidth - (borderWidth / 2), bottomOffset + (i * gridHeight/4), -1])
  113. cylinder(h=thickness + 2, r=holeRad);
  114. }
  115. }
  116. // Top Border
  117. if (hasTop) {
  118. for (i = [1 : 3]) {
  119. translate([leftOffset + (i * gridWidth/4), totalHeight - (borderWidth / 2), -1])
  120. cylinder(h=thickness + 2, r=holeRad);
  121. }
  122. }
  123. // Bottom Border
  124. if (hasBottom) {
  125. for (i = [1 : 3]) {
  126. translate([leftOffset + (i * gridWidth/4), borderWidth / 2, -1])
  127. cylinder(h=thickness + 2, r=holeRad);
  128. }
  129. }
  130. }