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