chiark / gitweb /
fairphone-case: prop: demo
[reprap-play.git] / tower-base.scad
1 /* -*- C -*- */
2
3 motorwidth=35.7;
4 motorheight=34.5;
5 totalheight=58;
6
7 pillarthick=8;
8 sidethick=2.5;
9 archthick=6.5;
10 frameextra=3.5;
11 framesplayx=5;
12 framesplayy=5;
13 botleftgap=4.5;
14 botleftstand=0.75;
15 archoutwards=(pillarthick-archthick)/sqrt(8);
16
17 topgluecubex=18;
18 topgluecubez=5;
19 clippairy=16;
20 clippairdz=-2.5;
21 topgluecubedy=1;
22
23 dovebasecutcylz=4;
24 dovebasecutcylr=10;
25
26 d=0.01;
27
28 mw2=motorwidth/2;
29
30 include <doveclip.scad>
31
32 module corner() {
33   $fn=30;
34   frameheight= motorheight + frameextra;
35   slopeheight= totalheight - frameheight;
36   slopex = (mw2 + archoutwards - framesplayx)/slopeheight;
37   slopey = (mw2 + archoutwards - framesplayy)/slopeheight;
38   echo(sqrt(slopex*slopex + slopey*slopey));
39
40   translate([-mw2,-mw2,0]) union(){
41     difference(){
42       union(){
43         cylinder(r=pillarthick/2, h=frameheight);
44         translate([0,0,frameheight])
45           sphere(r=pillarthick/2);
46       }
47       translate([d,d,-1])
48         cube([mw2-1,mw2-1,frameheight+pillarthick+2]);
49     }
50     intersection(){
51       multmatrix
52         ([      [       1,      0,      slopey, -archoutwards ],
53                 [       0,      1,      slopex, -archoutwards ],
54                 [       0,      0,      1, frameheight  ],
55                 [       0,      0,      0,      1       ]])
56         translate([0,0,-frameextra])
57         cylinder(r=archthick/2,
58                  h=slopeheight+frameextra);
59       union() {
60         cylinder(r=pillarthick/2, h=frameheight);
61         translate([-100,-100,frameheight])
62           cube([200,200,100]);
63       }
64     }
65   }
66 }
67
68 module halfside() {
69   spacesz = (motorwidth - pillarthick/2*2) / 4;
70   panelheight = spacesz + sidethick;
71   panelbasez = motorheight+pillarthick/4-panelheight;
72   translate([0,-mw2,0]) {
73     translate([-mw2,-sidethick,0])
74       cube([motorwidth,sidethick,sidethick]);
75     difference(){
76       translate([-mw2,-sidethick, panelbasez])
77         cube([mw2,sidethick,panelheight]);
78       translate([-mw2+pillarthick/3, -sidethick, panelbasez])
79         rotate([0,45,0])
80         translate([0,-1,0])
81         cube([spacesz * sqrt(2),
82               sidethick+2,
83               spacesz * sqrt(2)]);
84     }
85     intersection(){
86       for (xz=[[-mw2+pillarthick/3-sidethick, 0,
87                 panelbasez+sidethick],
88                [0, 0, panelbasez + sidethick/sqrt(2)]]) {
89         translate(xz)
90           translate([0,-sidethick,0])
91           rotate([0,55,0])
92           translate([0,0,-sidethick])
93           cube([100, sidethick, sidethick]);
94       }
95       translate([-mw2,-sidethick,0])
96         cube([motorwidth,sidethick,
97               motorheight+pillarthick]);
98     }
99   }
100 }
101
102 module towerbase() {
103   difference(){
104     union(){
105       for (mirx=[0,1]) for (miry=[0,1])
106                          mirror([mirx,0,0]) mirror([0,miry,0]) corner();
107       for (angle=[0,90,180]) {
108         rotate([0,0,angle]) halfside();
109         rotate([0,0,angle]) mirror([1,0,0]) halfside();
110       }
111     }
112 //    multmatrix([[     -1,     0,      0, -mw2 - botleftstand ],
113 //              [       0,      1,      0,      -100    ],
114 //              [       1,      0,      1, -100 + botleftgap ],
115 //              [       0,      0,      0,      1       ] ])
116 //      cube([100,200,100]);
117   }
118   translate([clippairy/2,0,totalheight]) {
119     difference(){
120       translate([-clippairy+topgluecubedy/2,-topgluecubex/2,0])
121         cube([clippairy-topgluecubedy,topgluecubex,topgluecubez]);
122     }
123     translate([0,0,topgluecubez+clippairdz+DoveClip_depth()]) rotate([0,-90,0])
124 //      DoveClipPair(h=clippairy);
125       DoveClipPairSane(h=clippairy, count=3);
126   }
127 }
128
129 if (towerbase_demo) {
130   intersection(){
131     translate([0,0,-50]) towerbase();
132     translate([-100,-100,0]) cube([200,200,32]);
133   }
134
135   intersection(){
136     translate([40,0,-60]) towerbase();
137     translate([-100,-100,0]) cube([200,200,32]);
138   }
139
140   translate([60,-90,0]) {
141     DoveClipPairSane(h=clippairy, count=3);
142     mirror([1,0,0]) translate([DoveClip_depth()-0.1,0,0]) cube([20,8,6]);
143   }
144
145   for (x=[0,20,40]) {
146     translate([x,-50,0]) DoveClipPin(h=clippairy);
147     translate([x+10,-50,0]) DoveClipPin(h=clippairy/2);
148     translate([x+10,-30,0]) DoveClipPin(h=clippairy/2);
149   }
150 } else {
151   towerbase();
152 }