lc = 0.2; 
x1 = 0; 
y1 = 0;
x2 = 4;
y2 = 4;
x3 = 1;
y3 = 1;
x4 = 3; 
y4 = 3;

Point(1) = {x1, y1, 0, lc};
Point(2) = {x1, y2, 0, lc};
Point(3) = {x2, y2, 0, lc};
Point(4) = {x2, y1, 0, lc};
Point(5) = {x3, y3, 0, lc};
Point(6) = {x3, y4, 0, lc};
Point(7) = {x4, y4, 0, lc};
Point(8) = {x4, y3, 0, lc};

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

Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 5};
Line Loop(2) = {5, 6, 7, 8};

Plane Surface(1) = {1}; // Big one
Plane Surface(2) = {2}; // small one

// extrusion of inner box
middle[] = Extrude {0,0,2} {
  Surface{2};
};

// shift the middle box to the middle of the bog cube
Translate{0, 0, 1} {Volume{middle[1]};}

// extrusion of outer box
outer[] = Extrude {0,0,4} {
  Surface{1};
};

Compound Surface(101) = {outer[1], -middle[1]};

Coherence;

