From c90ad58f50f4a2d0419adc7c277d34f42f6e1e5c Mon Sep 17 00:00:00 2001
From: Jochen Vothknecht <jochen3120@gmail.com>
Date: Sun, 12 Feb 2023 03:20:19 +0100
Subject: [PATCH] Adding right wall

---
 scad/cases/PolishedNaCl.scad | 99 +++++++++++++++++++++++++++++++-----
 1 file changed, 87 insertions(+), 12 deletions(-)

diff --git a/scad/cases/PolishedNaCl.scad b/scad/cases/PolishedNaCl.scad
index 33b4b14..24748c3 100644
--- a/scad/cases/PolishedNaCl.scad
+++ b/scad/cases/PolishedNaCl.scad
@@ -24,20 +24,21 @@ pcb_str =   1.6;  // str = material strength
 // bp = base plate
 
 // TODO: better naming!!
-c_pcb_off_xy = 5.0;  // space between pcb and case on X/Y
-c_pcb_off_z  = 3.0;  // space between pcb and case on Z
+c_pcb_off_xy  =  5.0;  // space between pcb and case on X/Y
+c_pcb_off_z   =  3.0;  // space under pcb until case floor
+c_pcb_parts_h = 30.0;  // space over  pcb until case ceiling
 
 c_sx    = pcb_sx + 2 * c_pcb_off_xy;
 c_sy    = pcb_sy + 2 * c_pcb_off_xy;
-c_er    =  1.5;  // edge radius
+c_sz    = c_pcb_off_z + pcb_str + c_pcb_parts_h;
+c_er    = 1.5;  // edge radius
 
 bp_sx   = c_sx + 2 * $str;
 bp_sy   = c_sy + 2 * $str;
 bp_str  = 3.0;
 
-module PolishedNaCl() {
-
 
+module PolishedNaCl(3D=true, windows=true) {
 
 
 
@@ -51,10 +52,6 @@ module PolishedNaCl() {
   }
 
 
-  PCBMockup();
-
-
-
   module BasePlate() {
     linear_extrude(bp_str, convexity=2)
     difference() {
@@ -62,12 +59,77 @@ module PolishedNaCl() {
     }
   }
 
+  module WallsOutline() {
+    
+    difference() {
+      roundRect(bp_sx, bp_sy, c_er, center=true);
+      square([bp_sx - 2*$str, bp_sy - 2*$str], center=true);
+    }
+  }
+
 
+  module Walls() {
+    translate([0, 0, bp_str - $E])
+    linear_extrude(42 + $E, convexity=4)
+      WallsOutline();    
+  }
 
-  BasePlate();
 
+  module main() {
 
-  
+    difference() {
+
+      union() {
+
+        Walls();
+
+        BasePlate();
+
+      }
+
+      children();
+        
+    }
+
+
+    if ($preview) {
+
+      PCBMockup();
+    }
+
+  }
+
+
+  module _windows() {
+
+    translate([-bp_sx, 0, 0])
+      linear_extrude($str, convexity=10)
+      projection(cut=true)
+      translate([0, 0, -bp_sx/2 + $str/2])
+      rotate([0, 90, 0])
+        difference() {
+          Walls();
+          children();
+      }
+
+    translate([bp_sx, 0, 0])
+      linear_extrude($str, convexity=10)
+      projection(cut=true)
+      translate([0, 0, +bp_sx/2 - $str/2])
+      rotate([0, 90, 0])
+        difference() {
+          Walls();
+          children();
+      }
+
+    
+    
+  }
+
+
+
+  if (3D)       main()    children();
+  if (windows) _windows() children();
 }
 
 
@@ -75,5 +137,18 @@ module PolishedNaCl() {
 
 
 
-PolishedNaCl();
+PolishedNaCl(3D=true) {
+
+
+  // left side -> square hole
+  translate([-50, 0, 20])
+    rotate([0, 90, 0])
+    cube([20, 20, 100], center=true);
+  
+  // right side -> round hole
+  translate([50, 10, 23])
+    rotate([0, 90, 0])
+    cylinder(d=20, h=100, center=true);
+  
+}
 
-- 
GitLab