SetFactory("OpenCASCADE");
R = 35;
r = 15;
h1 = 180;
h2 = 200;
totalTck = 4;
layers = 2;  // Layers in the thickness
Rfil = 10;
rfil = 5;
rfilneck = 5;

tck = totalTck / layers;

Point(1) = {0,0,0};
Point(2) = {R-Rfil,0,0};
Point(3) = {R-Rfil, Rfil, 0};
Point(4) = {R, Rfil, 0};
Point(5) = {R,h1-rfil,0};
Point(6) = {R-rfil,h1-rfil,0};
Point(7) = {R-rfil,h1,0};
Point(8) = {r+rfilneck,h1,0};
Point(9) = {r+rfilneck,h1+rfilneck,0};
Point(10) = {r,h1+rfilneck,0};
Point(11) = {r,h2,0};

Point(12) = {r-tck,h2,0};
Point(13) = {r-tck,h1+rfilneck,0};
Point(14) = {r+rfilneck,h1-tck,0};
Point(15) = {R-rfil,h1-tck,0};
Point(16) = {R-tck,h1-rfil,0};
Point(17) = {R-tck, Rfil, 0};
Point(18) = {R-Rfil,tck,0};
Point(19) = {0,tck,0};

Point(20) = {r-2*tck,h2,0};
Point(21) = {r-2*tck,h1+rfilneck,0};
Point(22) = {r+rfilneck,h1-2*tck,0};
Point(23) = {R-rfil,h1-2*tck,0};
Point(24) = {R-2*tck,h1-rfil,0};
Point(25) = {R-2*tck, Rfil, 0};
Point(26) = {R-Rfil,2*tck,0};
Point(27) = {0,2*tck,0};

Line(1) = {1, 2};
Circle(2) = {2, 3, 4};
Line(3) = {4, 5};
Circle(4) = {5, 6, 7};
Line(5) = {7, 8};
Circle(6) = {8, 9, 10};
Line(7) = {10, 11};

Line(8) = {11, 12};
Line(9) = {12, 13};
Circle(10) = {13, 9, 14};
Line(11) = {14, 15};
Circle(12) = {15, 6, 16};
Line(13) = {16, 17};
Circle(14) = {17, 3, 18};
Line(15) = {18, 19};
Line(16) = {19, 1};

Line(17) = {12, 20};
Line(18) = {20, 21};
Circle(19) = {21, 9, 22};
Line(20) = {22, 23};
Circle(21) = {23, 6, 24};
Line(22) = {24, 25};
Circle(23) = {25, 3, 26};
Line(24) = {26, 27};
Line(25) = {27, 19};

Line Loop(1) = {15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
Plane Surface(1) = {1};
Line Loop(2) = {24, 25, -15, -14, -13, -12, -11, -10, -9, 17, 18, 19, 20, 21, 22, 23};
Plane Surface(2) = {2};

Recombine Surface{1, 2};

Extrude {{0, 1, 0}, {0, 0, 0}, Pi} {
  Surface{1,2}; Layers{30}; Recombine;
}
Extrude {{0, 1, 0}, {0, 0, 0}, -Pi} {
  Surface{1,2}; Layers{30}; Recombine;
}

/*
Physical Surface("External") = {68, 70, 72, 74, 76, 78, 71, 73, 75, 77, 79, 81};
Physical Surface("Internal") = {94, 92, 90, 88, 86, 84, 83, 97, 95, 93, 91, 89, 87, 85};
*/
Physical Surface("Top") = {11, 20, 36, 45};
Physical Surface("Bottom") = {4, 29};
Physical Volume("Bottle") = {1:4};

Mesh 3;
Coherence Mesh;
Save "test.msh";
