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