chiark / gitweb /
anke-gps-bracket: better list of debugging toplevels - abolish the LHS and RHS here
[reprap-play.git] / anke-gps-bracket.scad
1 // -*- C -*-
2
3 // Dimensions of the main GPS body
4 outerw = 120 - 0.5;
5 outerh =  75 - 0.5;
6 outert =  15;
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 // Amount of wire protrusion to allow for
28 plugwiremoreh = 25;
29
30 // Slops and steps etc.
31 plugslop = 0.5;
32 plughstep = 1.5;
33 bodylhsrhsslop = 0.5;
34
35 // Dimensions for strength only
36 screent = 1.0;
37 plugstrutw = 4;
38 plugstrutt = min(outert, 5);
39
40 module GpsPlugPlug(slop){
41   effhslop = slop - plughstep;
42   effplugw = plugw + slop*2;
43   effplugh = plugh + effhslop*2;
44   translate([plug2lhs-slop, plug2bot-effhslop, -1])
45     cube([effplugw, effplugh, outert+2]);
46 }
47
48 module GpsBodyOuterBevel(len){
49   translate([0,-1,0]) {
50     rotate([-90,0,0]) {
51       linear_extrude(height=len+2) {
52         polygon([[-outerbackbevel, 0],
53                  [ 0, outerbackbevel],
54                  [outerbackbevel, 0],
55                  [ 0, -outerbackbevel]]);
56       }
57     }
58   }
59 }
60
61 module GpsBody() { ////toplevel
62   difference(){
63     union(){
64       difference(){
65         cube([outerw, outerh, outert]);
66         translate([bezelw, bezelboth, screent])
67           cube([outerw-bezelw*2, outerh-bezelboth-bezeltoph, outert]);
68         translate([outerw-spkr2rhs, spkr2bot, -1])
69           cylinder(r=spkrdia/2, h=outert+2);
70       }
71       translate([plug2lhs+plugw/2, plug2bot+plugh/2, 0.05])
72         cylinder(r=(plugw+plugh)/2, h=outert-0.02);
73       for (x=[plug2lhs-plugstrutw, plug2lhs+plugw])
74         translate([x, 0.1, 0.05])
75           cube([plugstrutw, outerh-0.2, plugstrutt-0.10]);
76     }
77     GpsPlugPlug(0);
78     for (x=[0,outerw]) translate([x,0,0]) GpsBodyOuterBevel(outerh);
79     for (y=[0,outerh]) translate([0,y,0])
80       rotate([0,0,-90]) GpsBodyOuterBevel(outerw);
81   }
82 }
83
84 module GpsPlug() {
85   plugwireh = plug2bot + plugwiremoreh;
86   GpsPlugPlug(-plugslop);
87   mirror([0,0,1]) translate([plug2lhs, plug2bot, 0]) {
88     cube([plugw, plugh, plugtotald-0.05]);
89     translate([0, -plugwireh, pluggapd])
90       cube([plugw, plugwireh+0.05, plugtotald-pluggapd]);
91   }
92 }
93
94 lhsteethu = 2;
95
96 module GpsLHSMask(xslop=0){
97   translate([plug2lhs + plugw+plugh+plugstrutw,
98              0,
99              -50]) {
100     for (iter=[-100/lhsteethu : 100/lhsteethu]) {
101       translate([0, iter*lhsteethu*2, 0]) {
102         linear_extrude(height=100) {
103           polygon([[-300,     0],
104                    [   0,     0],
105                    [lhsteethu,lhsteethu],
106                    [   0,     lhsteethu*2],
107                    [-300,     lhsteethu*2+0.1]]);
108         }
109       }
110     }
111   }
112 }
113
114 module GpsAssembled(){ ////toplevel
115   GpsBody();
116   GpsPlug();
117 }
118
119 module GpsBodyLT(){
120   intersection(){
121     GpsBody();
122     GpsLHSMask();
123   }
124 }
125
126 module GpsBodyRT(){
127   difference(){
128     GpsBody();
129     GpsLHSMask(bodylhsrhsslop);
130   }
131 }
132
133 module GpsPlugT(){ ////toplevel
134   rotate([0,-90,0]) GpsPlug();
135 }
136
137 //GpsPlugT();
138 //GpsAssembled();
139 //GpsBody();