chiark / gitweb /
brompton-computer-guard: wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 11 May 2014 22:36:43 +0000 (23:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 11 May 2014 22:36:43 +0000 (23:36 +0100)
brompton-computer-guard.scad

index d7f8a26b3b8d517307d2519755a92c7a6af000d6..6eade97538beb29099f821743169d05e118a97b5 100644 (file)
@@ -3,7 +3,7 @@
 cover_ysz = 45;
 cover_len = 70;
 
-attach_tube_dia = 18;
+tube_dia = 18;
 
 attach_cx = -15;
 attach_cdy = -5;
@@ -14,17 +14,36 @@ attach_hole_dist = 5; ///
 attach_hole_dia = 4 + 0.5; ///
 attach_ang = 45;
 
+attach_dz = 2;
+
+comp_dx = 22;
+comp_xsz = 45;
+comp_zsz = 28;
+
+leftend_zsz = 10;
+leftend_dz = comp_zsz * 0.6;
+
+min_thick = 4;
+
+rightend_thick = 10;
+bolthead_space = 4;
+
 // calculated
 
 cover_lcircle_r = cover_ysz / (1 + 1/sqrt(2));
 
 base_len = cover_len - cover_lcircle_r;
 
+attach_end_r = attach_w/2;
+
 attach_straight_len =
-  attach_inrad + attach_tube_dia + attach_hole_dist + attach_hole_dia/2
-  - attach_w / 2 + attach_hole_dist;
+  attach_inrad + tube_dia + attach_hole_dist + attach_hole_dia/2
+  - attach_end_r + attach_hole_dist;
 
-attach_down = tube_dia + attach_hole_dist;
+attach_down = tube_dia/2 + attach_dz;
+
+attach_xmax = attach_cx +
+  cos(attach_ang) * attach_straight_len + attach_end_r;
 
 module RearSideTemplate(){
   polygon([[0.1,0],
@@ -47,30 +66,70 @@ module AttachTemplate(){
               [attach_straight_len, -attach_w/2],
               [attach_straight_len, attach_w/2]]);
       translate([attach_straight_len, 0])
-       circle(r=attach_w/2);
+       circle(r=attach_end_r);
     }
   }
 }
 
+module AttachElevation(anddown){
+  hull(){
+    translate([-cover_len - 0.5, leftend_dz - leftend_zsz/2])
+      square([1, leftend_zsz]);
+    translate([-comp_dx - comp_xsz/2, -0.1])
+      square([comp_xsz, comp_zsz + min_thick]);
+    translate([attach_xmax, 0])
+      square([1, rightend_thick + bolthead_space]);
+  }
+  if (anddown)
+    translate([-comp_dx, -attach_down-5])
+      square([comp_dx + attach_xmax+2, attach_down+6]);
+}
+
+module AttachElevationSelector(anddown) {
+  translate([0,100,0]) rotate([90,0,0]) linear_extrude(height=200)
+    AttachElevation(anddown);
+}
+
 module BodyPositive(){
-  color("blue") linear_extrude(height=60) RearSideTemplate();
-  translate([0,0,-attach_down]) linear_extrude(height=100) AttachTemplate();
+  intersection(){
+    linear_extrude(height=60) RearSideTemplate();
+    AttachElevationSelector(false);
+  }
+  intersection(){
+    translate([0,0,-attach_down]) linear_extrude(height=100) AttachTemplate();
+    AttachElevationSelector(true);
+  }
+}
+
+module Cutouts(){
+  Tube();
+  Bolts();
+}
+
+module Body(){
+  difference(){
+    intersection(){
+      BodyPositive();
+      translate([-100,-200,-100]) cube([200,200,200]);
+    }
+    Cutouts();
+  }
 }
 
 module Tube(){
-  %translate([attach_cx, -attach_cdy, -20]) {
+  %translate([attach_cx, -attach_cdy, -tube_dia/2 - 0.1 - attach_dz]) {
     rotate_extrude(convexity=10) {
-      translate([attach_inrad + attach_tube_dia/2, 0])
-       circle(r=attach_tube_dia/2);
+      translate([attach_inrad + tube_dia/2, 0])
+       circle(r=tube_dia/2);
     }
   }
 }
 
 module Bolt(){
-  %translate([0,0,-50]) linear_extrude(height=80) {
+  translate([0,0,-50]) linear_extrude(height=80) {
     circle(r=attach_hole_dia/2, $fn=20);
   }
-  %translate([0,0,10]) linear_extrude(height=20) {
+  translate([0,0,rightend_thick]) linear_extrude(height=80) {
     circle(r=attach_hole_dia/2 * 2, $fn=20);
   }
 }
@@ -79,12 +138,16 @@ module Bolts(){
   translate([attach_cx, -attach_cdy]) rotate([0,0,-attach_ang]) {
     translate([attach_inrad - attach_hole_dist - attach_hole_dia/2, 0])
       Bolt();
-    translate([attach_inrad + attach_tube_dia
+    translate([attach_inrad + tube_dia
               +attach_hole_dist + attach_hole_dia/2, 0])
       Bolt();
   }
 }
 
-Tube();
-Bolts();
-BodyPositive();
+module Demo(){
+  Cutouts();
+  %BodyPositive();
+}
+
+//Demo();
+Body();