chiark / gitweb /
digispark-with-cable: midbot_registration wip
[reprap-play.git] / digispark-with-cable.scad
index d3cf05fa4affa8b2bdc3134f9dad940c661803f8..9097a1371d8d9e11a3dc4dd3202fd14f19d7e359 100644 (file)
@@ -1,4 +1,10 @@
 // -*- C -*-
+//
+// Print (fine detail settings):
+//
+//   * Bottom
+//   * MiddlePrint
+//   * CoverPrint
 
 include <utils.scad>
 
@@ -44,6 +50,7 @@ strain_groove_w = 3;
 cover_strap_c_d_y = 5.5; // from front of board
 cover_registration_sz_y = 2;
 cover_registration_sz_z = 3;
+midbot_registraton_sz_x = 3;
 
 cable_space_z = 6;
 cable_dia = 5;
@@ -62,9 +69,9 @@ cover_strap_sz_x = side_wall_th * 3.5;
 strap_w = strain_w;
 cover_strap_cutout_z = side_wall_th;
 
-top_top_z = usb_wall_h;
-top_base_z = -board_th;
-bottom_base_z = top_base_z - cable_space_z - bottom_floor_th;;
+middle_top_z = usb_wall_h;
+middle_base_z = -board_th;
+bottom_base_z = middle_base_z - cable_space_z - bottom_floor_th;;
 
 front_y_max = front_wall_th;
 main_y_min = -board_l - side_wall_th;
@@ -73,16 +80,24 @@ strain_0_y_c = main_y_min - strain_w/2;
 strain_1_y_c = strain_0_y_c - strain_pitch_along;
 total_y_min = strain_1_y_c - strain_w/2 - side_wall_th;
 
-bottom_wall_top_z = (top_top_z + top_base_z) * 0.5 - fit_gap_z/2;
-cover_wall_bot_z  = (top_top_z + top_base_z) * 0.5 + fit_gap_z/2;
-cover_top_z  = top_top_z + cover_ceil_th;
+bottom_wall_top_z = (middle_top_z + middle_base_z) * 0.5 - fit_gap_z/2;
+cover_wall_bot_z  = (middle_top_z + middle_base_z) * 0.5 + fit_gap_z/2;
+cover_top_z  = middle_top_z + cover_ceil_th;
 
-top_side_wall_x = +board_w/2 + side_wall_th;
-total_side_wall_x = top_side_wall_x + side_wall_th + side_x_gap;
+middle_side_wall_x = +board_w/2 + side_wall_th;
+total_side_wall_x = middle_side_wall_x + side_wall_th + side_x_gap;
 
 cover_registration_c_dy = -cover_strap_c_d_y - strap_w/2
   - side_wall_th - cover_registration_sz_y/2;
 
+midbot_registration_sz_y = cover_registration_sz_y;
+midbot_registration_y_min = total_y_min + side_wall_th*2;
+midbot_registration_y_max = midbot_registration_y_min
+  + midbot_registration_sz_y;
+midbot_registration_y_around_max = midbot_registration_y_max
+  + side_wall_th*2;
+midbot_registration_bottom_x = board_w/2 - midbot_registraton_sz_x;
+
 module BothSides(){
   for (m=[0,1]) {
     mirror([m,0,0]) {
@@ -90,28 +105,32 @@ module BothSides(){
     }
   }
 }
-module StrapCutouts(y_c, z_top, top_sz_x){
-    BothSides(){
-      translate([ -total_side_wall_x, y_c, z_top ])
-       cube([ top_sz_x*2,
-              strap_w,
-              cover_strap_cutout_z*2 ],
-            center=true);
-    }
-}
-module BottomStrapCutouts(y_c){
+
+module NormalStrapCutouts(y_c, z, rot){
   BothSides(){
-    translate([ -total_side_wall_x, y_c, bottom_base_z ])
-      rotate([0, -45, 0])
+    translate([ -total_side_wall_x, y_c, z ])
+      rotate([0, rot, 0])
       cube([ side_wall_th,
             strap_w,
             10 ],
           center=true);
   }
 }
-
+module BottomStrapCutouts(y_c){
+  NormalStrapCutouts(y_c, bottom_base_z, -45);
+}
+// XXXX check strap width
+// XXXX check cable diameter
+// XXXX need rear strap
+// XXXX need bottom-to-middle registration
 module CoverStrapCutouts(){
-  StrapCutouts( -cover_strap_c_d_y, cover_top_z, cover_strap_sz_x );
+  BothSides(){
+    translate([ -total_side_wall_x, -cover_strap_c_d_y, cover_top_z ])
+      cube([ cover_strap_sz_x*2,
+            strap_w,
+            cover_strap_cutout_z*2 ],
+          center=true);
+  }
 }
 
 module FrontWallsPlan(slop) {
@@ -120,7 +139,7 @@ module FrontWallsPlan(slop) {
                [ -usb_w/2 - slop,              front_wall_th ]);
   }
 }
-module TopSmallWallsPlan() {
+module MiddleSmallWallsPlan() {
   for (m=[0,1]) {
     mirror([m,0]) {
       rectfromto([ -usb_w/2,              -0.01        ],
@@ -132,7 +151,7 @@ module TopSmallWallsPlan() {
     rectfromto(w[0], w[1]);
   }
 }
-module TopCeilPlan() {
+module MiddleCeilPlan() {
   difference(){
     BothSides(){
       rectfromto([ -usb_w/2,              -0.01        ],
@@ -143,7 +162,7 @@ module TopCeilPlan() {
     rectfromto(chip_cutout[0], chip_cutout[1]);
   }
 }
-module TopMainWallsPlan() {
+module MiddleMainWallsPlan() {
   BothSides(){
     rectfromto([ -board_w/2 - side_wall_th, 0          ],
               [ -board_w/2,                wall_y_min ]);
@@ -161,24 +180,24 @@ module CoverRegistrations(){
                          cover_wall_bot_z - cover_registration_sz_z  ],
                 [ +total_side_wall_x, cover_top_z ]);
       hull(){
-       TopElevationForCutout();
-       translate([0, -20]) TopElevationForCutout();
+       MiddleElevationForCutout();
+       translate([0, -20]) MiddleElevationForCutout();
       }
     }
   }
 }
 
-module Top(){ ////toplevel
+module Middle(){ ////toplevel
   difference(){
     union(){
       linextr(0, usb_wall_h)
-       TopSmallWallsPlan();
+       MiddleSmallWallsPlan();
       linextr(usb_wall_h - usb_ceil_th, usb_wall_h)
-       TopCeilPlan();
+       MiddleCeilPlan();
       linextr(-board_th, usb_wall_h)
-       TopMainWallsPlan();
+       MiddleMainWallsPlan();
       BothSides()
-       linextr(cover_wall_bot_z, top_top_z)
+       linextr(cover_wall_bot_z, middle_top_z)
         rectfromto([ -(board_w/2 + 0.1),  total_y_min             ],
                   [ -total_side_wall_x,  main_y_min - fit_gap_y  ]);
     }
@@ -191,22 +210,25 @@ module Top(){ ////toplevel
       }
     }
     linextr_y_xz(total_y_min-1, main_y_min)
-      translate([0, top_base_z])
+      translate([0, middle_base_z])
       scale([1, strain_groove_d/strain_groove_w])
       circle(strain_groove_w/2, $fn = 8);
   }
 }
+module MiddlePrint(){ ////toplevel
+  rotate([180,0,0]) Middle();
+}
 
-module TopElevationForCutout(){
-    rectfromto([ -(top_side_wall_x + side_x_gap), top_base_z ],
-              [ +(top_side_wall_x + side_x_gap), top_top_z  ]);
+module MiddleElevationForCutout(){
+    rectfromto([ -(middle_side_wall_x + side_x_gap), middle_base_z ],
+              [ +(middle_side_wall_x + side_x_gap), middle_top_z  ]);
 }
 module BottomMainElevation(){
   difference(){
     rectfromto([ -total_side_wall_x, bottom_base_z        ],
               [ +total_side_wall_x, bottom_wall_top_z    ]);
 
-    TopElevationForCutout();
+    MiddleElevationForCutout();
   }
 }
 module Bottom(){ ////toplevel
@@ -216,14 +238,20 @@ module Bottom(){ ////toplevel
        BottomMainElevation();
     }
 
-    linextr_y_xz(total_y_min + side_wall_th,
+    linextr_y_xz(midbot_registration_y_around_max,
                 front_y_max - side_wall_th)
       rectfromto([ -board_w/2, bottom_base_z + bottom_floor_th ],
                 [ +board_w/2, 20         ]);
 
+    linextr_y_xz(total_y_min + side_wall_th,
+                front_y_max - side_wall_th)
+      rectfromto([ -midbot_registration_bottom_x,
+                    bottom_base_z + bottom_floor_th ],
+                [ +midbot_registration_bottom_x, 20         ]);
+
     linextr_y_xz(total_y_min - 1,
                 total_y_min + side_wall_th + 1){
-      translate([ 0, top_base_z ]){
+      translate([ 0, middle_base_z ]){
        hull(){
          translate([ 0, -cable_dia/2 ])
            circle(r = cable_dia/2, $fa = 10, $fs = 1);
@@ -244,7 +272,7 @@ module CoverMainElevation(){
     rectfromto([ -total_side_wall_x, cover_wall_bot_z        ],
               [ +total_side_wall_x, cover_top_z    ]);
 
-    TopElevationForCutout();
+    MiddleElevationForCutout();
   }
 }
 module Cover(){ ////toplevel
@@ -257,9 +285,12 @@ module Cover(){ ////toplevel
     CoverStrapCutouts();
   }
 }
+module CoverPrint(){ ////toplevel
+  rotate([180,0,0]) Cover();
+}
 
 module BottomDemo(){ ////toplevel
   translate([0, 0, -0.25]) Bottom();
-  %Top();
+  %Middle();
   translate([0, 0, +0.25]) Cover();
 }