 lc = 0.10;

// geracao da base
 
 Point(1) = {-0.160,-0.0225,-0.040,lc};
 Point(2) = {-0.160,-0.0225,0.040,lc};
 Point(3) = {-0.160,0.0275,0.040,lc};
 Point(4) = {-0.160,0.0275,-0.040,lc};

 Line(1) = {1,2};
 Line(3) = {2,3}; 
 Line(5) = {3,4};
 Line(7) = {4,1};

 Line Loop(9) = {1,3,5,7};
 Plane Surface(10) = {9};
 Extrude Surface{10,{0.320,0.0,0}};

Transfinite Line {1} = 5 Using Progression 1.0;
Transfinite Line {3} = 5 Using Progression 1.0;
Transfinite Line {5} = 5 Using Progression 1.0;
Transfinite Line {7} = 5 Using Progression 1.0;
Transfinite Line {12} = 5 Using Progression 1.0;
Transfinite Line {13} = 5 Using Progression 1.0;
Transfinite Line {14} = 5 Using Progression 1.0;
Transfinite Line {15} = 5 Using Progression 1.0;
Transfinite Line {17,18,22,26} = 33 Using Progression 1.0;

Transfinite Surface{10} = {1,2,3,4};
Transfinite Surface{19} = {1,2,6,5};
Transfinite Surface{31} = {1,4,14,5};
Transfinite Surface{23} = {2,3,10,6};
Transfinite Surface{27} = {4,3,10,14};
Transfinite Surface{32} = {5,6,10,14};

Transfinite Volume{1} = {1,2,3,4,5,6,10,14};
Recombine Surface {10,19,31,23,27,32};

Physical Surface(33) = {10,19,31,23,27,32};
Physical Volume(2)={1};

// fim da base
// inicio das alças

Point(15) = {-0.144,0.0225,0.024,lc};
Point(16) = {-0.136,0.0225,0.024,lc};
Point(17) = {-0.136,0.0225,0.016,lc};
Point(18) = {-0.144,0.0225,0.016,lc};
Point(19) = {-0.144,0.0225,-0.016,lc};
Point(20) = {-0.136,0.0225,-0.016,lc};
Point(21) = {-0.136,0.0225,-0.024,lc};
Point(22) = {-0.144,0.0225,-0.024,lc};
Line(34) = {15,16};
Line(35) = {16,17};
Line(36) = {17,18};
Line(37) = {18,15};
Line(38) = {19,20};
Line(39) = {20,21};
Line(40) = {21,22};
Line(41) = {22,19};

Line Loop(42) = {34,35,36,37};
Plane Surface(43) = {42};
Line Loop(44) = {38,39,40,41};
Plane Surface(45) = {44};
Extrude Surface {43, {0.0,0.005,0}};
Extrude Surface {45, {0.0,0.005,0}};

// a face eh gerada a partir do interior da base

Line Loop(90) = {47,48,49,50};
Line Loop(91) = {69,70,71,72};
 
Transfinite Line {34,35,36,37,52,53,57,61,47,48,49,50} = 3 Using Progression 1.0;
Transfinite Line {38,39,40,41,74,75,79,83,69,70,71,72} = 3 Using Progression 1.0;

Transfinite Surface{67} = {23,32,28,24};
Transfinite Surface{43} = {15,18,17,16};
Transfinite Surface{54} = {16,15,23,24};
Transfinite Surface{58} = {16,17,28,24};
Transfinite Surface{62} = {18,17,28,32};
Transfinite Surface{66} = {15,18,32,23};

Transfinite Volume{2} = {15,16,17,18,23,24,28,32};
Recombine Surface {43,54,58,62,66,67};
Physical Surface(92) = {43,54,58,62,66,67};
Physical Volume(3)=2;

Transfinite Surface{45} = {19,20,21,22};
Transfinite Surface{80} = {21,20,34,38};
Transfinite Surface{76} = {20,19,33,34};
Transfinite Surface{84} = {22,21,38,42};
Transfinite Surface{88} = {19,22,42,33};
Transfinite Surface{89} = {33,34,38,42};

Transfinite Volume{3} = {19,20,21,22,33,34,38,42};
Recombine Surface {45,80,76,84,88,89};
Physical Volume(4)=3;

// fim da parte engastada
// inicio da alça livre
// primeiro trecho reto

Delete{Volume{1};Surface{27};}

Extrude Surface {67, {0.0,0.060,0.0}};
Extrude Surface {89, {0.0,0.060,0.0}};

Transfinite Line {99,100,104,108,94,95,96,97} = 3 Using Progression 1.0;
Transfinite Line {121,122,126,130,116,117,118,119} = 3 Using Progression 1.0;

Transfinite Surface{101} = {23,24,44,43};
Transfinite Surface{105} = {24,28,48,44};
Transfinite Surface{109} = {28,32,52,48};
Transfinite Surface{113} = {32,23,43,52};
Transfinite Surface{114} = {44,48,52,43};

Transfinite Surface{123} = {33,34,54,53};
Transfinite Surface{127} = {34,38,58,54};
Transfinite Surface{131} = {38,42,62,58};
Transfinite Surface{135} = {42,33,53,62};
Transfinite Surface{136} = {54,58,62,63}

Transfinite Volume{4} = {23,24,28,32,43,44,48,52};
Transfinite Volume{5} = {33,34,38,42,53,54,58,62};

Recombine Surface {101,105,109,113,114};
Recombine Surface {123,127,131,135,136};
Physical Volume(5)=4;
Physical Volume(6)=5;
