chiark / gitweb /
sleepphone-cable-box: introduce wall_bot, nfc
[reprap-play.git] / anke-gps-bracket.scad
index d2c69ab..084eefd 100644 (file)
@@ -1,9 +1,5 @@
 // -*- C -*-
 
-// todo
-// nestlecube does not fit
-// nestlecube doveclip at wrong angle
-
 include <doveclip.scad>
 
 // Dimensions of the main GPS body
@@ -45,14 +41,14 @@ pluggapd =    5;
 nestleh = 53;
 nestlew = 60.9;
 //   depths (back to front distance):
-nestledl = 38.3 + 1.9;
-nestledr = 42.2 + 1.7;
+nestledl = 40.2;
+nestledr = 43.9;
 //   differences in width, depth, at bottom:
-nestledwl = 3.0;
-nestledwr = 2.4;
+nestledwl = 2.1;
+nestledwr = 1.4;
 nestleddf = 4.0;
-nestleddbl = 3.3;
-nestleddbr = 3.6;
+nestleddbl = 5.7;
+nestleddbr = 5.2;
 
 // Adjustment for the GPS attitude and position
 gpsazimuth = 45;
@@ -70,7 +66,7 @@ plughstep = 1.5;
 bodylhsrhsslop = 0.5;
 holderhgap = 5;
 holderbezelmore = 2;
-nestlebevel = 2;
+nestlebevel = 1;
 
 // Dimensions for strength only
 screent = 1.0;
@@ -84,9 +80,10 @@ holderdccount = 2;
 holderdoveclipl = 15;
 chassish = 13;
 chassist = 13;
-nestlefloorh = 2.0;
-nestleceilh = 2.0;
-nestlewallmin = 3.0;
+nestlefloorh = 4.7;
+nestleceilh = 6.0;
+nestlewallmin = 10.0;
+nestlearchslope = 0.75 * sqrt(0.5);
 
 // Consequential values
 holderdcw = DoveClipPairSane_width(holderdccount);
@@ -199,9 +196,9 @@ module NestleCubeCutout(ca,cb,d){
       linear_extrude(height=d+2){
        polygon([[ca+nestlebevel, cuth],
                 [ca, cuth+nestlebevel*2],
-                [ca, -dist/2-nestleceilh],
+                [ca, -dist/2/nestlearchslope-nestleceilh],
                 [(ca+cb)/2, -nestleceilh],
-                [cb, -dist/2-nestleceilh],
+                [cb, -dist/2/nestlearchslope-nestleceilh],
                 [cb, cuth+nestlebevel*2],
                 [cb-nestlebevel, cuth]]);
       }
@@ -209,13 +206,6 @@ module NestleCubeCutout(ca,cb,d){
   }
 }
 
-module NestleCubeBevel(rot){
-  rotate([0,0,rot])
-    translate([-nestlebevel, -100, -0.1])
-    rotate([0,30,0])
-    cube([nestlebevel*2, 200, nestlebevel*5]);
-}
-
 module NestleCube(){ ////toplevel
   midw = nestlew/2;
   midd = min(nestledl,nestledr);
@@ -226,11 +216,19 @@ module NestleCube(){ ////toplevel
   basew0 = -nestledwr;
   basew1 = +nestledwl-nestlew;
 
+  echo("wl,wr=", basew1, basew0);
+  echo("df,dbl,dbm,dbr",
+       based0, nestledl-nestleddbl, based1, nestledr-nestleddbr);
+
   cutd0 = based0 + nestlewallmin;
   cutd1 = based1 - nestlewallmin;
   cutw0 = basew0 - nestlewallmin;
   cutw1 = basew1 + nestlewallmin;
 
+  bevth = -nestleh + nestlebevel*2;
+  bevw = nestlebevel;
+  bevd = nestlebevel;
+
   translate([-(basew0+basew1)/2, -(based0+based1)/2, 0]) {
     difference(){
       polyhedron
@@ -240,37 +238,62 @@ module NestleCube(){ ////toplevel
          [          -midw   ,            +midd,     0], // 2
          [          -nestlew,            +nestledl, 0], // 3
          [          -nestlew,            +0,        0], // 4
-         [-nestledwr+0      , +nestleddf +0,        -nestleh], // 5
-         [-nestledwr+0      , -nestleddbr+nestledr, -nestleh], // 6
-         [          -midw   , -midddb    +midd,     -nestleh], // 7
-         [+nestledwl-nestlew, -nestleddbl+nestledl, -nestleh], // 8
-         [+nestledwl-nestlew, +nestleddf +0,        -nestleh]], // 9
-        triangles=[[0,1,6],[6,5,0],
+         [-nestledwr+0      , +nestleddf +0,        bevth], // 5
+         [-nestledwr+0      , -nestleddbr+nestledr, bevth], // 6
+         [          -midw   , -midddb    +midd,     bevth], // 7
+         [+nestledwl-nestlew, -nestleddbl+nestledl, bevth], // 8
+         [+nestledwl-nestlew, +nestleddf +0,        bevth], // 9
+         [-nestledwr+0      -bevw, +nestleddf +0       +bevd, -nestleh], // 10
+         [-nestledwr+0      -bevw, -nestleddbr+nestledr-bevd, -nestleh], // 11
+         [          -midw        , -midddb    +midd    -bevd, -nestleh], // 12
+         [+nestledwl-nestlew+bevw, -nestleddbl+nestledl-bevd, -nestleh], // 13
+         [+nestledwl-nestlew+bevw, +nestleddf +0       +bevd, -nestleh]], // 14
+        triangles=[// main side panels
+                   [0,1,6],[6,5,0],
                    [1,2,7],[7,6,1],
                    [2,3,8],[8,7,2],
                    [3,4,9],[9,8,3],
                    [4,0,5],[5,9,4],
+                   // bevels
+                   [6,7,12],[12,11,6],
+                   [7,8,13],[13,12,7],
+                   [8,9,14],[14,13,8],
+                   [9,5,10],[10,14,9],
+                   [5,6,11],[11,10,5],
+                   // top and bottom
                    [4,3,2],[2,1,0],[0,4,2],
-                   [7,8,9],[5,6,7],[7,9,5]],
+                   [12,13,14],[10,11,12],[12,14,10]],
         convexity=3);
-      intersection(){
+      union(){
        #NestleCubeCutout(cutw1, cutw0, max(nestledl,nestledr));
        #rotate([0,0,90]) NestleCubeCutout(cutd0, cutd1, nestlew);
       }
-      translate([0,0,-nestleh]) {
-       translate([-nestledwr, 0, 0]) NestleCubeBevel(0);
-       translate([-nestlew+nestledwl, 0, 0]) NestleCubeBevel(180);
-      }
     }
   }
 
   translate([gpsrightwardoffset,-gpsrearwardoffset,0])
-    rotate([0,0,gpsazimuth])
+    rotate([0,0,90+gpsazimuth])
     translate([nestledoveclipw/2,0,DoveClip_depth()-0.5])
     rotate([0,-90,0])
     DoveClipPairSane(count=3, h=nestledoveclipw);
 }
 
+module NestleCubeBaseTest(){ ////toplevel
+  intersection(){
+    translate([0,0,nestleh]) NestleCube();
+    translate([-100,-100,0]) cube([200,200,nestlebevel*5]);
+  }
+  cube([5,5,10]);
+}
+
+module NestleCubeCeilTest(){ ////toplevel
+  intersection(){
+    translate([0,0,3]) NestleCube();
+    translate([-100,-100,0]) cube([200,200,5.5]);
+  }
+  cube([5,5,10]);
+}
+
 module NestleCubePin(){ ////toplevel
   DoveClipPin(nestledoveclipw*0.4);
 }
@@ -341,6 +364,8 @@ module Pins(){ ///toplevel
 //GpsAssembled();
 //GpsBody();
 //NestleCube();
+//NestleCubeBaseTest();
+//NestleCubeCeilTest();
 //NestleCubePin();
 //HolderSideL();
 //HolderSideR();