chiark / gitweb /
pattress-boxes-3-cover: Fix lid_side_slop to be each side
[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+2;
12
13 lid_max_switches_w = 70;
14 lid_switches_y_slop = 3;
15
16 total_len = 260;
17 thinbox_len = 87;
18
19 lid_top_wall = 1.5;
20 lid_front_wall = 1.5;
21 lid_side_wall = 1.5;
22
23 peg_engage_depth = 1;
24 peg_engage_dia = 6.5;
25 peg_main_dia = 9;
26 peg_max_dia = 15;
27 peg_inner_dia = 3.5;
28 peg_top_thick = 1;
29 peg_straight_len = 3;
30
31 peg_inner_slop = 0.2;
32 peg_outer_slop = 0.1;
33
34 peg_slope = 1;
35
36 lid_side_slop = 0.5;
37
38 // computed
39
40 lid_inner_max_h =
41   lid_thinboxbase_overlap + lid_fatbox_h + lid_fatbox_switches_h;
42 lid_inner_min_h = lid_fatbox_overlap + lid_fatbox_switches_h;
43
44 lid_inner_kink = [thinbox_len, thinbox_len*2];
45
46 lid_inner_w = patbox_side + lid_side_slop * 2;
47
48 lid_rail_w = (lid_inner_w - lid_max_switches_w)/2 - lid_switches_y_slop;
49
50 lid_rail_h = lid_fatbox_switches_h;
51
52 echo(lid_rail_w);
53
54 peg_main_height = peg_straight_len + (peg_max_dia - peg_main_dia)/2/peg_slope;
55
56 echo(peg_main_height);
57
58 module LidSideProfile(){
59   polygon([[-lid_top_wall,     lid_inner_max_h],
60            [lid_inner_kink[0], lid_inner_max_h],
61            [lid_inner_kink[1], lid_inner_min_h],
62            [total_len,         lid_inner_min_h],
63            [total_len,         -lid_front_wall],
64            [-lid_top_wall,     -lid_front_wall]]);
65 }
66
67 module LidSide(){
68   overlap = [0.1, 0.1, 0.1];
69
70   // main side profile
71   rotate([90,0,0])
72     linear_extrude(height= lid_side_wall)
73     LidSideProfile();
74
75   // rail
76   translate(-overlap)
77     cube(overlap + [total_len, lid_rail_w, lid_rail_h]);
78
79   // lid front
80   translate([-0.1, -0.1, -lid_front_wall])
81     cube([total_len+0.1, lid_inner_w/2 + 0.2, lid_front_wall]);
82
83   // lid top
84   translate([-lid_top_wall, -lid_side_wall, -lid_front_wall])
85     cube([lid_top_wall, lid_inner_w/2 + 10, lid_front_wall + lid_inner_max_h]);
86 }
87
88 module PegProfile(){
89   polygon([[-peg_engage_depth, (peg_engage_dia - peg_outer_slop)/2],
90            [0,                 (peg_engage_dia - peg_outer_slop)/2],
91            [0,                 (peg_main_dia - peg_outer_slop)/2],
92            [peg_straight_len,  (peg_main_dia - peg_outer_slop)/2],
93            [peg_main_height,   (peg_max_dia - peg_outer_slop)/2],
94            [peg_main_height+peg_top_thick, (peg_max_dia - peg_outer_slop)/2],
95            [peg_main_height+peg_top_thick, (peg_inner_dia + peg_inner_slop)/2],
96            [-peg_engage_depth,  (peg_inner_dia + peg_inner_slop)/2]]);
97 }
98
99 module Peg(){
100   rotate_extrude($fn=50)
101     rotate([0,0,-90])
102     PegProfile();
103 }
104
105 module AtFixingCentres(){
106   for (fc=[-1,+1]) {
107     translate([patbox_side/2 + fc*patbox_centres/2,
108                patbox_side/2,
109                0])
110       children();
111   }
112 }
113
114 module TopPattressBox(){
115   difference(){
116     translate([0,0, -lid_thinbox_h])
117       cube([patbox_side, patbox_side, lid_thinbox_h]);
118     AtFixingCentres(){
119       translate([0,0,-10]) cylinder(r=peg_engage_dia/2, h=20);
120     }
121   }
122 }
123
124 module Demo(){
125   translate([0, -lid_inner_w/2, 0]) LidSide();
126   translate([0,0, lid_fatbox_h])
127     rotate([0,180,0]) translate([0, -patbox_side/2, 0])
128     rotate([0,0,90]) union(){
129       %TopPattressBox();
130   }
131 }
132
133 //LidSide();
134 //PegProfile();
135 //Peg();
136 //TopPattressBox();
137 Demo();