chiark / gitweb /
anke-gps-bracket: body lhs and rhs ok
[reprap-play.git] / anke-gps-bracket.scad
1 // -*- C -*-
2
3 // Dimensions of the main GPS body
4 outerw = 140;
5 outerh = 80;
6 outert = 10;
7
8 // Dimensions of the bezel area round the edges
9 bezelw = 8;
10 bezelboth = 8;
11 bezeltoph = 8;
12
13 // Dimensions of the speaker at the back
14 spkrdia = 40;
15 spkr2bot = 40;
16 spkr2rhs = 30;
17
18 // Dimensions of the plug and wire
19 plugw = 10;
20 plugh = 8;
21 plug2bot = 30;
22 plug2lhs = 40;
23 plugtotald = 20;
24 pluggapd = 12;
25
26 // Amount of wire protrusion to allow for
27 plugwiremoreh = 30;
28
29 // Slops and steps etc.
30 plugslop = 0.5;
31 plughstep = 1.5;
32 bodylhsrhsslop = 0.5;
33
34 // Dimensions for strength only
35 screent = 1.0;
36 plugstrutw = 4;
37 plugstrutt = min(outert, 5);
38
39 module GpsPlugPlug(slop){
40   effhslop = slop - plughstep;
41   effplugw = plugw + slop*2;
42   effplugh = plugh + effhslop*2;
43   translate([plug2lhs-slop, plug2bot-effhslop, -1])
44     cube([effplugw, effplugh, outert+2]);
45 }
46
47 module GpsBody() {
48   difference(){
49     union(){
50       difference(){
51         cube([outerw, outerh, outert]);
52         translate([bezelw, bezelboth, screent])
53           cube([outerw-bezelw*2, outerh-bezelboth-bezeltoph, outert]);
54         translate([outerw-spkr2rhs, spkr2bot, -1])
55           cylinder(r=spkrdia/2, h=outert+2);
56       }
57       translate([plug2lhs+plugw/2, plug2bot+plugh/2, 0.05])
58         cylinder(r=(plugw+plugh)/2, h=outert-0.02);
59       for (x=[plug2lhs-plugstrutw, plug2lhs+plugw])
60         translate([x, 0.1, 0.05])
61           cube([plugstrutw, outerh-0.2, plugstrutt-0.10]);
62     }
63     GpsPlugPlug(0);
64   }
65 }
66
67 module GpsPlug() {
68   plugwireh = plug2bot + plugwiremoreh;
69   GpsPlugPlug(-plugslop);
70   mirror([0,0,1]) translate([plug2lhs, plug2bot, 0]) {
71     cube([plugw, plugh, plugtotald-0.05]);
72     translate([0, -plugwireh, pluggapd])
73       cube([plugw, plugwireh+0.05, plugtotald-pluggapd]);
74   }
75 }
76
77 lhsteethu = 2;
78
79 module GpsLHSMask(xslop=0){
80   translate([plug2lhs + plugw+plugh+plugstrutw,
81              0,
82              -50]) {
83     for (iter=[-100/lhsteethu : 100/lhsteethu]) {
84       translate([0, iter*lhsteethu*2, 0]) {
85         linear_extrude(height=100) {
86           polygon([[-300,     0],
87                    [   0,     0],
88                    [lhsteethu,lhsteethu],
89                    [   0,     lhsteethu*2],
90                    [-300,     lhsteethu*2+0.1]]);
91         }
92       }
93     }
94   }
95 }
96
97 module GpsAssembled(){ ////toplevel
98   GpsBody();
99   GpsPlug();
100 }
101
102 module GpsBodyLT(){ ////toplevel
103   intersection(){
104     GpsBody();
105     GpsLHSMask();
106   }
107 }
108
109 module GpsBodyRT(){ ////toplevel
110   difference(){
111     GpsBody();
112     GpsLHSMask(bodylhsrhsslop);
113   }
114 }
115
116 module GpsPlugT(){ ////toplevel
117   rotate([0,-90,0]) GpsPlug();
118 }
119
120 //GpsPlugT();
121 GpsAssembled();
122 //GpsLHSMask();
123 //GpsBodyLT();
124 //GpsBodyRT();