chiark / gitweb /
bike-phone-mount: prefix variables, nfc
[reprap-play.git] / bike-phone-mount.scad
1 // -*- C -*-
2
3 // should rename this to actual name of the product
4
5 include <utils.scad>
6
7 mount_lip_height = 2.0 - 0.15;
8 mount_lip_depth = 2.5 /*?*/ - 0.30;
9 mount_neck_width = 26.5 - 0.55;
10 mount_neck_length = 1.5 + 0.50;
11
12 mount_slope = .65;
13 mount_extra_slope = 3;
14
15 mount_demo_ceil = 4;
16
17 // calculated
18
19 mnep0 = [0,0];
20 mnep1 = mnep0 + [0,1] * mount_neck_length;
21 mnep7 = mnep0 + [1,0] * mount_lip_depth;
22 mnep2 = [ mnep7[0] + mount_extra_slope, mnep1[1] + mount_slope * (mnep7[0] + mount_extra_slope - mnep1[0]) ];
23 mnep3 = mnep2 + [0, 0.1];
24 mnep4 = [ mnep0[0]-1, mnep3[1] ];
25 mnep6 = mnep7 + [0,-1] * mount_lip_height;
26 mnep5 = [ mnep4[0], mnep6[1] ];
27 mnepm = [ mnep0[0], mnep3[1] ];
28
29 mount_total_height = mnep2[1] - mnep6[1];
30 mnep_z_offset = -mnep2[1];
31 mnep_side_offset = [ mount_neck_width/2, mnep_z_offset ];
32
33 module NeckEdgePlan() {
34   polygon([ mnep0,
35             mnep1,
36             mnep2,
37             mnep3,
38             mnep4,
39             mnep5,
40             mnep6,
41             mnep7 ]);
42 }
43
44 module Neck() {
45   intersection_for (r=[0,90]) {
46     rotate([0,0,r]){
47       linextr_y_xz(-100,100,convexity=10){
48         for (m=[0,1]) {
49           mirror([m,0]) {
50             translate(mnep_side_offset) NeckEdgePlan();
51             rectfromto([-0.1, -mount_total_height],
52                        mnep_side_offset + mnepm);
53           }
54         }
55       }
56     }
57   }
58 }
59
60 module DemoCeil() {
61   c = mount_demo_ceil + mount_extra_slope;
62   linextr(0, 0.8) {
63     square(mount_neck_width + 2*(mount_demo_ceil + mount_extra_slope),
64            center=true);
65   }
66 }
67
68 module Demo(){
69   Neck();
70   DemoCeil();
71 }
72
73 //NeckEdgePlan();
74 //Neck();
75 //DemoCeil();
76 Demo();