chiark / gitweb /
2ce691e9975526c9317d70fe23eb8e43e6bd67e8
[reprap-play.git] / poster-tube-lid.scad
1 // -*- C -*-
2
3 main_dia = 71.2 + 0.50;
4 top_thick = 4;
5
6 main_cnr = 4.0;
7
8 rivet_posn = 6.0;
9 rivet_thick = 1.67;
10 rivet_width = 4.15 + 1.0;
11 rivet_tall = 5.51 + 0.49;
12
13 over_rivet_wall = 0.5;
14 side_rivet_gap = 1.5;
15
16 bayo_interf = 0.75;
17 bayo_behind = 3.5;
18 bayo_interf_width = 2.0;
19 bayo_interf_slope = 0.75;
20
21 seal_thick = 0.1;
22 seal_recess = [ 2.0, 2.0 ]; // recess depth, recess height
23
24 side_taper = 1.0;
25
26 bayo_above_gap = 1.0;
27
28 bayo_entry = bayo_behind/3;
29
30 bayo_slice_size = 10;
31
32 // calculated
33
34 bayo_entry_x = bayo_entry;
35 bayo_entry_z = bayo_entry;
36 bayo_inramp_x = bayo_entry;
37 bayo_inramp_z = bayo_entry;
38
39 side_height = rivet_posn + bayo_behind + rivet_thick/2;
40 side_thick = rivet_tall + over_rivet_wall;
41
42 top_z = top_thick + seal_thick;
43
44 bayo_entry = bayo_behind / 3.0;
45 bayo_top_z = bayo_behind + rivet_thick + bayo_above_gap;
46 bayo_entry_ramp = bayo_entry + bayo_interf;
47
48 rivet_entry_width = rivet_width + side_rivet_gap;
49
50 $fs=0.5;
51 $fa=1;
52
53 // bayonet definition
54
55 bayo_a = [ bayo_entry_x, 0 ];
56 bayo_p = [ 0, bayo_entry_z ];
57 bayo_n = [ 0, bayo_behind-bayo_inramp_z ];
58 bayo_m = [ bayo_inramp_x, bayo_behind ];
59 bayo_l = bayo_m + bayo_interf * [ 1/bayo_interf_slope,  1 ];
60 bayo_k = bayo_l + [ bayo_interf_width, 0 ];
61 bayo_j = bayo_k + bayo_interf * [ 1/bayo_interf_slope, -1 ];
62 bayo_i = bayo_j + [ rivet_width, 0 ];
63 bayo_h = [ bayo_i[0], bayo_behind + rivet_thick + bayo_above_gap ];
64 bayo_g = [ bayo_m[0] - rivet_width, bayo_h[1] ];
65
66 bayo_e = [-bayo_p[0], bayo_p[1]] - [rivet_entry_width,0];
67 bayo_d = [-bayo_a[0], bayo_a[1]] - [rivet_entry_width,0];
68 bayo_c = bayo_d + [0,-5];
69 bayo_b = bayo_a + [0,-5];
70
71 bayo_f = [ bayo_e[0], bayo_g[1] + (bayo_e[0] - bayo_g[0]) ];
72
73 bayo_polygon = [ bayo_a,
74                  bayo_b,
75                  bayo_c,
76                  bayo_d,
77                  bayo_e,
78                  bayo_f,
79                  bayo_g,
80                  bayo_h,
81                  bayo_i,
82                  bayo_j,
83                  bayo_k,
84                  bayo_l,
85                  bayo_m,
86                  bayo_n,
87                  bayo_p ];
88
89 echo(bayo_polygon);
90
91 module MainProfile(){
92   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
93   translate(main_cnr_pos){
94     intersection(){
95       difference(){
96         circle(r = main_cnr);
97         circle(r = main_cnr * 0.5);
98       }
99       square([10,10]);
100     }
101   }
102   polygon([[ -1,                    seal_thick        ],
103            [ -1,                    top_z             ],
104            [ main_cnr_pos[0],       top_z             ],
105            [ side_thick,            main_cnr_pos[1]   ],
106            [ side_thick,            -side_height      ],
107            [ side_taper,            -side_height      ],
108            [ 0,                     -rivet_posn       ],
109            [ 0,                     -(seal_recess[0] + seal_recess[1]) ],
110            [ seal_recess[0],        -(seal_recess[0]) ],
111            [ seal_recess[0],        seal_thick        ],
112            ]);
113 }
114
115 module BayonetCutoutSlice(offset){
116   rotate([0,0, atan2(offset, main_dia/2 + side_thick) ]){
117     intersection(){
118       translate([-offset, -10, 0])
119         rotate([90,0,0])
120         linear_extrude(height= main_dia*2)
121         polygon(bayo_polygon);
122       translate([0,0, -25])
123         cylinder(h=50, r= main_dia/2 + rivet_tall);
124       #translate([0,0, -25])
125         linear_extrude(height= 50)
126         polygon([ [ 0,0 ],
127                   [ -bayo_slice_size, -main_dia ],
128                   [ +bayo_slice_size, -main_dia ] ]);
129     }
130   }
131 }
132
133 module BayonetCutout(){
134   offs = [ for (i=[-5 : +5]) i ] * bayo_slice_size;
135   echo (offs);
136 *    BayonetCutoutSlice(5);
137   for (off =offs
138          
139          //[ -20 : bayo_slice_size : 20 ]
140        ){
141     translate([ off * 5, 0,0 ])
142     echo(off);
143     BayonetCutoutSlice(off);
144   }
145 }
146
147 module ProfilesDemo(){
148   translate([-20,0]) MainProfile();
149   polygon(bayo_polygon);
150 }
151
152 //ProfilesDemo();
153 BayonetCutout();