chiark / gitweb /
poster-tube-lid: sloping bottom of catch tip
[reprap-play.git] / pattress-boxes-3-cover.scad
1 // -*- C -*-
2
3 patbox_side = 87;
4 patbox_centres = 60.3;
5
6 lid_thinboxbase_overlap = 5;
7 lid_fatbox_overlap = 12;
8
9 lid_thinbox_h = 9;
10 lid_fatbox_h = 24;
11 lid_fatbox_switches_h = 6+4;
12
13 lid_max_switches_w = 70;
14 lid_switches_y_slop = 3;
15
16 total_len = 260;
17 thinbox_len = 87;
18
19 rail_overlap = 8;
20
21 lid_top_wall = 1.5;
22 lid_front_wall = 1.5;
23 lid_side_wall = 1.5;
24
25 peg_engage_depth = 1;
26 peg_engage_dia = 6.5;
27 peg_main_dia = 9;
28 peg_max_dia = 15;
29 peg_inner_dia = 3.5;
30 peg_top_thick = 1;
31 peg_straight_len = 3;
32
33 $peg_inner_slop = 0.75;
34 $peg_outer_slop = -0.9;
35 $peg_outer_slop_engage = 0.1;
36
37 peg_slope = 1;
38
39 lid_side_slop = 0.5;
40 lid_rail_behindslop = 0.5;
41 lid_rail_strongwall = 2.5;
42
43 // computed
44
45 lid_inner_max_h =
46   lid_thinboxbase_overlap + lid_fatbox_h + lid_fatbox_switches_h;
47 lid_inner_min_h = lid_fatbox_overlap + lid_fatbox_switches_h;
48
49 lid_inner_kink = [thinbox_len, thinbox_len*2];
50
51 lid_inner_w_nom = patbox_side;
52 lid_inner_w = lid_inner_w_nom + lid_side_slop * 2;
53
54 lid_seatline_w = (lid_inner_w - lid_max_switches_w)/2 - lid_switches_y_slop;
55
56 lid_seatline_h = lid_fatbox_switches_h;
57
58 peg_main_height = peg_straight_len + (peg_max_dia - peg_main_dia)/2/peg_slope;
59
60 thinbox_front_z = lid_fatbox_switches_h + lid_fatbox_h - lid_thinbox_h;
61
62 raillen = patbox_side/2 + rail_overlap;
63
64 module LidSideProfile(){
65   polygon([[-lid_top_wall,     lid_inner_max_h],
66            [min(lid_inner_kink[0],total_len), lid_inner_max_h],
67            [min(lid_inner_kink[1],total_len), lid_inner_min_h],
68            [total_len,         lid_inner_min_h],
69            [total_len,         -lid_front_wall],
70            [-lid_top_wall,     -lid_front_wall]]);
71 }
72
73 module RailProfile(lslop=0.1){
74   yt_base = thinbox_front_z;
75   yt = yt_base - lid_rail_behindslop;
76   pegx = (lid_inner_w_nom - patbox_centres)/2;
77   sw = lid_rail_strongwall;
78   
79   polygon([[-lslop,                  yt],
80            [pegx - peg_main_dia/2, yt],
81            [pegx - peg_main_dia/2, yt_base - peg_straight_len],
82            [sw,
83             yt_base - peg_straight_len - (pegx - peg_main_dia/2)/peg_slope
84             +sw],
85            [sw,
86             lid_seatline_h - 1],
87            [-lslop,
88             lid_seatline_h - 1]]);
89 }
90
91 module LidSide(){
92   overlap = [0.1, 0.1, 0.1];
93
94   // main side profile
95   rotate([90,0,0])
96     linear_extrude(height= lid_side_wall)
97     LidSideProfile();
98
99   // seatline
100   translate(-overlap)
101     cube(overlap + [total_len, lid_seatline_w, lid_seatline_h]);
102
103   // lid front
104   translate([-0.1, -0.1, -lid_front_wall])
105     cube([total_len+0.1, lid_inner_w/2 + 0.2, lid_front_wall]);
106
107   // lid top
108   translate([-lid_top_wall, -lid_side_wall, -lid_front_wall])
109     cube([lid_top_wall, lid_inner_w/2 + 10, lid_front_wall + lid_inner_max_h]);
110
111   // rail
112   rotate([90,0,90])
113     translate([0,0,-0.1])
114     linear_extrude(height=raillen+0.1) //todo
115     RailProfile();
116
117   // rail end
118   translate([raillen, 0,0])
119     intersection(){
120       rotate_extrude($fn=50)
121         RailProfile(lslop=0);
122       translate([0, 25-0.1, 0])
123         cube(50, center=true);
124     }
125 }
126
127 module Lid(){ ////toplevel
128   for (m=[0,1])
129     mirror([0,m,0])
130       translate([0, -lid_inner_w/2, 0]) LidSide();
131 }
132
133 module PegProfile(){
134   polygon([[-peg_engage_depth, (peg_engage_dia - $peg_outer_slop_engage)/2],
135            [0,                 (peg_engage_dia - $peg_outer_slop_engage)/2],
136            [0,                 (peg_main_dia - $peg_outer_slop)/2],
137            [peg_straight_len,  (peg_main_dia - $peg_outer_slop)/2],
138            [peg_main_height,   (peg_max_dia - $peg_outer_slop)/2],
139            [peg_main_height+peg_top_thick, (peg_max_dia - $peg_outer_slop)/2],
140            [peg_main_height+peg_top_thick, (peg_inner_dia + $peg_inner_slop)/2],
141            [-peg_engage_depth,  (peg_inner_dia + $peg_inner_slop)/2]]);
142 }
143
144 module Peg(){ ////toplevel
145   echo($peg_outer_slop_engage);
146   rotate_extrude($fn=50)
147     rotate([0,0,-90])
148     PegProfile();
149 }
150
151 module Pegs(){ ////toplevel
152   baseslop = 0.1;
153   dslops = [0, -0.5, -1.0, -1.5];
154   stride = peg_max_dia + 4;
155   for (i=[0:len(dslops)-1]) {
156     translate([i*stride,0,0])
157       assign($peg_outer_slop_engage= baseslop + dslops[i])
158       Peg();
159   }
160 }
161
162 module AtFixingCentres(){
163   for (fc=[-1,+1]) {
164     translate([patbox_side/2 + fc*patbox_centres/2,
165                patbox_side/2,
166                0])
167       children();
168   }
169 }
170
171 module TopPattressBox(){
172   difference(){
173     translate([0,0, -lid_thinbox_h])
174       cube([patbox_side, patbox_side, lid_thinbox_h]);
175     AtFixingCentres(){
176       translate([0,0,-10]) cylinder(r=peg_engage_dia/2, h=20);
177     }
178   }
179 }
180
181 module Demo(){
182   Lid();
183   translate([0,0, thinbox_front_z])
184     rotate([0,180,0]) translate([0, -patbox_side/2, 0])
185     rotate([0,0,90]) union(){
186       %TopPattressBox();
187       color("blue") AtFixingCentres(){
188         rotate([180,0,0]) Peg();
189       }
190   }
191 }
192
193 //LidSide();
194 //PegProfile();
195 //Peg();
196 //Pegs();
197 //TopPattressBox();
198 //RailProfile();
199 //Demo();
200 //Lid();
201 //translate([0,0,-lid_fatbox_switches_h]) Lid();