chiark / gitweb /
fairphone-case: reformat a bit (nfc)
[reprap-play.git] / fairphone-case.scad
index 3d73027f64ac493c586c9bf99dc75bd48d564587..ef3f7c26a42dc0caa81633e19d25ced2f1da02c0 100644 (file)
@@ -56,6 +56,8 @@ keeper_gap_z_bot = 0.75;
 keeper_gap_x     = 0.25;
 keeper_gap_x_holes = 0.75;
 
+keeper_side = 0; // 0 = lhs; 1 = rhs
+
 case_lip = 1.25;
 
 lid_gap_x = 0.25;
@@ -93,12 +95,15 @@ hinge_r_arms_gap = 0.55;
 
 rearspeaker_gap    = [ 1.0, 1.0 ]; // each side
 
-catch_len = 9;
+catch_len = 7.5;
+catch_width = 15;
+catch_thickness = 1.0;
+catch_side_gap = 0.75; // each side
 
-catch_depth = 0.75;
+catch_depth = 1.25;
 catch_height = 0.35;
 catch_finger_height = 1.5;
-catch_finger_depth = 5.5;
+catch_finger_depth = 2.5;
 
 // ---------- calculated ----------
 
@@ -185,15 +190,16 @@ hex20 = max(epp2o[0],
            phone_cnr_rad,
            kppd[0] + hingescrew_head_th + keeper_gap_x_holes);
 hex21 = hex20 + hingescrew_portion_len;
-hex22 = hex21 - hinge_x_gap;
-hex23 = hex22 + hingescrew_portion_len;
+hex22 = hex21 + hinge_x_gap;
+hex23 = hex22 + hingescrew_portion_len
+  - hingescrew_nut_thick; // bodge, need to divvy this up more sensibly
 hex24 = hex20 + hingescrew_shaft_len + hinge_x_postscrew_gap;
 echo(hex20, hex21, hex22, hex23, hex24);
 echo(hingescrew_portion_len);
 
 // catch
 
-cppJ = bppJ;
+cppJ = [ epp4[0] + catch_thickness, lpp10[1] ];
 cppA = cppJ + [lid_gap_x, -lid_gap_z];
 cppB = [ epp0[0], cppA[1] ];
 cppP = [ epp4[0], cppJ[1] ];
@@ -203,7 +209,7 @@ cppD = [ cppA[0], cppS[1] + catch_slop ];
 cppC = [ cppB[0], cppD[1] ];
 cppT = cppS + [1,0] * catch_depth;
 cppU = cppT + [0,-1] * catch_height;
-cppV = [ cppS[0], cppU[1] - catch_height ];
+cppV = [ cppS[0], cppU[1] - catch_depth ];
 
 cppR = 0.5*(cppP + cppJ);
 
@@ -318,6 +324,18 @@ module CatchCatchProfile(){
   polygon([cppJ, cppS, cppT, cppU, cppV, cppQ, cppR]);
 }
 
+module CatchCutProfile(){
+  polygon([ cppB,
+           cppA,
+           cppD,
+           cppF,
+           cppF + [0,-10],
+           cppF + [-10,-10],
+           lpp12 + [-10,0],
+           lpp12 + [10,0]
+           ]);
+}
+
 module Flip_rhs(yn=[0,1]) {
   for ($rhsflip=yn) {
     translate([phone_width/2, 0, 0])
@@ -407,7 +425,7 @@ module Buttons(){
   Flip_rhs(1) SideButton(15.580, +1, 8.9) children(); // power
   Flip_rhs(1) SideButton(48.700, -1, 8.920) children(); // camera
   Flip_rhs(0) SideButton(30.800, +1, 21.96) children(); // volume
-  Flip_rhs(   ) LidButtonishLeg(20, -1) children();
+  Flip_rhs(   ) LidButtonishLeg(14, -1) children();
 //  Flip_rhs(0) LidButtonishLeg(20, +1, 20) children();
 }
 
@@ -503,10 +521,10 @@ module HingeLeverOuterProfile(){
 module HingeLeverInnerProfile(){
   for (c = [hppT, hppB]) {
     hull()
-      for (x=[0,20])
-       translate([x,0])
-         circleat(c, hp_rn);
-       circleat(hppB, hp_rn);
+      for (x=[-20,20])
+       for (y=[0, c[1] - hppM[1]])
+         translate([x,y])
+           circleat(c, hp_rn);
   }
 }
 
@@ -527,6 +545,13 @@ module HingePortion(x0,x1){
     children(0);
 }
 
+module CatchPortion(width){
+  translate([phone_width/2, 0,0])
+    rotate([90,0,-90])
+    linextr(-width/2, width/2)
+    children(0);
+}
+
 module CaseBase(){
   AroundEdges(epp3[1], case_th_bottom, 1)
     EdgeProfile();
@@ -538,7 +563,7 @@ module Case(){ ////toplevel
       CaseBase();
 
       // ledge (fixed keeper)
-      intersection(){
+      Flip_rhs(1-keeper_side) intersection(){
        rotate([90, 0, 0])
          linear_extrude(height = phone_height + phone_cnr_rad * 2)
          KeeperProfile(1);
@@ -547,7 +572,6 @@ module Case(){ ////toplevel
        translate([0,0, -25])
          linear_extrude(height = 50)
          hull()
-         // Flip_rhs() // actually, we only care about the LH
          Flip_bot()
          circleat([+1,-1] * phone_cnr_rad, phone_cnr_rad + case_th_side/2);
       }
@@ -557,7 +581,7 @@ module Case(){ ////toplevel
     }
 
     // slot for keeper
-    Flip_rhs(1)
+    Flip_rhs(keeper_side)
       translate([0, -phone_cnr_rad, 0])
       rotate([90, 0, 0])
       linear_extrude(height = phone_height + phone_cnr_rad * 2)
@@ -583,7 +607,8 @@ module Case(){ ////toplevel
            if ($button_leg_only)
              rotate([-90,90,0])
                translate([phone_width/2, -400, kppe[1]])
-               mirror([$rhsflip,0,0]) cube([400, 800, 50]);
+               mirror([1-abs($rhsflip - keeper_side),0,0])
+               cube([400, 800, 50]);
          }
          translate([0,0, -bppR[0]])
            linear_extrude(height= 20)
@@ -610,6 +635,10 @@ module Case(){ ////toplevel
 
     // screw holes in the hinge arms
     HingeScrews();
+
+    // catch striker
+    CatchPortion(catch_width + catch_side_gap*2)
+      CatchCutProfile();
   }
 }
 
@@ -635,6 +664,10 @@ module Lid(){ ////toplevel
 
       // hinge arms
       HingePortion(hex20, hex21) HingeLidProfile();
+
+      // catch
+      CatchPortion(catch_width)
+       CatchCatchProfile();
     }
     Struts(lpp10[0] + strut_min_at_end, lpp13[1], -case_th_lid);
 
@@ -797,11 +830,6 @@ module TestFrameLidPrint(){ ////toplevel
   }
 }
 
-module Keeper(){ ////toplevel
-  Flip_rhs()
-    OneKeeper();
-}
-
 module ButtonPlanForDemo(z, deep, cut){
   translate([0,0,z])
     ButtonPlan(8, deep, cut);
@@ -885,7 +913,9 @@ module DemoProfiles(){ ////toplevel
   translate([20,-30]) {
     %EdgeProfile();
     %LidEdgeProfile();
+    //translate([0,0,1]) CatchCutProfile();
     color("blue") CatchCatchProfile();
+    color("red") difference(){ EdgeProfile(); CatchCutProfile(); }
   }
 }