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