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