chiark / gitweb /
poster-tube-lid: break out StrapMountProtrusion (nfc)
[reprap-play.git] / poster-tube-lid.scad
index f68732815c3e81418ee278f42d392dac6e9dedc4..a354a4c3d06fc9254e3c5805d0c716a52236dc06 100644 (file)
@@ -120,7 +120,7 @@ smc_bolt_y = sm_bolt_dia/2 + sm_bolt_y_clear;
 smc_max_y = smc_bolt_y + sm_bolt_y_over
   + max(sm_bolt_head_dia/2, smc_bolt_nut_dia/2);
 smc_cnr_c_x = sm_bolt_shaft/2 - sm_closure_cnr
-  - max(sm_bolt_head_thick, sm_bolt_nut_thick);
+  + max(sm_bolt_head_thick, sm_bolt_nut_thick);
 
 $fs= coarse ? 2.5 : 0.5;
 $fa= coarse ? 5 : 1;
@@ -393,29 +393,48 @@ module CoverTest1(){ ////toplevel
   }
 }
 
-module StrapMountBolt(){ ///toplevel
+module StrapMountBolt(l_delta){ ///toplevel
   // positioned relative to smc_pos
+  translate([(sm_bolt_nut_thick - sm_bolt_head_thick)/2,
+            smc_bolt_y,
+            sm_main_width/2]){
+    translate([ -sm_bolt_shaft/2-1, 0,0 ]){
+      rotate([0,90,0]) cylinder(r= sm_bolt_dia/2, h= sm_bolt_shaft+2);
+    }
+    translate([ -sm_bolt_shaft/2, 0,0 ])
+      rotate([0,-90,0])
+      cylinder($fn=6, r=smc_bolt_nut_dia/2, h=sm_bolt_nut_thick + l_delta);
+    translate([ sm_bolt_shaft/2, 0,0 ])
+      rotate([0,90,0])
+      cylinder(r=sm_bolt_head_dia/2, h=sm_bolt_head_thick + l_delta);
+  }
+}
+
+module StrapMountProtrusion(half_x, max_y){
+  translate(smc_pos){
+    linear_extrude(height=sm_main_width, convexity=10){
+      hull(){
+       for (m = [0,1]) mirror([m,0,0]) {
+         translate([-(half_x - sm_closure_cnr), max_y - sm_closure_cnr])
+           circle(r=sm_closure_cnr);
+         translate([-half_x, -sm_inner_rad])
+           square([1,1]);
+       }
+      }
+    }
+  }
 }
 
 module StrapMount(){ ////toplevel
   difference(){
     union(){
       cylinder(r=sm_outer_rad, h=sm_main_width);
-      translate(smc_pos){
-       linear_extrude(height=sm_main_width, convexity=10){
-         hull(){
-           for (m = [0,1]) mirror([m,0,0]) {
-             translate([-smc_cnr_c_x, smc_max_y - sm_closure_cnr])
-               circle(r=sm_closure_cnr);
-             translate([-smc_cnr_c_x, -sm_inner_rad])
-               square([1,1]);
-           }
-         }
-       }
-      }
+      StrapMountProtrusion(smc_cnr_c_x + sm_closure_cnr, smc_max_y);
     }
     translate([0,0,-1])
       cylinder(r=sm_inner_rad, h=sm_main_width+2);
+    translate(smc_pos)
+      StrapMountBolt(10);
   }
 }