//Geometria

lc=8 ;
l=500;
a=80;
b=50;

Point(1)= {-l/2, b/2, a/2, lc};
Point(2)= {-l/2, -b/2, a/2, lc};
Point(3)= {-l/2, -b/2, -a/2, lc};
Point(4)= {-l/2, b/2, -a/2, lc};


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

Line Loop(1)={1,2,3,4};
Plane Surface(1)={1};

v[] = Extrude Surface {1, {500,0,0}};;
// you need to remove the volume in order to delete the surface
Delete{Volume{v[1]}; Surface{25};}

r5 = 5.21;
x1 = (-l/2)+70;
x2 = (b/2)-5;
x3 = 20;
lc = 2;

Point(7) = {x1, x2, x3, 9e-1* lc} ;
Point(8) = {x1+r5*Cos(0), x2, x3+r5*Sin(0), 9e-1* lc};
Point(9) = {x1+r5*Cos(Pi/2), x2, x3+r5*Sin(Pi/2), 9e-1* lc} ;
Point(11) = {x1+r5*Cos(Pi), x2, x3+r5*Sin(Pi), 9e-1* lc} ;
Point(12) = {x1+r5*Cos(3*Pi/2), x2, x3+r5*Sin(3*Pi/2), 9e-1* lc} ;

c1 = newreg; Circle(c1) = {8,7,9};
c2 = newreg; Circle(c2) = {9,7,11};
c3 = newreg; Circle(c3) = {11,7,12};
c4 = newreg; Circle(c4) = {12,7,8};

Line Loop(2) = {c1,c2,c3,c4};   
Plane Surface(2) = {2};

// this already defines the small volume. It is NOT a hole, since
// there is a common surface with the exterior surface loop.
Extrude Surface{2,{0,5,0}};

// define the missing surface
Line Loop(53) = {20,9,-11,-4};
Line Loop(54) = {35,32,33,34};
Plane Surface(55) = {53,54};

// define the second volume
Surface Loop(56) = {1,-13,-17,-21,55,-26,-47,2,-39,-43,-51};
Volume(57) = {56};
