chiark / gitweb /
m8-thin-washer: a blivet
[reprap-play.git] / laptop-sound-cable-hooks.scad
index 9a22ed4afcd69256a10c584a76537c4017da7158..8cfd468f261a028782507be388aac9916dd3f60d 100644 (file)
@@ -5,11 +5,15 @@ include <utils.scad>
 wall_th = 2;
 hook_th = 4;
 hook_hole = 4;
+hook_w_min = 6;
+hook_hook = 12;
+
+plug_entry_gap = 2.0;
 
 plug_l_d = [[ 27.78,
-             10.62 + 0.50 ],
+             10.62 + 0.75 ],
            [ 40.88,
-             8.56 + 0.50 ],
+             8.56 + 0.75 ],
            ];
 
 plug_stem = [ 2.72 + 0.50,
@@ -22,15 +26,17 @@ tongue_len = 50;
 
 // calculated
 
-
 hook_th_plug_holder =
   plug_l_d[0][1]/2 + wall_th * sin(22.5);
 
 hook_tongue_h = hook_hole + wall_th*2;
 
-plug_hook_z_laptop_base = palmrest_from_plug_z - laptop_th;
-plug_hook_z_min = palmrest_from_plug_z - hook_tongue_h;
-plug_hook_x_min = -plug_l_d[len(plug_l_d)-1][0] - wall_th;
+plug_l_d_smallest = plug_l_d[len(plug_l_d)-1];
+plug_hook_x_min = -plug_l_d_smallest[0] - wall_th;
+plug_hook_z_start = -plug_l_d_smallest[1]/2 - wall_th;
+
+z_laptop_base = palmrest_from_plug_z - laptop_th;
+z_hook_min = z_laptop_base - hook_tongue_h;
 
 module PlugMainPlan() {
   for (l_d = plug_l_d) {
@@ -47,20 +53,42 @@ module PlugHolderPlan() {
       offset(r= wall_th)
       PlugMainPlan();
 
-    rectfromto([-100,-100], [-0.1,+100]);
+    rectfromto([-100,-100], [-plug_entry_gap,+100]);
   }
 }
 
 module PlugHookHookPlan(){
   polygon([ [ plug_hook_x_min, 0 ],
-           [ plug_hook_x_min + -plug_hook_z_min, plug_hook_z_min ],
-           [ tongue_len, plug_hook_z_min ],
-           [ tongue_len, plug_hook_z_laptop_base ],
-           [ 0, plug_hook_z_laptop_base ],
-           [ 0, 0 ],
+           [ plug_hook_x_min, plug_hook_z_start ],
+           [ plug_hook_x_min + (plug_hook_z_start - z_hook_min),
+             z_hook_min ],
+           [ -plug_entry_gap, z_hook_min ],
+           [ -plug_entry_gap, 0 ],
            ]);
 }
 
+module TonguePlan(){
+  difference(){
+    rectfromto([ -plug_entry_gap - 1, z_hook_min ],
+              [ tongue_len, z_laptop_base ]);
+    translate([ tongue_len - wall_th - hook_hole/2,
+               z_hook_min + wall_th + hook_hole/2 ])
+      circle(r = hook_hole/2);
+  }
+}
+
+module FarHookPlan(){
+  mirror([1,0,0])
+    TonguePlan();
+
+  rectfromto([ 0, z_hook_min ],
+            [ hook_w_min, palmrest_from_plug_z + 0.1]);
+
+  translate([0, palmrest_from_plug_z])
+    rectfromto([ -hook_hook, 0 ],
+              [ hook_w_min, hook_w_min ]);
+}
+
 module RotateIntersect(n=6){
   intersection_for (r = [0:n-1]) {
     rotate([r/n * 360,0,0])
@@ -74,9 +102,15 @@ module PlugHolder(){
       RotateIntersect(8)
        PlugHolderPlan();
 
-      linextr_y_xz(-hook_th_plug_holder,
-                  +hook_th_plug_holder)
-       PlugHookHookPlan();
+      rotate([0,0,180]) {
+       linextr_y_xz(-hook_th_plug_holder/2,
+                    +hook_th_plug_holder/2)
+         PlugHookHookPlan();
+
+       linextr_y_xz(-hook_th/2,
+                    +hook_th/2)
+         TonguePlan();
+      }
     }
 
     RotateIntersect(6)
@@ -88,11 +122,24 @@ module PlugHolder(){
   }
 }
 
-module DemoPlan() {
-  translate([0,0,-5]) color("grey") PlugHolderPlan();
-  PlugMainPlan();
+module PlugHolderPrint(){ ////toplevel
+  render() PlugHolder();
+}
+
+module FarHookPrint(){ ////toplevel
+  linextr(0, hook_th)
+    FarHookPlan();
 }
 
-//DemoPlan();
-PlugHookHookPlan();
-//render() PlugHolder();
+module DemoPlan() { ////toplevel
+  translate([0,0,-10]) color("grey") PlugHolderPlan();
+  PlugMainPlan();
+  translate([0,0,-5]) color("blue") {
+    PlugHookHookPlan();
+    TonguePlan();
+  }
+
+  translate([0,40,0]) {
+    FarHookPlan();
+  }
+}