chiark / gitweb /
sleepphone-cable-box: wip, keeper, etc.
[reprap-play.git] / sleepphone-cable-box.scad
index a5a28dbbd65b3cff29bd947a5f42999ee957b2db..9b7c9cde89ae85da068a5628ef04f305b5f1b3dc 100644 (file)
@@ -1,5 +1,7 @@
 // -*- C -*-
 
+include <funcs.scad>
+
 wall = 0.75 * [1,1,1];
 phone = [ 76.40, 30.96, 6.26 ];
 phone_button_z = 6.58;
@@ -9,7 +11,19 @@ button_dy_outer = 28.42;
 button_dy_inner = 19.05;
 button_dy_centre = 5.65;
 
-phone_slop = [1,1,1] * 0.5;
+phone_slop = 0.5 * [1,1,0]
+           + 0.5 * [0,0,1];
+
+led = [25.9, 9.44]; // y is from edge
+led_dia = 4.4;
+
+// next values include slop
+plug_maxw = 10.95 + 0.35;
+plug_minw=   6.53 + 0.35;
+plug_sllen=  6.50;
+plug_totlen = 84.90; // to maxw, including phone
+
+keeper_prong = 2;
 
 // calculated
 
@@ -17,6 +31,8 @@ top_z = max( phone[2] + wall[2],
             phone_button_z + minwall )
   + phone_slop[2];
 
+plugkeeper_x_maxw = phone[0] - plug_totlen;
+
 module MainProfileInnerHalf(){
   p = phone + phone_slop;
   pb = phone_button_z + phone_slop[2];
@@ -43,15 +59,38 @@ module MainProfile(){
     }
 }
 
-module Box(){
-  mirror([0,1,0]) rotate([90,0,0]) {
-    linear_extrude(height = phone[0] + wall[0])
+module BoxMain(){
+  rotate([0,0,90]) rotate([90,0,0]) {
+    linear_extrude(height = phone[0] + wall[0], convexity=20)
       MainProfile();
     translate([0,0, phone[0]])
-      linear_extrude(height = wall[0])
+      linear_extrude(height = wall[0], convexity=20)
       hull() MainProfile();
   }
 }
 
+module PlugKeeperProfile(){
+  p_max = [ 0, plug_maxw/2 ];
+  p_min = [ -plug_sllen, plug_minw/2 ];
+  d = unitvector2d(clockwise2d(vecdiff2d(p_min, p_max))) * keeper_prong;
+  
+  translate([ plugkeeper_x_maxw, 0 ]) {
+    polygon([ p_min,
+             p_max,
+             p_max + d,
+             p_min + d ]);
+  }
+}
+
+module Box(){
+  difference(){
+    BoxMain();
+
+    translate([ led[0], phone[1]/2 - led[1], 1 ])
+      cylinder(r = led_dia/2, h= phone[2]*2, $fn=20);
+  }
+}
+
 //MainProfileInner();
 Box();
+linear_extrude(h=1) PlugKeeperProfile();