//t1.geo, modified :-)
lc = 1e-1;
Point(1) = {0, 0, 0, lc};
Point(2) = {2, 0, 0, lc} ;
Point(3) = {2, 3, 0, lc} ;
Point(4) = {0, 3, 0, lc} ;

Point(5)={0,0,0.5, lc};
Point(6)={2,0,0.5, lc};
Point(7)={2,3,0.5, lc};
Point(8)={0,3,0.5, lc};

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

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

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

Geometry.PointNumbers=1;

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

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

Plane Surface(1) = {1} ;
Plane Surface(2)={2};

Plane Surface(3)={3};
Plane Surface(4)={4};
Plane Surface(5)={5};
Plane Surface(6)={6};

Surface Loop(1)={1,2,3,4,5,6};

Volume(1)={1};

Mesh 2 ;                                     // Mesh the surface of the object
Plugin(NewView).View = 0 ;                   // ID of the view = 0
Plugin(NewView).Dimension = 1 ;              // Dimension of the view = 1 (scalar values)
Plugin(NewView).Run ;                        // Create view 0, it has values on surface elements
Plugin(ModifyComponents).View = 0 ;          // Select view 0 for modification
Plugin(ModifyComponents).Expression0 = "1" ; // Set the value "1" for each surface element 
Plugin(ModifyComponents).Run ;               // Apply the new value
Plugin(Integrate).View = 0 ;                 // Select view 0
Plugin(Integrate).Dimension = 2 ;            // Ask to integrate on surface elements
Plugin(Integrate).Run ;                      // Run the integration (it generates a new view with ID = 1)
Printf("Area = %g", View[1].Max) ;           // Print out the area

Mesh 3 ;                                     // Mesh the volume of the object
Plugin(NewView).View = 2 ;                   // ID of new view = 2
Plugin(NewView).Dimension = 1 ;              // Dimension of new view still 1 (scalar field)
Plugin(NewView).Run ;                        // Create view 2, this one has values on volume elements
Plugin(ModifyComponents).View = 2 ;          // Select view 2 for modification
Plugin(ModifyComponents).Expression0 = "1" ; // Set the value "1" to all value elements
Plugin(ModifyComponents).Run ;               // Apply the new value
Plugin(Integrate).View = 2 ;                 // Select view 2
Plugin(Integrate).Dimension = 3 ;            // Set up a volume integration
Plugin(Integrate).Run ;                      // Run the integration (generating view 3)
Printf("Volume = %g", View[3].Max) ;         // Print out the volume
