chiark / gitweb /
scaffold-clamp: wip straphook
[reprap-play.git] / bike-phone-mount.scad
index 691fd4c26d4e436dae5e6ce3638c785b73a89cae..bb69726c80af237ef0afaadd58b87a2600bf8d6c 100644 (file)
@@ -4,79 +4,98 @@
 
 include <utils.scad>
 
-lip_height = 2.0 - 0.15;
-lip_depth = 2.5 /*?*/ - 0.20;
-neck_width = 26.5 - 0.45;
-neck_depth = 28.5 - 0.45;
-neck_length = 1.5 + 0.50;
+mount_lip_height = 2.0 - 0.15 - 0.15;
+mount_lip_depth = 2.5 /*?*/ - 0.30;
+mount_neck_width = 26.5 - 0.55 - 0.15;
+mount_neck_length = 1.5 + 0.50;
 
-slope = .65;
-extra_slope = 3;
+mount_diag_outer = 34.8        - 0.50;
+mount_diag_inner = 34.6 - 0.20 - 0.50;
 
-demo_ceil = 4;
+mount_slope = .65;
+mount_extra_slope = 3;
+
+mount_demo_ceil = 4;
 
 // calculated
 
-nep0 = [0,0];
-nep1 = nep0 + [0,1] * neck_length;
-nep7 = nep0 + [1,0] * lip_depth;
-nep2 = [ nep7[0] + extra_slope, nep1[1] + slope * (nep7[0] + extra_slope - nep1[0]) ];
-nep3 = nep2 + [0, 0.1];
-nep4 = [ nep0[0]-1, nep3[1] ];
-nep6 = nep7 + [0,-1] * lip_height;
-nep5 = [ nep4[0], nep6[1] ];
-nepm = [ nep0[0], nep3[1] ];
-
-total_height = nep2[1] - nep6[1];
-nep_z_offset = -nep2[1];
-nep_side_offset = [ neck_width/2, nep_z_offset ];
-nep_rear_offset = [ neck_depth, nep_z_offset ];
-
-module NeckEdgePlan() {
-  polygon([ nep0,
-           nep1,
-           nep2,
-           nep3,
-           nep4,
-           nep5,
-           nep6,
-           nep7 ]);
+mnep0 = [0,0];
+mnep1 = mnep0 + [0,1] * mount_neck_length;
+mnep7 = mnep0 + [1,0] * mount_lip_depth;
+mnep2 = [ mnep7[0] + mount_extra_slope, mnep1[1] + mount_slope * (mnep7[0] + mount_extra_slope - mnep1[0]) ];
+mnep3 = mnep2 + [0, 0.1];
+mnep4 = [ mnep0[0]-1, mnep3[1] ];
+mnep6 = mnep7 + [0,-1] * mount_lip_height;
+mnep5 = [ mnep4[0], mnep6[1] ];
+mnepm = [ mnep0[0], mnep3[1] ];
+
+mount_total_height = mnep2[1] - mnep6[1];
+mnep_z_offset = -mnep2[1];
+mnep_side_offset = [ mount_neck_width/2, mnep_z_offset ];
+
+module MountNeckEdgePlan() {
+  polygon([ mnep0,
+           mnep1,
+           mnep2,
+           mnep3,
+           mnep4,
+           mnep5,
+           mnep6,
+           mnep7 ]);
 }
 
-module Neck() {
-  intersection(){
-    linextr_y_xz(-100,100,convexity=10){
-      for (m=[0,1]) {
-       mirror([m,0]) {
-         translate(nep_side_offset) NeckEdgePlan();
-         rectfromto([-0.1, -total_height],
-                    nep_side_offset + nepm);
+module MountNeckSquare() {
+  intersection_for (r=[0,90]) {
+    rotate([0,0,r]){
+      linextr_y_xz(-100,100,convexity=10){
+       for (m=[0,1]) {
+         mirror([m,0]) {
+           translate(mnep_side_offset) MountNeckEdgePlan();
+           rectfromto([-0.1, -mount_total_height],
+                      mnep_side_offset + mnepm);
+         }
        }
       }
     }
-    linextr_x_yz(-100,100,convexity=10){
-      translate(nep_rear_offset) NeckEdgePlan();
-      rectfromto([0, -total_height],
-                nep_rear_offset + nepm);
+  }
+}
+
+module MountDiagonal() {
+  rotate([0,0,45]){
+    translate([0,0, -mount_total_height]){
+      linextr(0, mount_lip_height)
+       square(center=true, mount_diag_outer);
+      linextr(0, mount_total_height)
+       square(center=true, mount_diag_inner);
+      linextr(mount_lip_height + mount_neck_length,
+             mount_total_height + 1)
+       square(center=true, 100);
     }
   }
 }
 
-module DemoCeil() {
-  c = demo_ceil + extra_slope;
+module MountDemoCeil() {
+  c = mount_demo_ceil + mount_extra_slope;
   linextr(0, 0.8) {
-    rectfromto
-      ([ -(neck_width/2 + c), -demo_ceil ],
-       [ +(neck_width/2 + c), neck_depth + c]);
+    square(mount_neck_width + 2*(mount_demo_ceil + mount_extra_slope),
+          center=true);
+  }
+}
+
+module Mount(){
+  intersection(){
+    MountNeckSquare();
+    MountDiagonal();
   }
 }
 
-module Demo(){
-  Neck();
-  DemoCeil();
+module MountDemo(){ ////toplevel
+  Mount();
+  MountDemoCeil();
 }
 
-//NeckEdgePlan();
-//Neck();
-//DemoCeil();
-Demo();
+//MountNeckEdgePlan();
+//MountNeck();
+//MountDemoCeil();
+//MountDiagonal();
+//MountDemo();