|
@@ -10,44 +10,50 @@
|
|
|
// Connector A (Y+): FPC exits in +Y direction
|
|
// Connector A (Y+): FPC exits in +Y direction
|
|
|
// Connector B (Y-): FPC exits in -Y direction
|
|
// Connector B (Y-): FPC exits in -Y direction
|
|
|
//
|
|
//
|
|
|
-// fpc_len_a / fpc_len_b control how much cable to show beyond each connector.
|
|
|
|
|
-// Set either to 0 to show an empty (no-cable) connector.
|
|
|
|
|
|
|
+// Mounting bosses hang from the Z- face (z=0, downward in -Z).
|
|
|
|
|
+// Stud pins extend upward from z=0 through the PCB locating holes.
|
|
|
|
|
+// When the board is flipped for ceiling-mount (rotate([0,180,0])):
|
|
|
|
|
+// bosses point toward the ceiling, stud tips snap down through the PCB.
|
|
|
|
|
+//
|
|
|
|
|
+// fpc_adapter() always produces boss geometry.
|
|
|
|
|
+// PCB / connector / FPC visuals are shown only in $preview.
|
|
|
|
|
|
|
|
// ── PCB ────────────────────────────────────────────────────────────────
|
|
// ── PCB ────────────────────────────────────────────────────────────────
|
|
|
-PCB_W = 32.0; // board width (X)
|
|
|
|
|
-PCB_H = 18.0; // board height (Y)
|
|
|
|
|
-PCB_T = 1.6; // board thickness (standard; measured ~1.72)
|
|
|
|
|
-PCB_R = 3.0; // corner radius ← replace with measured value
|
|
|
|
|
|
|
+PCB_W = 32.0;
|
|
|
|
|
+PCB_H = 18.0;
|
|
|
|
|
+PCB_T = 1.6; // standard; measured ~1.72
|
|
|
|
|
+PCB_R = 3.0; // corner radius
|
|
|
|
|
|
|
|
// ── Mounting holes ─────────────────────────────────────────────────────
|
|
// ── Mounting holes ─────────────────────────────────────────────────────
|
|
|
-HOLE_D = 3.0; // hole diameter
|
|
|
|
|
-HOLE_MX = 3.75; // hole center X from nearest X edge (2.25 clearance + 1.5 radius)
|
|
|
|
|
-HOLE_MY = 3.75; // hole center Y from nearest Y edge (2.25 clearance + 1.5 radius)
|
|
|
|
|
|
|
+HOLE_D = 3.0;
|
|
|
|
|
+HOLE_MX = 3.75; // hole center from nearest X edge (2.25 clearance + 1.5 radius)
|
|
|
|
|
+HOLE_MY = 3.75; // hole center from nearest Y edge
|
|
|
|
|
|
|
|
// ── FPC connectors (simple box approximation) ──────────────────────────
|
|
// ── FPC connectors (simple box approximation) ──────────────────────────
|
|
|
CON_W = 15.5; // connector width along X
|
|
CON_W = 15.5; // connector width along X
|
|
|
CON_D = 5.85; // connector depth along Y
|
|
CON_D = 5.85; // connector depth along Y
|
|
|
-CON_H = 2.05; // connector height above Z+ face (total stack 3.65 - PCB_T)
|
|
|
|
|
-CON_T = 0.5; // connector wall / overhang ← replace
|
|
|
|
|
-
|
|
|
|
|
-// X centre of both connectors (assumed centred on board)
|
|
|
|
|
|
|
+CON_H = 2.05; // connector height above Z+ face (total stack 3.65 − PCB_T)
|
|
|
CON_CX = PCB_W / 2;
|
|
CON_CX = PCB_W / 2;
|
|
|
-
|
|
|
|
|
-// Y edge positions of the connector body
|
|
|
|
|
-// Connector A sits at Y+ edge; connector B sits at Y- edge.
|
|
|
|
|
-CON_A_Y1 = PCB_H - CON_D; // inner face (toward board centre)
|
|
|
|
|
-CON_B_Y0 = 0; // outer face (at Y=0 edge)
|
|
|
|
|
|
|
+CON_A_Y1 = PCB_H - CON_D; // Connector A inner face (Y+ side)
|
|
|
|
|
+CON_B_Y0 = 0; // Connector B outer face (Y- side)
|
|
|
|
|
|
|
|
// ── FPC cable (simple flat box) ────────────────────────────────────────
|
|
// ── FPC cable (simple flat box) ────────────────────────────────────────
|
|
|
-FPC_W = 12.5; // cable width along X
|
|
|
|
|
-FPC_T = 0.3; // cable thickness ← replace with measured value
|
|
|
|
|
|
|
+FPC_W = 12.5;
|
|
|
|
|
+FPC_T = 0.3;
|
|
|
|
|
|
|
|
-// FPC stub length at each connector. 0 = no cable shown; >0 = stub that many mm.
|
|
|
|
|
-FPC_YP = 20; // cable length beyond Y+ connector
|
|
|
|
|
-FPC_YN = 0; // cable length beyond Y- connector
|
|
|
|
|
|
|
+// Default stub lengths. 0 = no cable; >0 = stub that many mm.
|
|
|
|
|
+FPC_YP = 20;
|
|
|
|
|
+FPC_YN = 0;
|
|
|
|
|
+
|
|
|
|
|
+// ── Mounting bosses ────────────────────────────────────────────────────
|
|
|
|
|
+BOSS_D = 6.0; // boss outer diameter
|
|
|
|
|
+BOSS_H = 2.0; // boss standoff height (extends below Z- face)
|
|
|
|
|
+SCREW_D = 3.2; // screw diameter; hole drilled at 0.7× for self-tap
|
|
|
|
|
+STUD_R = 1.5; // locating stud radius
|
|
|
|
|
+STUD_H = PCB_T + 1.0; // stud height: pierces PCB with 1 mm snap-through
|
|
|
|
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
|
-// Modules
|
|
|
|
|
|
|
+// Private helpers
|
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
// ═══════════════════════════════════════════════════════════════════════
|
|
|
|
|
|
|
|
module _pcb_shape(h) {
|
|
module _pcb_shape(h) {
|
|
@@ -58,41 +64,66 @@ module _pcb_shape(h) {
|
|
|
square([PCB_W - 2*r, PCB_H - 2*r]);
|
|
square([PCB_W - 2*r, PCB_H - 2*r]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-module fpc_adapter(fpc_yp=FPC_YP, fpc_yn=FPC_YN) {
|
|
|
|
|
|
|
+// Boss hangs from Z- face (z=0) downward; stud pin rises through PCB hole.
|
|
|
|
|
+// Stud diagonal: (X1,Y1)+(X2,Y2); screw diagonal: (X1,Y2)+(X2,Y1).
|
|
|
|
|
+module _adapt_boss(px, py, stud=false) {
|
|
|
|
|
+ translate([px, py, 0]) {
|
|
|
|
|
+ translate([0, 0, -BOSS_H])
|
|
|
|
|
+ difference() {
|
|
|
|
|
+ cylinder(d=BOSS_D, h=BOSS_H, $fn=24);
|
|
|
|
|
+ if (!stud)
|
|
|
|
|
+ translate([0, 0, -0.1])
|
|
|
|
|
+ cylinder(d=SCREW_D * 0.7, h=BOSS_H + 0.2, $fn=18);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (stud) {
|
|
|
|
|
+ cylinder(r=STUD_R, h=STUD_H, $fn=24);
|
|
|
|
|
+ translate([0, 0, STUD_H])
|
|
|
|
|
+ sphere(r=STUD_R, $fn=24);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- // ── PCB body ──────────────────────────────────────────────────────
|
|
|
|
|
- color("#1a7abf", 0.85)
|
|
|
|
|
- difference() {
|
|
|
|
|
- _pcb_shape(PCB_T);
|
|
|
|
|
|
|
+// ═══════════════════════════════════════════════════════════════════════
|
|
|
|
|
+// Public module
|
|
|
|
|
+// ═══════════════════════════════════════════════════════════════════════
|
|
|
|
|
|
|
|
- // Mounting holes
|
|
|
|
|
- for (xi = [HOLE_MX, PCB_W - HOLE_MX])
|
|
|
|
|
- for (yi = [HOLE_MY, PCB_H - HOLE_MY])
|
|
|
|
|
- translate([xi, yi, -0.1])
|
|
|
|
|
- cylinder(d=HOLE_D, h=PCB_T + 0.2, $fn=24);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+module fpc_adapter(fpc_yp=FPC_YP, fpc_yn=FPC_YN) {
|
|
|
|
|
|
|
|
- // ── Connector A (Y+ edge, FPC exits +Y) ──────────────────────────
|
|
|
|
|
- color("#d0d0d0")
|
|
|
|
|
- translate([CON_CX - CON_W/2, CON_A_Y1, PCB_T])
|
|
|
|
|
- cube([CON_W, CON_D, CON_H]);
|
|
|
|
|
-
|
|
|
|
|
- // FPC stub out of connector A
|
|
|
|
|
- if (fpc_yp > 0)
|
|
|
|
|
- color("#e8e8e8")
|
|
|
|
|
- translate([CON_CX - FPC_W/2, PCB_H, PCB_T + (CON_H - FPC_T)/2])
|
|
|
|
|
- cube([FPC_W, fpc_yp, FPC_T]);
|
|
|
|
|
-
|
|
|
|
|
- // ── Connector B (Y- edge, FPC exits -Y) ──────────────────────────
|
|
|
|
|
- color("#d0d0d0")
|
|
|
|
|
- translate([CON_CX - CON_W/2, CON_B_Y0, PCB_T])
|
|
|
|
|
- cube([CON_W, CON_D, CON_H]);
|
|
|
|
|
-
|
|
|
|
|
- // FPC stub out of connector B
|
|
|
|
|
- if (fpc_yn > 0)
|
|
|
|
|
- color("#e8e8e8")
|
|
|
|
|
- translate([CON_CX - FPC_W/2, -fpc_yn, PCB_T + (CON_H - FPC_T)/2])
|
|
|
|
|
- cube([FPC_W, fpc_yn, FPC_T]);
|
|
|
|
|
|
|
+ // ── Visual geometry (preview only) ──────────────────────────────────
|
|
|
|
|
+ if ($preview) {
|
|
|
|
|
+ color("#1a7abf", 0.85)
|
|
|
|
|
+ difference() {
|
|
|
|
|
+ _pcb_shape(PCB_T);
|
|
|
|
|
+ for (xi = [HOLE_MX, PCB_W - HOLE_MX])
|
|
|
|
|
+ for (yi = [HOLE_MY, PCB_H - HOLE_MY])
|
|
|
|
|
+ translate([xi, yi, -0.1])
|
|
|
|
|
+ cylinder(d=HOLE_D, h=PCB_T + 0.2, $fn=24);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Connector A (Y+ edge, FPC exits +Y)
|
|
|
|
|
+ color("#d0d0d0")
|
|
|
|
|
+ translate([CON_CX - CON_W/2, CON_A_Y1, PCB_T])
|
|
|
|
|
+ cube([CON_W, CON_D, CON_H]);
|
|
|
|
|
+ if (fpc_yp > 0)
|
|
|
|
|
+ color("#e8e8e8")
|
|
|
|
|
+ translate([CON_CX - FPC_W/2, PCB_H, PCB_T + (CON_H - FPC_T)/2])
|
|
|
|
|
+ cube([FPC_W, fpc_yp, FPC_T]);
|
|
|
|
|
+
|
|
|
|
|
+ // Connector B (Y- edge, FPC exits -Y)
|
|
|
|
|
+ color("#d0d0d0")
|
|
|
|
|
+ translate([CON_CX - CON_W/2, CON_B_Y0, PCB_T])
|
|
|
|
|
+ cube([CON_W, CON_D, CON_H]);
|
|
|
|
|
+ if (fpc_yn > 0)
|
|
|
|
|
+ color("#e8e8e8")
|
|
|
|
|
+ translate([CON_CX - FPC_W/2, -fpc_yn, PCB_T + (CON_H - FPC_T)/2])
|
|
|
|
|
+ cube([FPC_W, fpc_yn, FPC_T]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // ── Mounting bosses (always — structural geometry for host part) ─────
|
|
|
|
|
+ _adapt_boss(HOLE_MX, HOLE_MY, stud=true);
|
|
|
|
|
+ _adapt_boss(PCB_W - HOLE_MX, PCB_H - HOLE_MY, stud=true);
|
|
|
|
|
+ _adapt_boss(HOLE_MX, PCB_H - HOLE_MY, stud=false);
|
|
|
|
|
+ _adapt_boss(PCB_W - HOLE_MX, HOLE_MY, stud=false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Standalone render
|
|
// Standalone render
|