chiark / gitweb /
c45e8af5472f4e58201ee466c5b970a9019b49aa
[reprap-play.git] / filamenttrestle.scad
1 // -*- C -*-
2
3 spoolwidth = 80; // fixme needs to be measured
4 trestleheight = 80; // fixme needs to be checked
5 trestlebase = 80; // fixme needs to be checked
6
7 include <doveclip.scad>
8
9 spoolwidthgap = 2;
10 barrady = 5;
11 barradz = 7;
12 guidewidth = 3;
13 guiderad = 20;
14
15 legw = 12;
16 plugl = 20;
17 plugwmin = 3;
18 plugh = 10;
19 plugslope = 0.5;
20 plugwmax = plugwmin + plugh * plugslope * 2;
21
22 trestlelegw = 10;
23 trestlebaseh = 10;
24 trestleplugd = 1;
25
26 topblockthick = 4;
27 topblockbasedepth = 4;
28
29 pinbasew = 5.0;
30 pinminh = 1.5;
31 pinmaxh = 4.0;
32 pindh = 0.75;
33 pindwidth = 0.75;
34
35 pintaperlen = plugwmax * 0.85;
36 pinstraightlen = 10;
37
38 module Plug(d=0){
39   dw = d;
40   dh = d;
41   a = atan(plugslope);
42   bdx = dw / cos(a);
43   tdy = dh;
44   tdx = bdx + dh * plugslope;
45   translate([-d,0,0]) rotate([90,0,90]) linear_extrude(height=plugl+0.1+d*2){
46     polygon([[-(plugwmin/2 + bdx),  0],
47              [-(plugwmax/2 + tdx),  plugh + tdy],
48              [+(plugwmax/2 + tdx),  plugh + tdy],
49              [+(plugwmin/2 + bdx),  0]]);
50   }
51 }
52
53 module Bar(){
54   spoolw = spoolwidth + spoolwidthgap*2;
55   barz = barradz * 0.5;
56   biggestw = spoolw + 50;
57
58   intersection(){
59     for (mir=[0,1]) {
60       mirror([mir,0,0]) {
61         translate([0,0,barz]) {
62           scale([1,barrady,barradz]) translate([-1,0,0])
63             rotate([0,90,0]) cylinder(r=1, h=spoolw/2+2, $fn=30);
64           translate([spoolw/2,0,0])
65             rotate([0,90,0]) cylinder(r=guiderad, h=guidewidth, $fn=60);
66         }
67         translate([spoolw/2 + guidewidth, 0, 0])
68           Plug();
69       }
70     }
71     translate([-biggestw/2, -50, 0])
72       cube([biggestw, 100, 100]);
73   }
74 }
75
76 module Trestle(){
77   legang = atan2(trestlebase/2, trestleheight);
78   eplen = sqrt(trestleheight*trestleheight + trestlebase*trestlebase*0.25);
79   topblockw = plugwmax + trestleplugd*2 + topblockthick*2;
80
81   pinholebasew = pinbasew + pindwidth*2;
82   pinholeh =     pinmaxh +  pindh;
83
84   difference(){
85     union(){
86       for (mir=[0,1]) {
87         mirror([mir,0,0]) {
88           rotate([0,0, -90-legang])
89             ExtenderPillars(length=eplen+trestlelegw,
90                             width=trestlelegw,
91                             height=legw,
92                             baseweb=true);
93
94           translate([-trestlebase/2, -trestleheight, 0])
95             cylinder(r=trestlelegw/2*1.2, h=plugl);
96         }
97       }
98       translate([-topblockw/2, -topblockbasedepth, 0])
99         cube([topblockw,
100               topblockbasedepth + plugh + topblockthick
101               + (pinmaxh - pinminh)*0.6 + pindh,
102               plugl]);
103
104       translate([-trestlebase/2, -trestleheight, 0])
105         ExtenderPillars(length=trestlebase, width=trestlebaseh*2, height=legw);
106     }
107     translate([-300, -trestleheight-50, -1])
108       cube([600, 50, plugl+2]);
109
110     rotate([-90,-90,0])
111       Plug(d=trestleplugd);
112
113     for (rot=[0,180]) {
114       translate([0,0,plugl/2]) rotate([0,rot,0]) translate([0,0,-plugl/2]) {
115         translate([-(topblockw*0.25+1),
116                    plugh + pindh - (pinmaxh - pinminh)*0.5,
117                    (plugl - pinholebasew*2)/3]) {
118           translate([0,0,pinholebasew/2]) rotate([-90,0,0]) %Pin();
119           rotate([0,90,0]) {
120             linear_extrude(height = topblockw*1.0+2) {
121               polygon([[-1.0 * pinholebasew, -0.01],
122                        [-0.5 * pinholebasew, pinholeh],
123                        [ 0                 , -0.01]]);
124             }
125           }
126         }
127       }
128     }
129   }
130 }
131
132 module Pin(){
133   rotate([90,0,90]) {
134     hull(){
135       for (mir=[0,1]) {
136         mirror([mir,0,0]) {
137           linear_extrude(height=0.1) {
138             polygon([[-0.01, 0],
139                      [-0.01, pinminh],
140                      [pinbasew*0.5*(pinminh/pinmaxh), 0]]);
141           }
142           translate([0,0,pintaperlen])
143             linear_extrude(height=pinstraightlen) {
144             polygon([[-0.01, 0],
145                      [-0.01, pinmaxh],
146                      [pinbasew*0.5, 0]]);
147           }
148         }
149       }
150     }
151   }
152 }
153
154 module TestKit(){
155   translate([30,0,0]) Pin();
156   translate([30,30,0]) Pin();
157   translate([0,40,0]) intersection(){
158     Trestle();
159     translate([-50,-10,-1]) cube([100,100,100]);
160   }
161   intersection(){
162     translate([-60,0,0]) Bar();
163     cube(50,center=true);
164   }
165 }
166
167 //Bar();
168 //Trestle();
169 //Pin();
170
171 TestKit();
172
173 //Plug(d=1);
174 //ExtenderPillars(80,12,8, baseweb=true);