From dd55c814d19c23245b71a11bbbf9066eeed6d499 Mon Sep 17 00:00:00 2001
From: Jochen Vothknecht <jochen3120@gmail.com>
Date: Fri, 4 Mar 2022 08:35:09 +0100
Subject: [PATCH] Improved clip design; Moar commenting on stuff

---
 pcb/10W/TransportProtection.scad | 35 +++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/pcb/10W/TransportProtection.scad b/pcb/10W/TransportProtection.scad
index 6b1e00d..55ca1d3 100644
--- a/pcb/10W/TransportProtection.scad
+++ b/pcb/10W/TransportProtection.scad
@@ -6,7 +6,7 @@ use <../../WebWeaver/scad/Util.scad>;
 $fs = 0.5;
 $fa = 1.0;
 
-
+// PCB = printed circuit board
 pcb_w      =      40.5;
 pcb_h      =      67.5;
 pcb_r      =         5;  // edge radius
@@ -16,9 +16,19 @@ pcb_sc_off =         5;  // offset of screw holes from edge
 pcb_conn_w =        20;
 pcb_conn_h =         3;
 
-$str       =         3;  // Material strength
+// the box which contains our stuff later
 box_h      = pcb_t + 2;
 
+// tc = triangular clip
+tc_intr    =         2;  // intrusion
+tc_w       =        20;
+tc_l       =        10;  // base to "clipping" plane
+tc_h       =         3;  // height of the clip triangle
+
+// globals
+$str       =         3;  // Material strength
+$E         =     0.001;  // ε
+
 
 
 module pcb(w=pcb_w, h=pcb_h, r=pcb_r, off=pcb_off) {
@@ -112,22 +122,23 @@ module triangularClipReceptacle(w=20, h=3, d=3) {
   
 }
 
-module triangularClip(w=20, h=3, d=3, length=10) {
-  
-  h2   =    h / 2;
-  l    =   length;
 
+module triangularClip(w=tc_w, h=tc_h, intr=tc_intr, l=tc_l) {
+
+  h2   =    h / 2;
   _lx  =     0.25;  // TODO: calculate from angle!!!!
   _x   =  l * _lx;
   _hlx = h2 * _lx;
   
-  translate([$str - 0.01, 0, h2])  triangularClipReceptacle(w, h, d);
+  translate([$str - 0.01, 0, h2])  triangularClipReceptacle(w, h, intr);
 
   translate([0, w/2, 0]) rotate([90, 0, 0]) linear_extrude(w) polygon([
-    [   0,       -l],
+    // [   0,       -l],  // TODO: alternative positiion?
     [ -_x, h + _hlx],
     [$str,        h],
-    [$str,        0],
+    [$str,        0],  // TODO: WHY is this redundant?!
+
+    [$str*1.7,       -l],
     [$str,       -l],
   ]);
   
@@ -184,10 +195,10 @@ module TransportProtection(w=pcb_w, h=pcb_h, r=pcb_r, height=pcb_t, off=pcb_off,
   
 
   // clipDisplacementX
-  clDsX = w/2 + off + $str;
-  
+  clDsX = w/2 + $str*2 - $E;
+
   // outer edge height
-  oEH = _boxH + height + TpOrChamfer +2 +1;
+  oEH = _boxH + height /* + TpOrChamfer */ +1;  // +1;
 
   for (i=[-1, 1]) translate([clDsX * i, 0, oEH]) rotate([0, 0, 90 + 90*i]) triangularClip();
 
-- 
GitLab