chiark / gitweb /
filamenttrestle HubEnd
[reprap-play.git] / filamenttrestle.scad
1 // -*- C -*-
2
3 spoolwidth = 80; // fixme needs to be measured
4 spoolinnerrad = 25; // fixme needs to be checked
5 spoolouterrad = 60; // fixme needs to be checked
6
7 include <doveclip.scad>
8 include <axlepin.scad>
9
10 spoolradclear = 10;
11 spoolradslop = 2;
12
13 spoolinnerslop = 2;
14 axleslop = 0.5;
15
16 axlerad = 7;
17 barwasherrad = 17;
18
19 hubbasethick = 6;
20 hubmainthick = 20;
21 hubbaseweb = 2;
22 hubbasestalkwidth = 6;
23 hubwalls = 3;
24 hubpillarw = 4;
25 hubbaserad = spoolinnerrad + 15;
26 hubmainrad = spoolinnerrad - spoolradslop;
27
28 legw = 12;
29 plugl = 20;
30 plugwmin = 3;
31 plugh = 10;
32 plugslope = 0.5;
33 plugwmax = plugwmin + plugh * plugslope * 2;
34
35 trestlelegw = 10;
36 trestlebaseh = 10;
37 trestleplugd = 1;
38
39 topblockthick = 4;
40 topblockbasedepth = 5;
41
42 pinbasew = 5.0;
43 pinminh = 1.5;
44 pinmaxh = 4.5;
45 pindh = 0.50;
46 pindwidth = 0.75;
47
48 pintaperlen = plugwmax * 0.85;
49 pinstraightlen = 10;
50
51 spoolouterpad = AxlePin_holerad()*2 * 1.5;
52 spoolbarlen = spoolwidth +
53   2*(Washer_thick() + hubbasethick + AxlePin_holerad()
54      + spoolinnerslop + spoolouterpad);
55   barz = axlerad * 0.5;
56 axlepin_x = spoolwidth/2 + hubbasethick +
57   Washer_thick() + spoolinnerslop + AxlePin_holerad()*0.5;
58
59 trestleheight = spoolouterrad + spoolradclear - barz;
60 trestlebase = trestleheight * 1.2;
61
62 module Plug(d=0){
63   dw = d;
64   dh = d;
65   dhb = d*2;
66   a = atan(plugslope);
67   bdy = -dhb;
68   bdx = dw / cos(a) + bdy * plugslope;
69   tdy = dh;
70   tdx = bdx + tdy * plugslope;
71   translate([-d,0,0]) rotate([90,0,90]) linear_extrude(height=plugl+0.1+d*2){
72     polygon([[-(plugwmin/2 + bdx),  bdy],
73              [-(plugwmax/2 + tdx),  plugh + tdy],
74              [+(plugwmax/2 + tdx),  plugh + tdy],
75              [+(plugwmin/2 + bdx),  bdy]]);
76   }
77 }
78
79 module Bar(){ ////toplevel
80   spoolw = spoolbarlen;
81   biggestw = spoolw + 50;
82
83   intersection(){
84     for (mir=[0,1]) {
85       mirror([mir,0,0]) {
86         translate([spoolw/2, 0, 0])
87           Plug();
88         translate([-1, -50, -50])
89           cube([spoolw/2+1.1, 100, 100]);
90       }
91     }
92     difference(){
93       translate([-biggestw/2, -50, 0])
94         cube([biggestw, 100, 100]);
95       for (mir=[0,1]) {
96         mirror([mir,0,0])
97           translate([axlepin_x, 0, -50])
98           cylinder(r=AxlePin_holerad(), 100, $fn=15);
99       }
100     }
101     translate([0,0,barz]) {
102       translate([-100,0,0])
103         rotate([0,90,0]) cylinder(r=axlerad, h=200, $fn=30);
104     }
105   }
106 }
107
108 module FtAxlePin(){ ////toplevel
109   AxlePin(axlerad, (axlerad + barwasherrad*2)/3 * 2);
110 }
111
112 module AxleWasher(){ ////toplevel
113   Washer(axlerad, barwasherrad);
114 }
115
116 module Trestle(){ ////toplevel
117   legang = atan2(trestlebase/2, trestleheight);
118   eplen = sqrt(trestleheight*trestleheight + trestlebase*trestlebase*0.25);
119   topblockw = plugwmax + trestleplugd*2 + topblockthick*2;
120
121   pinholebasew = pinbasew + pindwidth*2;
122   pinholeh =     pinmaxh +  pindh;
123
124   difference(){
125     union(){
126       for (mir=[0,1]) {
127         mirror([mir,0,0]) {
128           rotate([0,0, -90-legang])
129             ExtenderPillars(length=eplen+trestlelegw,
130                             width=trestlelegw,
131                             height=legw,
132                             baseweb=true);
133
134           translate([-trestlebase/2, -trestleheight, 0])
135             cylinder(r=trestlelegw/2*1.2, h=plugl);
136         }
137       }
138       translate([-topblockw/2, -topblockbasedepth, 0])
139         cube([topblockw,
140               topblockbasedepth + plugh + topblockthick
141               + (pinmaxh - pinminh)*0.6 + pindh,
142               plugl]);
143
144       translate([-trestlebase/2, -trestleheight, 0])
145         ExtenderPillars(length=trestlebase, width=trestlebaseh*2, height=legw);
146     }
147     translate([-300, -trestleheight-50, -1])
148       cube([600, 50, plugl+2]);
149
150     rotate([-90,-90,0])
151       Plug(d=trestleplugd);
152
153     for (rot=[0,180]) {
154       translate([0,0,plugl/2]) rotate([0,rot,0]) translate([0,0,-plugl/2]) {
155         translate([0,
156                    plugh + pindh - (pinmaxh - pinminh)*0.75,
157                    (plugl - pinholebasew*2)/3]) {
158           translate([-(topblockw*0.25+1), 0, pinholebasew/2])
159             rotate([-90,0,0]) %Pin();
160           translate([-(topblockw+1), 0, 0]) {
161             rotate([0,90,0]) {
162               linear_extrude(height = topblockw*1.0+2) {
163                 polygon([[-1.0 * pinholebasew, -0.01],
164                          [-0.5 * pinholebasew, pinholeh],
165                          [ 0                 , -0.01]]);
166               }
167             }
168           }
169         }
170       }
171     }
172   }
173 }
174
175 module Pin(){ ////toplevel
176   rotate([90,0,90]) {
177     hull(){
178       for (mir=[0,1]) {
179         mirror([mir,0,0]) {
180           linear_extrude(height=0.1) {
181             polygon([[-0.01, 0],
182                      [-0.01, pinminh],
183                      [pinbasew*0.5*(pinminh/pinmaxh), 0]]);
184           }
185           translate([0,0,pintaperlen])
186             linear_extrude(height=pinstraightlen) {
187             polygon([[-0.01, 0],
188                      [-0.01, pinmaxh],
189                      [pinbasew*0.5, 0]]);
190           }
191         }
192       }
193     }
194   }
195 }
196
197 module HubEnd(){ ////toplevel
198   thick = hubmainthick+hubbasethick;
199   difference(){
200     union(){
201       for (ang=[0 : 60 : 359]) {
202         rotate([0,0,ang]) {
203           translate([hubmainrad - hubwalls/2, -hubbasestalkwidth/2, 0])
204             cube([hubbaserad - (hubmainrad - hubwalls/2),
205                   hubbasestalkwidth, hubbasethick]);
206           ExtenderPillar(length = hubmainrad-hubwalls/2,
207                          height = hubbasethick + hubmainthick,
208                          pillarw = hubpillarw);
209         }
210       }
211       cylinder(r=axlerad+hubwalls, h=thick);
212       cylinder(r=hubmainrad-0.1, h=hubbaseweb);
213       difference(){
214         cylinder(r=hubmainrad, h=thick, $fn=100);
215         translate([0,0,-1])
216           cylinder(r=hubmainrad-hubwalls, h=thick+2);
217       }
218       difference(){
219         cylinder(r=hubbaserad, h=hubbasethick, $fn=50);
220         translate([0,0,-1])
221           cylinder(r=hubbaserad-hubwalls, h=hubbasethick+2);
222       }
223     }
224     translate([0,0,-1])
225       cylinder(r=axlerad+axleslop, h=thick+2, $fn=50);
226   }
227 }
228
229
230 module TestKit(){ ////toplevel
231   translate([30,0,0]) Pin();
232   translate([30,30,0]) Pin();
233   translate([0,40,0]) intersection(){
234     Trestle();
235     translate([-50,-10,-1]) cube([100,100,100]);
236   }
237   intersection(){
238     translate([-60,0,0]) Bar();
239     cube(50,center=true);
240   }
241 }
242
243 module DemoSpool(){
244   rotate([0,90,0]) translate([0,0,-spoolwidth/2])
245     difference(){
246       cylinder(r=spoolouterrad, h=spoolwidth);
247       translate([0,0,-1]) cylinder(r=spoolinnerrad, h=spoolwidth+2);
248     }
249 }
250
251 module Demo(){
252   Bar();
253   for (mir=[0,1]) {
254     mirror([mir,0,0]) {
255       translate([spoolbarlen/2,0,0]) rotate([90,0,90]) Trestle();
256       translate([spoolwidth/2 + hubbasethick + spoolinnerslop/4, 0, barz])
257         rotate([0,90,0]) AxleWasher();
258       translate([axlepin_x, 0, barz]) rotate([90,0,90]) FtAxlePin();
259     }
260   }
261   %translate([0,0,barz]) DemoSpool();
262 }
263
264 //Bar();
265 //FtAxlePin();
266 //AxleWasher();
267 //Trestle();
268 //Pin();
269 //TestKit();
270 //Plug(d=1);
271 //ExtenderPillars(80,12,8, baseweb=true);
272 HubEnd();
273 //Demo();