chiark / gitweb /
digispark-with-cable: wip progress
[reprap-play.git] / digispark-with-cable.scad
index 069c04bf1ae8ca2820a40a53e8f52eddece2e2cc..5e1136b46940749059fd0cb1292bbb39d28a9b69 100644 (file)
@@ -11,7 +11,7 @@ usb_tongue_w_slop = +0.5;
 usb_wall_h = 4.54 - 2.04;
 usb_ceil_th = 0.425;
 
-side_wall_th = 1.5;
+side_wall_th = 1.5; // XXXX rename wall_th
 
 board_l = 17.56 + 0.2;
 board_w = 19.14 + 0.2;
@@ -39,13 +39,37 @@ strain_w = 2.0 + 0.5;
 strain_t = 1.0 + 0.5;
 strain_pitch_across = 5;
 strain_pitch_along = 10;
+strain_groove_d = 2;
+strain_groove_w = 3;
+
+cable_space_z = 6;
+cable_dia = 5;
+bottom_floor_th = 1.5;
+
+fit_gap_z = 0.5;
+side_x_gap = 0.5;
+
+cover_ceil_th = 0.425;
 
 // calculated
 
+top_top_z = usb_wall_h;
+top_base_z = -board_th;
+bottom_base_z = top_base_z - cable_space_z - bottom_floor_th;;
+
+front_y_max = front_wall_th;
+
 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;
+
+top_side_wall_x = +board_w/2 + side_wall_th;
+total_side_wall_x = top_side_wall_x + side_wall_th + side_x_gap;
+
 module BothSides(){
   for (m=[0,1]) {
     mirror([m,0]) {
@@ -93,13 +117,82 @@ module TopMainWallsPlan() {
 }
 
 module Top(){ ////toplevel
-  linextr(0, usb_wall_h)
-    TopSmallWallsPlan();
-  linextr(usb_wall_h - usb_ceil_th, usb_wall_h)
-    TopCeilPlan();
-  linextr(-board_th, usb_wall_h)
-    TopMainWallsPlan();
+  difference(){
+    union(){
+      linextr(0, usb_wall_h)
+       TopSmallWallsPlan();
+      linextr(usb_wall_h - usb_ceil_th, usb_wall_h)
+       TopCeilPlan();
+      linextr(-board_th, usb_wall_h)
+       TopMainWallsPlan();
+    }
+
+    for (y_c = [strain_0_y_c, strain_1_y_c]) {
+      for (x_c = [-1,+1] * strain_pitch_across/2) {
+       translate([x_c, y_c, 0])
+         linextr(-20, 20)
+         square([ strain_t, strain_w ], center=true);
+      }
+    }
+    linextr_y_xz(total_y_min-1, main_y_min)
+      translate([0, top_base_z])
+      scale([1, strain_groove_d/strain_groove_w])
+      circle(strain_groove_w/2, $fn = 8);
+  }
 }
 
+module TopElevationForCutout(){
+    rectfromto([ -(top_side_wall_x + side_x_gap), top_base_z ],
+              [ +(top_side_wall_x + side_x_gap), top_top_z  ]);
+}
+module BottomMainElevation(){
+  difference(){
+    rectfromto([ -total_side_wall_x, bottom_base_z        ],
+              [ +total_side_wall_x, bottom_wall_top_z    ]);
+
+    TopElevationForCutout();
+  }
+}
 module Bottom(){ ////toplevel
+  difference(){
+    union(){
+      linextr_y_xz(total_y_min, front_y_max)
+       BottomMainElevation();
+    }
+
+    linextr_y_xz(total_y_min + side_wall_th,
+                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 - 1,
+                total_y_min + side_wall_th + 1){
+      translate([ 0, top_base_z ]){
+       hull(){
+         translate([ 0, -cable_dia/2 ])
+           circle(r = cable_dia/2, $fa = 10, $fs = 1);
+         square([ cable_dia, 0.1 ], center=true);
+       }
+      }
+    }
+  }
+}
+
+module CoverMainElevation(){
+  difference(){
+    rectfromto([ -total_side_wall_x, cover_wall_bot_z        ],
+              [ +total_side_wall_x, cover_top_z    ]);
+
+    TopElevationForCutout();
+  }
+}
+module Cover(){ ////toplevel
+  linextr_y_xz(main_y_min, front_y_max)
+    CoverMainElevation();
+}
+
+module BottomDemo(){ ////toplevel
+  translate([0, 0, -0.25]) Bottom();
+  %Top();
+  translate([0, 0, +0.25]) Cover();
 }