]> www.fi.muni.cz Git - things.git/blob - zralok.scad
switch holder.scad
[things.git] / zralok.scad
1
2 // Module names are of the form poly_<inkscape-path-id>().  As a result,
3 // you can associate a polygon in this OpenSCAD program with the corresponding
4 // SVG element in the Inkscape document by looking for the XML element with
5 // the attribute id="inkscape-path-id".
6
7 // fudge value is used to ensure that subtracted solids are a tad taller
8 // in the z dimension than the polygon being subtracted from.  This helps
9 // keep the resulting .stl file manifold.
10 fudge = 0.1;
11
12 module poly_zralok(h)
13 {
14 //X
15 scale([4, 4, 1])
16   scale([25.4/90, -25.4/90, 1]) union()
17   {
18     linear_extrude(height=h)
19       polygon([[-40.858498,-11.592409],[-36.000007,-7.186634],[-33.292523,-4.816239],[-30.650064,-2.097776],[-28.260519,1.146054],[-26.311774,5.092548],[-24.991719,9.919005],[-24.488240,15.802721],[-22.472086,13.769083],[-21.197935,11.835814],[-20.431276,9.944958],[-19.937597,8.038558],[-18.831129,3.947296],[-17.749317,1.646520],[-16.002434,-0.901629],[-9.938983,-0.709674],[-4.476799,0.401865],[0.417619,2.381753],[4.777772,5.178751],[4.896437,8.595874],[4.588235,11.746205],[3.374607,17.673601],[16.671266,12.060941],[19.631686,15.655756],[22.803045,18.842606],[26.055475,21.533858],[29.259107,23.641879],[32.284071,25.079035],[35.000500,25.757693],[37.278524,25.590219],[38.988276,24.488981],[39.977084,23.001132],[40.590364,21.299700],[40.858498,19.414019],[40.811872,17.373426],[39.895872,12.944845],[38.085432,8.248636],[35.623624,3.519485],[32.753518,-1.007929],[29.718183,-5.098920],[26.760691,-8.518809],[25.843283,-13.048453],[24.312444,-17.402831],[22.318589,-21.624919],[20.012136,-25.757693],[19.215932,-22.789169],[18.002881,-20.081175],[16.257657,-17.705789],[13.864936,-15.735089],[8.737787,-16.794256],[4.076750,-17.260681],[-0.218945,-17.176811],[-4.250067,-16.585098],[-8.117386,-15.527989],[-11.921669,-14.047935],[-19.744206,-9.988789],[-24.432088,-11.201856],[-29.088590,-12.097069],[-34.351474,-12.339046],[-40.858498,-11.592409]]);
20   }
21 }
22
23 //X poly_zralok(5);
24
25 draft = 0;
26 eps = 0.01;
27 infty = 100;
28
29 kuzel_def = [
30         [ 6.5, 0 ],
31         [ 6.5, 1.5 ],
32         [ 3.5, 4 ],
33         [ 2.5, 6 ],
34         [ 1.5, 13.0 ],
35         [ 0.5, 15.0 ],
36 ];
37
38 module kuzel() {
39         for (i = [0 : len(kuzel_def)-2]) {
40                 translate([0, 0, kuzel_def[i][1]])
41                         cylinder(r1 = kuzel_def[i][0],
42                                 r2 = kuzel_def[i+1][0],
43                                 h = kuzel_def[i+1][1] + eps - kuzel_def[i][1]);
44         }
45 };
46
47 difference(){
48         minkowski(){
49                 poly_zralok(eps);
50                 if (draft == 1) {
51                         kuzel($fn = 6);
52                 } else {
53                         kuzel($fn = 32);
54                 }
55         }
56         translate([0,0,-infty/2]) poly_zralok(infty);
57 };