| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- // -----------------------------------------------------------------------
- // Modular 10mm Pitch LED Matrix Grid WITH BORDER-ONLY BLIND SNAPS
- // -----------------------------------------------------------------------
- // NATIVE LANDSCAPE LAYOUT (3 columns x 2 rows)
- // Select which tile to generate:
- // 1 = Top Left | 2 = Top Mid | 3 = Top Right
- // 4 = Bottom Left | 5 = Bottom Mid | 6 = Bottom Right
- part = 1; // [1:6]
- // --- Matrix Parameters ---
- cellsX = 16;
- cellsY = 16;
- pitch = 10;
- meshSolid = 2;
- meshSpace = pitch - meshSolid; // 8mm hole
- thickness = 5;
- // --- Frame Parameters ---
- borderWidth = 10;
- holeRad = 2;
- // --- Logic (Do not touch) ---
- // FIXED: Mapped to 3x2 Landscape Grid
- hasLeft = (part == 1 || part == 4) ? 1 : 0;
- hasRight = (part == 3 || part == 6) ? 1 : 0;
- hasTop = (part == 1 || part == 2 || part == 3) ? 1 : 0;
- hasBottom = (part == 4 || part == 5 || part == 6) ? 1 : 0;
- gridWidth = cellsX * pitch;
- gridHeight = cellsY * pitch;
- leftOffset = hasLeft * borderWidth;
- bottomOffset = hasBottom * borderWidth;
- totalWidth = gridWidth + (hasLeft * borderWidth) + (hasRight * borderWidth);
- totalHeight = gridHeight + (hasTop * borderWidth) + (hasBottom * borderWidth);
- $fn = 16;
- // --- Border Insert Geometry (FDM friendly tapered hexagonal pegs) ---
- module tab_x() {
- rotate([0, 90, 0]) rotate([0, 0, 30])
- cylinder(h=5, r1=1.8, r2=1.3, $fn=6);
- }
- module hole_x() {
- translate([-0.1, 0, 0])
- rotate([0, 90, 0]) rotate([0, 0, 30])
- cylinder(h=5.5, r1=2.0, r2=1.5, $fn=6);
- }
- module tab_y() {
- rotate([-90, 0, 0]) rotate([0, 0, 30])
- cylinder(h=5, r1=1.8, r2=1.3, $fn=6);
- }
- module hole_y() {
- translate([0, -0.1, 0])
- rotate([-90, 0, 0]) rotate([0, 0, 30])
- cylinder(h=5.5, r1=2.0, r2=1.5, $fn=6);
- }
- difference() {
- union() {
- // Base solid plate
- cube([totalWidth, totalHeight, thickness], center=false);
-
- // Add Male pegs ONLY on the thick outer borders
- if (!hasRight) {
- if (hasTop) {
- translate([totalWidth, totalHeight - borderWidth/2, thickness/2]) tab_x();
- }
- if (hasBottom) {
- translate([totalWidth, borderWidth/2, thickness/2]) tab_x();
- }
- }
- if (!hasTop) {
- if (hasLeft) {
- translate([borderWidth/2, totalHeight, thickness/2]) tab_y();
- }
- if (hasRight) {
- translate([totalWidth - borderWidth/2, totalHeight, thickness/2]) tab_y();
- }
- }
- }
-
- // Punch out the LED cells
- for (x = [0 : cellsX - 1]) {
- for (y = [0 : cellsY - 1]) {
- translate([
- leftOffset + (meshSolid/2) + (x * pitch),
- bottomOffset + (meshSolid/2) + (y * pitch),
- -1
- ])
- cube([meshSpace, meshSpace, thickness + 2], center=false);
- }
- }
- // Cut Female holes ONLY on the thick outer borders
- if (!hasLeft) {
- if (hasTop) {
- translate([0, totalHeight - borderWidth/2, thickness/2]) hole_x();
- }
- if (hasBottom) {
- translate([0, borderWidth/2, thickness/2]) hole_x();
- }
- }
- if (!hasBottom) {
- if (hasLeft) {
- translate([borderWidth/2, 0, thickness/2]) hole_y();
- }
- if (hasRight) {
- translate([totalWidth - borderWidth/2, 0, thickness/2]) hole_y();
- }
- }
- // --- Mounting Holes ---
- // Left Border
- if (hasLeft) {
- for (i = [1 : 3]) {
- translate([borderWidth / 2, bottomOffset + (i * gridHeight/4), -1])
- cylinder(h=thickness + 2, r=holeRad);
- }
- }
-
- // Right Border
- if (hasRight) {
- for (i = [1 : 3]) {
- translate([totalWidth - (borderWidth / 2), bottomOffset + (i * gridHeight/4), -1])
- cylinder(h=thickness + 2, r=holeRad);
- }
- }
- // Top Border
- if (hasTop) {
- for (i = [1 : 3]) {
- translate([leftOffset + (i * gridWidth/4), totalHeight - (borderWidth / 2), -1])
- cylinder(h=thickness + 2, r=holeRad);
- }
- }
- // Bottom Border
- if (hasBottom) {
- for (i = [1 : 3]) {
- translate([leftOffset + (i * gridWidth/4), borderWidth / 2, -1])
- cylinder(h=thickness + 2, r=holeRad);
- }
- }
- }
|