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