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