chiark / gitweb /
poster-tube-lid: wip bayonet
[reprap-play.git] / poster-tube-lid.scad.pl
1 #!/usr/bin/perl -w
2 # -*- C -*-
3
4 use strict;
5 use autodie;
6
7 my $settings = <<'END';
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_gap = 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 bayo_above_gap = 1.0;
30
31 // calculated
32
33 side_height = rivet_posn + bayo_behind;
34 side_thick = rivet_tall + over_rivet_gap;
35
36 top_z = top_thick + seal_thick;
37
38 bayo_entry = bayo_behind / 3.0;
39 bayo_top_z = bayo_behind + rivet_thick + over_rivet_gap;
40
41 $fs=0.5;
42 $fa=5;
43
44 // bayonet definition
45
46 bayo_polygon = [[ -bayo_entry,        -5             ],
47                 [ -bayo_entry,        0              ],
48                 [ 0,                  bayo_entry     ],
49                 [ bayo_entry,         bayo_entry     ]];
50
51 END
52
53 my $mainbody = <<'END';
54
55 module MainProfile(){
56   main_cnr_pos = [ side_thick, top_z ] - [1,1]*main_cnr;
57   translate(main_cnr_pos){
58     intersection(){
59       difference(){
60         circle(r = main_cnr);
61         circle(r = main_cnr * 0.5);
62       }
63       square([10,10]);
64     }
65   }
66   polygon([[ -1,                    seal_thick        ],
67            [ -1,                    top_z             ],
68            [ main_cnr_pos[0],       top_z             ],
69            [ side_thick,            main_cnr_pos[1]   ],
70            [ side_thick,            -side_height      ],
71            [ side_taper,            -side_height      ],
72            [ 0,                     -rivet_posn       ],
73            [ 0,                     -(seal_recess[0] + seal_recess[1]) ],
74            [ seal_recess[0],        -(seal_recess[0]) ],
75            [ seal_recess[0],        seal_thick        ],
76            ]);
77 }
78
79 translate([-20,0]) MainProfile();
80
81 polygon(bayo_polygon);
82
83 END
84
85 print $settings, $mainbody or die $!;
86