SetFactory("OpenCASCADE");

// Points.
Point (1) = { 0, 0, 0 };
Point (2) = { 0, 1, 0 };
Point (3) = { 1, 1, 0 };
Point (4) = { 1, 0, 0 };
Point (5) = { 1, 0, 1 };
Point (6) = { 0, 0, 1 };
Point (7) = { 1, 1, 1 };
Point (8) = { 0, 1, 1 };
Point (9) = { 0.5, 0.5, 0.5 };
Point (10) = { 0.5, 1.5, 0.5 };
Point (11) = { 1.5, 1.5, 0.5 };
Point (12) = { 1.5, 0.5, 0.5 };
Point (13) = { 1.5, 0.5, 1.5 };
Point (14) = { 0.5, 0.5, 1.5 };
Point (15) = { 1.5, 1.5, 1.5 };
Point (16) = { 0.5, 1.5, 1.5 };


// Lines.
Line (1) = { 1, 2 };
Line (2) = { 1, 3 };
Line (3) = { 1, 4 };
Line (4) = { 1, 5 };
Line (5) = { 4, 3 };
Line (6) = { 4, 7 };
Line (7) = { 3, 2 };
Line (8) = { 3, 8 };
Line (9) = { 2, 6 };
Line (10) = { 6, 5 };
Line (11) = { 6, 7 };
Line (12) = { 4, 5 };
Line (13) = { 3, 7 };
Line (14) = { 7, 5 };
Line (15) = { 2, 8 };
Line (16) = { 8, 7 };
Line (17) = { 1, 6 };
Line (18) = { 6, 8 };
Line (19) = { 9, 10 };
Line (20) = { 9, 11 };
Line (21) = { 9, 12 };
Line (22) = { 9, 13 };
Line (23) = { 12, 11 };
Line (24) = { 12, 15 };
Line (25) = { 11, 10 };
Line (26) = { 11, 16 };
Line (27) = { 10, 14 };
Line (28) = { 14, 13 };
Line (29) = { 14, 15 };
Line (30) = { 12, 13 };
Line (31) = { 11, 15 };
Line (32) = { 15, 13 };
Line (33) = { 10, 16 };
Line (34) = { 16, 15 };
Line (35) = { 9, 14 };
Line (36) = { 14, 16 };

Physical Curve (1) = { 1 };
Physical Curve (2) = { 3 };
Physical Curve (3) = { 17 };
Physical Curve (4) = { 7 };
Physical Curve (5) = { 15 };
Physical Curve (6) = { 5 };
Physical Curve (7) = { 13 };
Physical Curve (8) = { 12 };
Physical Curve (9) = { 10 };
Physical Curve (10) = { 14 };
Physical Curve (11) = { 18 };
Physical Curve (12) = { 16 };
Physical Curve (13) = { 19 };
Physical Curve (14) = { 21 };
Physical Curve (15) = { 35 };
Physical Curve (16) = { 25 };
Physical Curve (17) = { 33 };
Physical Curve (18) = { 23 };
Physical Curve (19) = { 31 };
Physical Curve (20) = { 30 };
Physical Curve (21) = { 28 };
Physical Curve (22) = { 32 };
Physical Curve (23) = { 36 };
Physical Curve (24) = { 34 };


// Line Loops.
Curve Loop (1) = { 1, -7, -2 };
Curve Loop (2) = { 2, -5, -3 };
Curve Loop (3) = { 3, 12, -4 };
Curve Loop (4) = { 4, -10, -17 };
Curve Loop (5) = { 5, 13, -6 };
Curve Loop (6) = { 6, 14, -12 };
Curve Loop (7) = { 7, 15, -8 };
Curve Loop (8) = { 8, 16, -13 };
Curve Loop (9) = { -1, 17, -9 };
Curve Loop (10) = { 9, 18, -15 };
Curve Loop (11) = { 10, -14, -11 };
Curve Loop (12) = { 11, -16, -18 };
Curve Loop (13) = { 19, -25, -20 };
Curve Loop (14) = { 20, -23, -21 };
Curve Loop (15) = { 21, 30, -22 };
Curve Loop (16) = { 22, -28, -35 };
Curve Loop (17) = { 23, 31, -24 };
Curve Loop (18) = { 24, 32, -30 };
Curve Loop (19) = { 25, 33, -26 };
Curve Loop (20) = { 26, 34, -31 };
Curve Loop (21) = { -19, 35, -27 };
Curve Loop (22) = { 27, 36, -33 };
Curve Loop (23) = { 28, -32, -29 };
Curve Loop (24) = { 29, -34, -36 };


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

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


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

Volume          (1) = { 1 };
Physical Volume (1) = { 1 };
Volume          (2) = { 2 };
Physical Volume (2) = { 2 };


// Geometry operations.
BooleanIntersection { Volume{1}; Delete; }{ Volume{2}; Delete; }
