chiark / gitweb /
fairphone-battery-case: adjust from v2
[reprap-play.git] / fairphone-battery-case.scad
index bcdb55d29152d8c7357a3646f7719fbb1ab00dbb..0d6d80f295f417cc25e3ef7ee90e830c61c76c74 100644 (file)
@@ -1,19 +1,28 @@
 // -*- C -*-
 
-mainwall_th = 2.5;
-smallwall_th = 1.5;
+mainwall_th = 3.0;
+smallwall_th = 2.0;
 
-seal_th = 0.3 + 0.6; // total gap for seal etc.
-behind_recess = 1.0;
+seal_th = 0.3 + 0.6 + 0.6; // total gap for seal etc.
+behind_recess = 1.5;
 
 recess_gap_end = 0.2;
 
 lid_edge_th = 0.5;
 
-battery_len = 66.55 + 0.75;
-battery_th = 6.55 + 0.75;
+battery_len = 66.55 + 1.25;
+battery_th = 6.55 + 0.75 - .90;
 battery_wdth = 44.38 + 0.75;
 
+battery_base_indent = 0.94 + 0.50;
+battery_base_indent_fromside_outside = 4;
+battery_base_indent_fromside_inside = 10;
+
+// for testing:
+battery_len = 3;
+battery_wdth = 15;
+battery_base_indent_fromside_inside = 6;
+
 // calculated
 
 bpp0 = [0,0];
@@ -25,7 +34,7 @@ bpp3 = [ bpp2[0] + (bpp1 - bpp0)[1], bpp0[1] ];
 bpp4 = [ bpp3[0], bpp0[1] + mainwall_th ];
 lppC = bpp3 + [ 0, -recess_gap_end ];
 
-s0 = battery_th/2;
+s0 = battery_wdth/2;
 s1 = s0 + smallwall_th;
 
 echo(
@@ -49,14 +58,14 @@ echo(
 );
 
 bpp8 = bpp0 + [ -battery_len,0 ];
-bpp5 = [ bpp8[0] - smallwall_th, bpp4[0] ];
-bpp9 = [ bpp0[0], bpp0[1] - battery_wdth/2 - 1.0 ];
+bpp5 = [ bpp8[0] - smallwall_th, bpp4[1] ];
+bpp9 = [ bpp0[0], bpp0[1] - battery_th/2 - 1.0 ];
 bpp7 = [ bpp8[0], bpp9[1] ];
 bpp6 = [ bpp5[0], bpp9[1] ];
 lppE = [ lppA[0], bpp9[1] ];
 lppD = [ lppC[0], bpp9[1] ];
 
-module BaseHalfPlan(){
+module BaseHalfPlan(indent=0){
   polygon([ bpp0,
            bpp1,
            bpp2,
@@ -64,8 +73,8 @@ module BaseHalfPlan(){
            bpp4,
            bpp5,
            bpp6,
-           bpp7,
-           bpp8
+           bpp7 + indent * [1,0],
+           bpp8 + indent * [1,0]
            ]);
 }
 
@@ -87,12 +96,13 @@ module LidHalfPlan(){
 }
 
 module ExtrudePlan(from,to){
+  rotate([0,-90,0])
   for (mj=[0,1]) {
     mirror([0,0,mj]) translate([0,0,from]){
       linear_extrude(height= to-from){
        for (mi=[0,1]) {
          mirror([0,mi])
-           translate([0, battery_wdth/2]);
+           translate([0, battery_th/2])
            children(0);
        }
       }
@@ -100,17 +110,29 @@ module ExtrudePlan(from,to){
   }
 }
 
-module PlanDemo(){
+module PlanDemo(){ ////toplevel
   color("blue") BaseHalfPlan();
   color("red") LidHalfPlan();
   translate([0,0,-1]) color("lightblue") SideHalfPlan();
 }
 
-module Base(){
+module Base(){ ////toplevel
   ExtrudePlan(0,s1) BaseHalfPlan();
   ExtrudePlan(s0,s1) SideHalfPlan();
+  ExtrudePlan(s0 - battery_base_indent_fromside_inside,
+             s0 - battery_base_indent_fromside_outside
+             ) SideHalfPlan(indent = battery_base_indent);
 }
 
-//PlanDemo();
+module Lid(){ ////toplevel
+  ExtrudePlan(0,s1) LidHalfPlan();
+}
 
-Base();
+module Demo(){ ////toplevel
+  %Base();
+  Lid();
+}
+
+//PlanDemo();
+//Demo();
+//Base();