chiark / gitweb /
commitid: provide 2d demo
[reprap-play.git] / anke-gps-bracket.scad
index efe34a1..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
@@ -43,25 +39,23 @@ pluggapd =    5;
 // Dimensions of the hole in the tray
 //   width and height (vertical) at the top
 nestleh = 53;
-nestlew = 55.4 - 0.5;
+nestlew = 60.9;
 //   depths (back to front distance):
-nestledl = 38.8 - 0.5;
-nestledr = 42.7 - 0.5;
+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;
-
-nestlewallmin = 4;
-nestleceilmin = 4;
+nestleddbl = 5.7;
+nestleddbr = 5.2;
 
-// Adjustment for the GPS attitude
+// Adjustment for the GPS attitude and position
 gpsazimuth = 45;
 gpselevation = 40;
 gpsrightwardoffset = 5;
 gpsrearwardoffset = 2;
+gpsrightwardoffsetonbar = 0;
 
 // Amount of wire protrusion to allow for
 plugwiremoreh = 25;
@@ -72,6 +66,7 @@ plughstep = 1.5;
 bodylhsrhsslop = 0.5;
 holderhgap = 5;
 holderbezelmore = 2;
+nestlebevel = 1;
 
 // Dimensions for strength only
 screent = 1.0;
@@ -85,6 +80,10 @@ holderdccount = 2;
 holderdoveclipl = 15;
 chassish = 13;
 chassist = 13;
+nestlefloorh = 4.7;
+nestleceilh = 6.0;
+nestlewallmin = 10.0;
+nestlearchslope = 0.75 * sqrt(0.5);
 
 // Consequential values
 holderdcw = DoveClipPairSane_width(holderdccount);
@@ -190,14 +189,18 @@ module GpsPlugT(){ ////toplevel
 
 module NestleCubeCutout(ca,cb,d){
   dist = cb - ca;
+  cuth = -nestleh + nestlefloorh;
   mirror([0,1,0]){
+    translate([0,1,0])
     rotate([90,0,0]){
-      linear_extrude(height=d){
-       polygon([[ca, -nestleh-1],
-                [ca, -dist/2],
-                [(ca+cb)/2, 0],
-                [cb, -dist/2],
-                [cb, -nestleh-1]]);
+      linear_extrude(height=d+2){
+       polygon([[ca+nestlebevel, cuth],
+                [ca, cuth+nestlebevel*2],
+                [ca, -dist/2/nestlearchslope-nestleceilh],
+                [(ca+cb)/2, -nestleceilh],
+                [cb, -dist/2/nestlearchslope-nestleceilh],
+                [cb, cuth+nestlebevel*2],
+                [cb-nestlebevel, cuth]]);
       }
     }
   }
@@ -213,44 +216,84 @@ 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;
 
-  translate([-(basew0+basew1)/2, -(based0+based1)/2, 0]) difference(){
-    polyhedron
-      (points=[[          +0      ,            +0,        0], // 0
-              [          +0      ,            +nestledr, 0], // 1
-              [          -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],
-                 [1,2,7],[7,6,1],
-                 [2,3,8],[8,7,2],
-                 [3,4,9],[9,8,3],
-                 [4,0,5],[5,9,4],
-                 [4,3,2],[2,1,0],[0,4,2],
-                 [7,8,9],[5,6,7],[7,9,5]],
-       convexity=3);
-    intersection(){
-      NestleCubeCutout(cutw1, cutw0, max(nestledl,nestledr));
-      rotate([0,0,90]) NestleCubeCutout(cutd0, cutd1, nestlew);
+  bevth = -nestleh + nestlebevel*2;
+  bevw = nestlebevel;
+  bevd = nestlebevel;
+
+  translate([-(basew0+basew1)/2, -(based0+based1)/2, 0]) {
+    difference(){
+      polyhedron
+       (points=
+        [[          +0      ,            +0,        0], // 0
+         [          +0      ,            +nestledr, 0], // 1
+         [          -midw   ,            +midd,     0], // 2
+         [          -nestlew,            +nestledl, 0], // 3
+         [          -nestlew,            +0,        0], // 4
+         [-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],
+                   [12,13,14],[10,11,12],[12,14,10]],
+        convexity=3);
+      union(){
+       #NestleCubeCutout(cutw1, cutw0, max(nestledl,nestledr));
+       #rotate([0,0,90]) NestleCubeCutout(cutd0, cutd1, nestlew);
+      }
     }
   }
 
   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);
 }
@@ -288,7 +331,7 @@ module HolderSideR(){ ////toplevel
 }
 
 module ChassisBar(){ ////toplevel
-  dist = holder_outerw - 2*(bezelw - holderbezelmore - DoveClip_depth());
+  dist = holder_outerw - 2*((bezelw - holderbezelmore) + DoveClip_depth());
   cliph = holderdcw;
   for (mir=[0,1]) {
     mirror([mir,0,0]) {
@@ -298,7 +341,7 @@ module ChassisBar(){ ////toplevel
        cube([dist/2 - DoveClip_depth() + 1.1, chassish, chassist]);
     }
   }
-  translate([0, -DoveClip_depth(), 0])
+  translate([-gpsrightwardoffsetonbar, -DoveClip_depth(), 0])
     rotate([0,0,-90])
     DoveClipPairSane(h=nestledoveclipw, count=3,
                     baseextend=chassist/2);
@@ -321,6 +364,8 @@ module Pins(){ ///toplevel
 //GpsAssembled();
 //GpsBody();
 //NestleCube();
+//NestleCubeBaseTest();
+//NestleCubeCeilTest();
 //NestleCubePin();
 //HolderSideL();
 //HolderSideR();