chiark / gitweb /
anke-gps-bracket: wip InsertionCube
[reprap-play.git] / anke-gps-bracket.scad
1 // -*- C -*-
2
3 // Dimensions of the main GPS body
4 outerw = 120 + 2.5;
5 outerh =  75 - 0.2;
6 outert =  15 - 1.0;
7 outerbackbevel = 3;
8
9 // Dimensions of the bezel area round the edges
10 bezelw =    11 - 0.5;
11 bezelboth = 11 - 0.5;
12 bezeltoph =  7 - 0.5;
13
14 // Dimensions of the speaker at the back
15 spkrdia =  22;
16 spkr2bot = 19;
17 spkr2rhs = 25;
18
19 // Dimensions of the plug and wire
20 plugw =      12;
21 plugh =       9;
22 plug2bot =   11;
23 plug2lhs =   11;
24 plugtotald = 15;
25 pluggapd =    5;
26
27 // Dimensions of the hole in the tray
28 //   width and height (vertical) at the top
29 nestleh = 53;
30 nestlew = 55.4 - 0.5;
31 //   depths (back to front distance):
32 nestledl = 38.8 - 0.5;
33 nestledr = 42.7 - 0.5;
34 //   differences in width, depth, at bottom:
35 nestledwl = 3.0;
36 nestledwr = 2.4;
37 nestleddf = 4.0;
38 nestleddbl = 3.3;
39 nestleddbr = 3.6;
40
41 nestlewallmin = 5;
42
43 // Amount of wire protrusion to allow for
44 plugwiremoreh = 25;
45
46 // Slops and steps etc.
47 plugslop = 0.5;
48 plughstep = 1.5;
49 bodylhsrhsslop = 0.5;
50
51 // Dimensions for strength only
52 screent = 1.0;
53 plugstrutw = 4;
54 plugstrutt = min(outert, 5);
55
56 module GpsPlugPlug(slop){
57   effhslop = slop - plughstep;
58   effplugw = plugw + slop*2;
59   effplugh = plugh + effhslop*2;
60   translate([plug2lhs-slop, plug2bot-effhslop, -1])
61     cube([effplugw, effplugh, outert+2]);
62 }
63
64 module GpsBodyOuterBevel(len){
65   translate([0,-1,0]) {
66     rotate([-90,0,0]) {
67       linear_extrude(height=len+2) {
68         polygon([[-outerbackbevel, 0],
69                  [ 0, outerbackbevel],
70                  [outerbackbevel, 0],
71                  [ 0, -outerbackbevel]]);
72       }
73     }
74   }
75 }
76
77 module GpsBody() { ////toplevel
78   difference(){
79     union(){
80       difference(){
81         cube([outerw, outerh, outert]);
82         translate([bezelw, bezelboth, screent])
83           cube([outerw-bezelw*2, outerh-bezelboth-bezeltoph, outert]);
84         translate([outerw-spkr2rhs, spkr2bot, -1])
85           cylinder(r=spkrdia/2, h=outert+2);
86       }
87       translate([plug2lhs+plugw/2, plug2bot+plugh/2, 0])
88         cylinder(r=(plugw+plugh)/2, h=outert);
89       for (x=[plug2lhs-plugstrutw, plug2lhs+plugw])
90         translate([x, 0.1, 0])
91           cube([plugstrutw, outerh-0.2, plugstrutt-0.10]);
92     }
93     GpsPlugPlug(0);
94     for (x=[0,outerw]) translate([x,0,0]) GpsBodyOuterBevel(outerh);
95     for (y=[0,outerh]) translate([0,y,0])
96       rotate([0,0,-90]) GpsBodyOuterBevel(outerw);
97   }
98 }
99
100 module GpsPlug() {
101   plugwireh = plug2bot + plugwiremoreh;
102   translate([-plugslop,0,0]) GpsPlugPlug(-plugslop);
103   mirror([0,0,1]) translate([plug2lhs, plug2bot, 0]) {
104     cube([plugw, plugh, plugtotald-0.05]);
105     translate([0, -plugwireh, pluggapd])
106       cube([plugw, plugwireh+0.05, plugtotald-pluggapd]);
107   }
108 }
109
110 lhsteethu = 2;
111
112 module GpsLHSMask(xslop=0){
113   translate([plug2lhs + plugw+plugh+plugstrutw,
114              0,
115              -50]) {
116     for (iter=[-100/lhsteethu : 100/lhsteethu]) {
117       translate([0, iter*lhsteethu*2, 0]) {
118         linear_extrude(height=100) {
119           polygon([[-300,     0],
120                    [   0,     0],
121                    [lhsteethu,lhsteethu],
122                    [   0,     lhsteethu*2],
123                    [-300,     lhsteethu*2+0.1]]);
124         }
125       }
126     }
127   }
128 }
129
130 module GpsAssembled(){ ////toplevel
131   GpsBody();
132   GpsPlug();
133 }
134
135 module GpsBodyLT(){
136   intersection(){
137     GpsBody();
138     GpsLHSMask();
139   }
140 }
141
142 module GpsBodyRT(){
143   difference(){
144     GpsBody();
145     GpsLHSMask(bodylhsrhsslop);
146   }
147 }
148
149 module GpsPlugT(){ ////toplevel
150   rotate([0,-90,0]) GpsPlug();
151 }
152
153 module InsertionCube(){
154   midw = nestlew/2;
155   midd = min(nestledl,nestledr);
156   midddb = max(nestleddbl,nestleddbr);
157
158   based0 = nestleddf;
159   based1 = midd - midddb;
160   basew0 = -nestledwr;
161   basew1 = +nestledwl-nestlew;
162
163   difference(){
164     polyhedron
165       (points=[[          +0      ,            +0,        0], // 0
166                [          +0      ,            +nestledr, 0], // 1
167                [          -midw   ,            +midd,     0], // 2
168                [          -nestlew,            +nestledl, 0], // 3
169                [          -nestlew,            +0,        0], // 4
170                [-nestledwr+0      , +nestleddf +0,        -nestleh], // 5
171                [-nestledwr+0      , -nestleddbr+nestledr, -nestleh], // 6
172                [          -midw   , -midddb    +midd,     -nestleh], // 7
173                [+nestledwl-nestlew, -nestleddbl+nestledl, -nestleh], // 8
174                [+nestledwl-nestlew, +nestleddf +0,        -nestleh]], // 9
175        triangles=[[0,1,6],[6,5,0],
176                   [1,2,7],[7,6,1],
177                   [2,3,8],[8,7,2],
178                   [3,4,9],[9,8,3],
179                   [4,0,5],[5,9,4],
180                   [4,3,2],[2,1,0],[0,4,2],
181                   [7,8,9],[5,6,7],[7,9,5]],
182        convexity=3);
183   }
184 }
185
186 //GpsPlugT();
187 //GpsAssembled();
188 //GpsBody();
189
190 InsertionCube();