chiark / gitweb /
10254 better formatting
[dl-things.git] / th-10254 / tower-base.scad
1
2 motorwidth=35.2;
3 motorheight=36.5;
4 totalheight=65;
5
6 pillarthick=9;
7 sidethick=3;
8 archthick=8;
9 frameextra=3.5;
10 framesplay=1;
11 botleftgap=4.5;
12 botleftstand=0.75;
13 archoutwards=(pillarthick-archthick)/sqrt(8);
14
15 mw2=motorwidth/2;
16
17 include <Libs.scad> //  Libs.scad is @ http://www.thingiverse.com/thing:6021
18
19 module corner() {
20         $fn=30;
21         frameheight= motorheight + frameextra;
22         slopeheight= totalheight - frameheight;
23         slope = (mw2 + archoutwards - framesplay)/slopeheight;
24         echo(sqrt(2)*slope);
25
26         translate([-mw2,-mw2,0]) union(){
27                 difference(){
28                         union(){
29                                 cylinder(r=pillarthick/2, h=frameheight);
30                                 translate([0,0,frameheight])
31                                         sphere(r=pillarthick/2);
32                         }
33                         translate([0,0,-1])
34                                 cube([mw2,mw2,frameheight+pillarthick+2]);
35                 }
36                 intersection(){
37                         multmatrix
38                            ([   [       1,      0,      slope,  -archoutwards ],
39                                 [       0,      1,      slope,  -archoutwards ],
40                                 [       0,      0,      1, frameheight  ],
41                                 [       0,      0,      0,      1       ]])
42                                 translate([0,0,-frameextra])
43                                 cylinder(r=archthick/2,
44                                          h=slopeheight+frameextra);
45                         union() {
46                                 cylinder(r=pillarthick/2, h=frameheight);
47                                 translate([-100,-100,frameheight])
48                                         cube([200,200,100]);
49                         }
50                 }
51         }
52 }
53
54 module halfside() {
55         spacesz = (motorwidth - pillarthick/2*2) / 4;
56         panelheight = spacesz + sidethick;
57         panelbasez = motorheight+pillarthick/4-panelheight;
58         translate([0,-mw2,0]) {
59                 translate([-mw2,-sidethick,0])
60                         cube([motorwidth,sidethick,sidethick]);
61                 difference(){
62                         translate([-mw2,-sidethick, panelbasez])
63                                 cube([mw2,sidethick,panelheight]);
64                         translate([-mw2+pillarthick/3, -sidethick, panelbasez])
65                                 rotate([0,45,0])
66                                 translate([0,-1,0])
67                                 cube([spacesz * sqrt(2),
68                                       sidethick+2,
69                                       spacesz * sqrt(2)]);
70                 }
71                 intersection(){
72                         for (xz=[[-mw2+pillarthick/3-sidethick, 0,
73                                         panelbasez+sidethick],
74                                  [0, 0, panelbasez + sidethick/sqrt(2)]]) {
75                                 translate(xz)
76                                 translate([0,-sidethick,0])
77                                         rotate([0,45,0])
78                                         translate([0,0,-sidethick])
79                                         cube([100, sidethick, sidethick]);
80                         }
81                         translate([-mw2,-sidethick,0])
82                                 cube([motorwidth,sidethick,
83                                         motorheight+pillarthick]);
84                 }
85         }
86 }
87
88 module towerbase() {
89         difference(){
90                 union(){
91                         for (angle=[0,90,180,270])
92                                 rotate([0,0,angle]) corner();
93                         for (angle=[0,90,180]) {
94                                 rotate([0,0,angle]) halfside();
95                                 rotate([0,0,angle]) mirror([1,0,0]) halfside();
96                         }
97                 }
98                 multmatrix([[   -1,     0,      0, -mw2 - botleftstand ],
99                         [       0,      1,      0,      -100    ],
100                         [       1,      0,      1, -100 + botleftgap ],
101                         [       0,      0,      0,      1       ] ])
102                         cube([100,200,100]);
103         }
104         translate([0,0,totalheight])
105                 rotate([0,-90,0])
106                 dovetail(height=10.1, male=true);
107 }
108
109 //intersection(){
110         towerbase();
111 //      translate([-100,-100,0]) cube([200,200,32]);
112 //}