chiark / gitweb /
poster-tube-lid: make into a perl script
[reprap-play.git] / poster-tube-lid.scad.pl
1 #!/usr/bin/perl -w
2 # -*- C -*-
3
4 use strict;
5 use autodie;
6
7 print <<'END' or die $!;
8
9 main_dia = 71.2 + 0.50;
10 top_thick = 4;
11
12 main_cnr = 4.0;
13
14 rivet_posn = 6.0;
15 rivet_thick = 1.67;
16 rivet_width = 4.15 + 1.0;
17 rivet_tall = 5.51 + 0.49;
18
19 over_rivet = 0.5;
20
21 bayo_interf = 0.75;
22 bayo_behind = 3.5;
23
24 seal_thick = 0.1;
25 seal_recess = [ 2.0, 2.0 ]; // recess depth, recess height
26
27 side_taper = 1.0;
28
29 // calculated
30
31 side_height = rivet_posn + bayo_behind;
32 side_thick = rivet_tall + over_rivet;
33
34 top_z = top_thick + seal_thick;
35
36 $fs=0.5;
37 $fa=5;
38
39 module MainProfile(){
40   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
41   translate(main_cnr_pos){
42     intersection(){
43       difference(){
44         circle(r = main_cnr);
45         circle(r = main_cnr * 0.5);
46       }
47       square([10,10]);
48     }
49   }
50   polygon([[ -1,                    seal_thick        ],
51            [ -1,                    top_z             ],
52            [ main_cnr_pos[0],       top_z             ],
53            [ side_thick,            main_cnr_pos[1]   ],
54            [ side_thick,            -side_height      ],
55            [ side_taper,            -side_height      ],
56            [ 0,                     -rivet_posn       ],
57            [ 0,                     -(seal_recess[0] + seal_recess[1]) ],
58            [ seal_recess[0],        -(seal_recess[0]) ],
59            [ seal_recess[0],        seal_thick        ],
60            ]);
61 }
62
63 MainProfile();
64
65 END