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