diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 2c4df066e2a2607a92dff57058c6f37a0d84b070..455d4c332c64ed30aea7081e02035faf52010315 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -232,13 +232,12 @@ static void SetProjectName(const char *name)
 
 int MergeFile(const char *name, int warn_if_missing)
 {
-  GModel *model = GModel::current();
-  if(!model){
+  if(!GModel::current()){
     Msg::Error("No models exists in which to merge data");
     return 0;
   }
 
-  if(model->getName() == "")
+  if(GModel::current()->getName() == "")
     SetProjectName(name);
 
   // added 'b' for pure Windows programs, since some of these files
@@ -285,33 +284,33 @@ int MergeFile(const char *name, int warn_if_missing)
 
   int status = 0;
   if(!strcmp(ext, ".stl") || !strcmp(ext, ".STL")){
-    status = model->readSTL(name, CTX.geom.tolerance);
+    status = GModel::current()->readSTL(name, CTX.geom.tolerance);
   }
   else if(!strcmp(ext, ".brep") || !strcmp(ext, ".rle") ||
           !strcmp(ext, ".brp") || !strcmp(ext, ".BRP")){
-    status = model->readOCCBREP(std::string(name));
+    status = GModel::current()->readOCCBREP(std::string(name));
   }
   else if(!strcmp(ext, ".iges") || !strcmp(ext, ".IGES") ||
           !strcmp(ext, ".igs") || !strcmp(ext, ".IGS")){
-    status = model->readOCCIGES(std::string(name));
+    status = GModel::current()->readOCCIGES(std::string(name));
   }
   else if(!strcmp(ext, ".step") || !strcmp(ext, ".STEP") ||
           !strcmp(ext, ".stp") || !strcmp(ext, ".STP")){
-    status = model->readOCCSTEP(std::string(name));
+    status = GModel::current()->readOCCSTEP(std::string(name));
   }
   else if(!strcmp(ext, ".unv") || !strcmp(ext, ".UNV")){
-    status = model->readUNV(name);
+    status = GModel::current()->readUNV(name);
   }
   else if(!strcmp(ext, ".vtk") || !strcmp(ext, ".VTK")){
-    status = model->readVTK(name, CTX.big_endian);
+    status = GModel::current()->readVTK(name, CTX.big_endian);
   }
   else if(!strcmp(ext, ".wrl") || !strcmp(ext, ".WRL") || 
           !strcmp(ext, ".vrml") || !strcmp(ext, ".VRML") ||
           !strcmp(ext, ".iv") || !strcmp(ext, ".IV")){
-    status = model->readVRML(name);
+    status = GModel::current()->readVRML(name);
   }
   else if(!strcmp(ext, ".mesh") || !strcmp(ext, ".MESH")){
-    status = model->readMESH(name);
+    status = GModel::current()->readMESH(name);
   }
   else if(!strcmp(ext, ".med") || !strcmp(ext, ".MED") ||
 	  !strcmp(ext, ".mmed") || !strcmp(ext, ".MMED") ||
@@ -323,13 +322,13 @@ int MergeFile(const char *name, int warn_if_missing)
   }
   else if(!strcmp(ext, ".bdf") || !strcmp(ext, ".BDF") ||
           !strcmp(ext, ".nas") || !strcmp(ext, ".NAS")){
-    status = model->readBDF(name);
+    status = GModel::current()->readBDF(name);
   }
   else if(!strcmp(ext, ".p3d") || !strcmp(ext, ".P3D")){
-    status = model->readP3D(name);
+    status = GModel::current()->readP3D(name);
   }
   else if(!strcmp(ext, ".fm") || !strcmp(ext, ".FM")) {
-    status = model->readFourier(name);
+    status = GModel::current()->readFourier(name);
   }
 #if defined(HAVE_FLTK)
   else if(!strcmp(ext, ".pnm") || !strcmp(ext, ".PNM") ||
@@ -358,7 +357,7 @@ int MergeFile(const char *name, int warn_if_missing)
     if(!strncmp(header, "$PTS", 4) || !strncmp(header, "$NO", 3) || 
        !strncmp(header, "$PARA", 5) || !strncmp(header, "$ELM", 4) ||
        !strncmp(header, "$MeshFormat", 11) || !strncmp(header, "$Comments", 9)) {
-      status = model->readMSH(name);
+      status = GModel::current()->readMSH(name);
 #if !defined(HAVE_NO_POST)
       if(status > 1) status = PView::readMSH(name);
 #endif
@@ -370,7 +369,7 @@ int MergeFile(const char *name, int warn_if_missing)
     }
 #endif
     else {
-      status = model->readGEO(name);
+      status = GModel::current()->readGEO(name);
     }
   }
 
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index 6b0287f411dd9b4bf46a81eeee5103e03c8c5776..0a917e7b03bbb7cc705236af2b435bcbee52ea68 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -980,29 +980,29 @@ static const yytype_uint16 yyrline[] =
     1205,  1223,  1241,  1267,  1284,  1303,  1321,  1360,  1366,  1372,
     1379,  1404,  1429,  1445,  1461,  1492,  1510,  1527,  1548,  1553,
     1558,  1563,  1568,  1588,  1594,  1605,  1606,  1611,  1614,  1618,
-    1641,  1664,  1687,  1715,  1724,  1728,  1743,  1764,  1781,  1795,
-    1801,  1807,  1816,  1830,  1878,  1896,  1911,  1930,  1942,  1966,
-    1970,  1975,  1980,  1992,  2009,  2026,  2045,  2064,  2092,  2100,
-    2106,  2113,  2117,  2126,  2134,  2142,  2151,  2150,  2163,  2162,
-    2175,  2174,  2187,  2186,  2199,  2206,  2213,  2220,  2227,  2234,
-    2241,  2248,  2255,  2263,  2262,  2274,  2273,  2285,  2284,  2296,
-    2295,  2307,  2306,  2318,  2317,  2329,  2328,  2340,  2339,  2351,
-    2350,  2365,  2368,  2374,  2383,  2403,  2426,  2430,  2454,  2457,
-    2473,  2476,  2489,  2492,  2498,  2501,  2508,  2562,  2632,  2637,
-    2704,  2747,  2773,  2796,  2819,  2822,  2831,  2835,  2851,  2852,
-    2853,  2854,  2855,  2856,  2857,  2858,  2859,  2866,  2867,  2868,
-    2869,  2870,  2871,  2872,  2873,  2874,  2875,  2876,  2877,  2878,
-    2879,  2880,  2881,  2882,  2883,  2884,  2885,  2886,  2887,  2888,
-    2889,  2890,  2891,  2892,  2893,  2894,  2895,  2896,  2897,  2899,
-    2900,  2901,  2902,  2903,  2904,  2905,  2906,  2907,  2908,  2909,
-    2910,  2911,  2912,  2913,  2914,  2915,  2916,  2917,  2918,  2919,
-    2928,  2929,  2930,  2931,  2932,  2933,  2934,  2938,  2951,  2963,
-    2978,  2988,  2998,  3016,  3021,  3026,  3036,  3046,  3054,  3058,
-    3062,  3066,  3070,  3077,  3081,  3085,  3089,  3096,  3101,  3108,
-    3113,  3117,  3122,  3126,  3134,  3145,  3149,  3161,  3169,  3177,
-    3184,  3195,  3215,  3225,  3235,  3245,  3265,  3270,  3274,  3278,
-    3290,  3294,  3306,  3313,  3323,  3327,  3342,  3347,  3354,  3358,
-    3371,  3379,  3390,  3394,  3402,  3410,  3424,  3438,  3442
+    1641,  1664,  1687,  1715,  1724,  1728,  1743,  1770,  1787,  1801,
+    1807,  1813,  1822,  1836,  1884,  1902,  1917,  1936,  1948,  1972,
+    1976,  1981,  1986,  1998,  2015,  2032,  2051,  2070,  2098,  2106,
+    2112,  2119,  2123,  2132,  2140,  2148,  2157,  2156,  2169,  2168,
+    2181,  2180,  2193,  2192,  2205,  2212,  2219,  2226,  2233,  2240,
+    2247,  2254,  2261,  2269,  2268,  2280,  2279,  2291,  2290,  2302,
+    2301,  2313,  2312,  2324,  2323,  2335,  2334,  2346,  2345,  2357,
+    2356,  2371,  2374,  2380,  2389,  2409,  2432,  2436,  2460,  2463,
+    2479,  2482,  2495,  2498,  2504,  2507,  2514,  2568,  2638,  2643,
+    2710,  2753,  2779,  2802,  2825,  2828,  2837,  2841,  2857,  2858,
+    2859,  2860,  2861,  2862,  2863,  2864,  2865,  2872,  2873,  2874,
+    2875,  2876,  2877,  2878,  2879,  2880,  2881,  2882,  2883,  2884,
+    2885,  2886,  2887,  2888,  2889,  2890,  2891,  2892,  2893,  2894,
+    2895,  2896,  2897,  2898,  2899,  2900,  2901,  2902,  2903,  2905,
+    2906,  2907,  2908,  2909,  2910,  2911,  2912,  2913,  2914,  2915,
+    2916,  2917,  2918,  2919,  2920,  2921,  2922,  2923,  2924,  2925,
+    2934,  2935,  2936,  2937,  2938,  2939,  2940,  2944,  2957,  2969,
+    2984,  2994,  3004,  3022,  3027,  3032,  3042,  3052,  3060,  3064,
+    3068,  3072,  3076,  3083,  3087,  3091,  3095,  3102,  3107,  3114,
+    3119,  3123,  3128,  3132,  3140,  3151,  3155,  3167,  3175,  3183,
+    3190,  3201,  3221,  3231,  3241,  3251,  3271,  3276,  3280,  3284,
+    3296,  3300,  3312,  3319,  3329,  3333,  3348,  3353,  3360,  3364,
+    3377,  3385,  3396,  3400,  3408,  3416,  3430,  3444,  3448
 };
 #endif
 
@@ -5512,7 +5512,13 @@ yyreduce:
   case 136:
 #line 1744 "Gmsh.y"
     {
-      if(!strcmp((yyvsp[(2) - (3)].c), "Model") || !strcmp((yyvsp[(2) - (3)].c), "Meshes") || !strcmp((yyvsp[(2) - (3)].c), "All")){
+      if(!strcmp((yyvsp[(2) - (3)].c), "Meshes") || !strcmp((yyvsp[(2) - (3)].c), "All")){
+        for(unsigned int i = 0; i < GModel::list.size(); i++){
+          GModel::list[i]->destroy();
+          GModel::list[i]->getGEOInternals()->destroy();
+        }
+      }
+      else if(!strcmp((yyvsp[(2) - (3)].c), "Model")){
 	GModel::current()->destroy();
 	GModel::current()->getGEOInternals()->destroy();
       }
@@ -5534,7 +5540,7 @@ yyreduce:
     break;
 
   case 137:
-#line 1765 "Gmsh.y"
+#line 1771 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (4)].c), "Empty") && !strcmp((yyvsp[(3) - (4)].c), "Views")){
@@ -5549,7 +5555,7 @@ yyreduce:
     break;
 
   case 138:
-#line 1782 "Gmsh.y"
+#line 1788 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(4) - (5)].l)); i++){
 	Shape TheShape;
@@ -5561,7 +5567,7 @@ yyreduce:
     break;
 
   case 139:
-#line 1796 "Gmsh.y"
+#line 1802 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++)
 	VisibilityShape((yyvsp[(2) - (3)].c), i, 1);
@@ -5570,7 +5576,7 @@ yyreduce:
     break;
 
   case 140:
-#line 1802 "Gmsh.y"
+#line 1808 "Gmsh.y"
     {
       for(int i = 0; i < 4; i++)
 	VisibilityShape((yyvsp[(2) - (3)].c), i, 0);
@@ -5579,7 +5585,7 @@ yyreduce:
     break;
 
   case 141:
-#line 1808 "Gmsh.y"
+#line 1814 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -5591,7 +5597,7 @@ yyreduce:
     break;
 
   case 142:
-#line 1817 "Gmsh.y"
+#line 1823 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (4)].l)); i++){
 	Shape TheShape;
@@ -5603,7 +5609,7 @@ yyreduce:
     break;
 
   case 143:
-#line 1831 "Gmsh.y"
+#line 1837 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (3)].c), "Include")){
 	char tmpstring[1024];
@@ -5654,7 +5660,7 @@ yyreduce:
     break;
 
   case 144:
-#line 1879 "Gmsh.y"
+#line 1885 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (7)].c), "Save") && !strcmp((yyvsp[(2) - (7)].c), "View")){
@@ -5675,7 +5681,7 @@ yyreduce:
     break;
 
   case 145:
-#line 1897 "Gmsh.y"
+#line 1903 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(1) - (7)].c), "Background") && !strcmp((yyvsp[(2) - (7)].c), "Mesh")  && !strcmp((yyvsp[(3) - (7)].c), "View")){
@@ -5693,7 +5699,7 @@ yyreduce:
     break;
 
   case 146:
-#line 1912 "Gmsh.y"
+#line 1918 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (3)].c), "Sleep")){
 	SleepInSeconds((yyvsp[(2) - (3)].d));
@@ -5715,7 +5721,7 @@ yyreduce:
     break;
 
   case 147:
-#line 1931 "Gmsh.y"
+#line 1937 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
        try {
@@ -5730,7 +5736,7 @@ yyreduce:
     break;
 
   case 148:
-#line 1943 "Gmsh.y"
+#line 1949 "Gmsh.y"
     {
 #if !defined(HAVE_NO_POST)
       if(!strcmp((yyvsp[(2) - (3)].c), "ElementsFromAllViews"))
@@ -5757,14 +5763,14 @@ yyreduce:
     break;
 
   case 149:
-#line 1967 "Gmsh.y"
+#line 1973 "Gmsh.y"
     {
       exit(0);
     ;}
     break;
 
   case 150:
-#line 1971 "Gmsh.y"
+#line 1977 "Gmsh.y"
     {
       CTX.forced_bbox = 0;
       SetBoundingBox();
@@ -5772,7 +5778,7 @@ yyreduce:
     break;
 
   case 151:
-#line 1976 "Gmsh.y"
+#line 1982 "Gmsh.y"
     {
       CTX.forced_bbox = 1;
       SetBoundingBox((yyvsp[(3) - (15)].d), (yyvsp[(5) - (15)].d), (yyvsp[(7) - (15)].d), (yyvsp[(9) - (15)].d), (yyvsp[(11) - (15)].d), (yyvsp[(13) - (15)].d));
@@ -5780,7 +5786,7 @@ yyreduce:
     break;
 
   case 152:
-#line 1981 "Gmsh.y"
+#line 1987 "Gmsh.y"
     {
 #if defined(HAVE_FLTK)
       Draw();
@@ -5789,7 +5795,7 @@ yyreduce:
     break;
 
   case 153:
-#line 1993 "Gmsh.y"
+#line 1999 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (6)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (6)].d);
@@ -5809,7 +5815,7 @@ yyreduce:
     break;
 
   case 154:
-#line 2010 "Gmsh.y"
+#line 2016 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(3) - (8)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(5) - (8)].d);
@@ -5829,7 +5835,7 @@ yyreduce:
     break;
 
   case 155:
-#line 2027 "Gmsh.y"
+#line 2033 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (8)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (8)].d);
@@ -5851,7 +5857,7 @@ yyreduce:
     break;
 
   case 156:
-#line 2046 "Gmsh.y"
+#line 2052 "Gmsh.y"
     {
       LoopControlVariablesTab[ImbricatedLoop][0] = (yyvsp[(5) - (10)].d);
       LoopControlVariablesTab[ImbricatedLoop][1] = (yyvsp[(7) - (10)].d);
@@ -5873,7 +5879,7 @@ yyreduce:
     break;
 
   case 157:
-#line 2065 "Gmsh.y"
+#line 2071 "Gmsh.y"
     {
       if(ImbricatedLoop <= 0){
 	yymsg(0, "Invalid For/EndFor loop");
@@ -5904,7 +5910,7 @@ yyreduce:
     break;
 
   case 158:
-#line 2093 "Gmsh.y"
+#line 2099 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->createFunction((yyvsp[(2) - (2)].c), gmsh_yyin, gmsh_yyname,
 						      gmsh_yylineno))
@@ -5915,7 +5921,7 @@ yyreduce:
     break;
 
   case 159:
-#line 2101 "Gmsh.y"
+#line 2107 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->leaveFunction(&gmsh_yyin, gmsh_yyname,
 						     gmsh_yylineno))
@@ -5924,7 +5930,7 @@ yyreduce:
     break;
 
   case 160:
-#line 2107 "Gmsh.y"
+#line 2113 "Gmsh.y"
     {
       if(!FunctionManager::Instance()->enterFunction((yyvsp[(2) - (3)].c), &gmsh_yyin, gmsh_yyname,
 						     gmsh_yylineno))
@@ -5934,20 +5940,20 @@ yyreduce:
     break;
 
   case 161:
-#line 2114 "Gmsh.y"
+#line 2120 "Gmsh.y"
     {
       if(!(yyvsp[(3) - (4)].d)) skip_until("If", "EndIf");
     ;}
     break;
 
   case 162:
-#line 2118 "Gmsh.y"
+#line 2124 "Gmsh.y"
     {
     ;}
     break;
 
   case 163:
-#line 2127 "Gmsh.y"
+#line 2133 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (5)].l), 
@@ -5958,7 +5964,7 @@ yyreduce:
     break;
 
   case 164:
-#line 2135 "Gmsh.y"
+#line 2141 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(ROTATE, (yyvsp[(10) - (11)].l), 
@@ -5969,7 +5975,7 @@ yyreduce:
     break;
 
   case 165:
-#line 2143 "Gmsh.y"
+#line 2149 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (13)].l), 
@@ -5980,14 +5986,14 @@ yyreduce:
     break;
 
   case 166:
-#line 2151 "Gmsh.y"
+#line 2157 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 167:
-#line 2155 "Gmsh.y"
+#line 2161 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE, (yyvsp[(4) - (7)].l), 
@@ -5998,14 +6004,14 @@ yyreduce:
     break;
 
   case 168:
-#line 2163 "Gmsh.y"
+#line 2169 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 169:
-#line 2167 "Gmsh.y"
+#line 2173 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(ROTATE, (yyvsp[(10) - (13)].l), 
@@ -6016,14 +6022,14 @@ yyreduce:
     break;
 
   case 170:
-#line 2175 "Gmsh.y"
+#line 2181 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 171:
-#line 2179 "Gmsh.y"
+#line 2185 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(TRANSLATE_ROTATE, (yyvsp[(12) - (15)].l), 
@@ -6034,14 +6040,14 @@ yyreduce:
     break;
 
   case 172:
-#line 2187 "Gmsh.y"
+#line 2193 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 173:
-#line 2191 "Gmsh.y"
+#line 2197 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShapes(BOUNDARY_LAYER, (yyvsp[(3) - (6)].l), 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
@@ -6051,7 +6057,7 @@ yyreduce:
     break;
 
   case 174:
-#line 2200 "Gmsh.y"
+#line 2206 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (8)].d), 
@@ -6061,7 +6067,7 @@ yyreduce:
     break;
 
   case 175:
-#line 2207 "Gmsh.y"
+#line 2213 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (8)].d), 
@@ -6071,7 +6077,7 @@ yyreduce:
     break;
 
   case 176:
-#line 2214 "Gmsh.y"
+#line 2220 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (8)].d), 
@@ -6081,7 +6087,7 @@ yyreduce:
     break;
 
   case 177:
-#line 2221 "Gmsh.y"
+#line 2227 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), 
@@ -6091,7 +6097,7 @@ yyreduce:
     break;
 
   case 178:
-#line 2228 "Gmsh.y"
+#line 2234 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), 
@@ -6101,7 +6107,7 @@ yyreduce:
     break;
 
   case 179:
-#line 2235 "Gmsh.y"
+#line 2241 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), 
@@ -6111,7 +6117,7 @@ yyreduce:
     break;
 
   case 180:
-#line 2242 "Gmsh.y"
+#line 2248 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (14)].d), 
@@ -6121,7 +6127,7 @@ yyreduce:
     break;
 
   case 181:
-#line 2249 "Gmsh.y"
+#line 2255 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (14)].d), 
@@ -6131,7 +6137,7 @@ yyreduce:
     break;
 
   case 182:
-#line 2256 "Gmsh.y"
+#line 2262 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (14)].d), 
@@ -6141,14 +6147,14 @@ yyreduce:
     break;
 
   case 183:
-#line 2263 "Gmsh.y"
+#line 2269 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 184:
-#line 2267 "Gmsh.y"
+#line 2273 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_POINT, (int)(yyvsp[(4) - (12)].d), 
@@ -6158,14 +6164,14 @@ yyreduce:
     break;
 
   case 185:
-#line 2274 "Gmsh.y"
+#line 2280 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 186:
-#line 2278 "Gmsh.y"
+#line 2284 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (12)].d), 
@@ -6175,14 +6181,14 @@ yyreduce:
     break;
 
   case 187:
-#line 2285 "Gmsh.y"
+#line 2291 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 188:
-#line 2289 "Gmsh.y"
+#line 2295 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (12)].d), 
@@ -6192,14 +6198,14 @@ yyreduce:
     break;
 
   case 189:
-#line 2296 "Gmsh.y"
+#line 2302 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 190:
-#line 2300 "Gmsh.y"
+#line 2306 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_POINT, (int)(yyvsp[(4) - (16)].d), 
@@ -6209,14 +6215,14 @@ yyreduce:
     break;
 
   case 191:
-#line 2307 "Gmsh.y"
+#line 2313 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 192:
-#line 2311 "Gmsh.y"
+#line 2317 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (16)].d), 
@@ -6226,14 +6232,14 @@ yyreduce:
     break;
 
   case 193:
-#line 2318 "Gmsh.y"
+#line 2324 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 194:
-#line 2322 "Gmsh.y"
+#line 2328 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (16)].d), 
@@ -6243,14 +6249,14 @@ yyreduce:
     break;
 
   case 195:
-#line 2329 "Gmsh.y"
+#line 2335 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 196:
-#line 2333 "Gmsh.y"
+#line 2339 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_POINT, (int)(yyvsp[(4) - (18)].d), 
@@ -6260,14 +6266,14 @@ yyreduce:
     break;
 
   case 197:
-#line 2340 "Gmsh.y"
+#line 2346 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 198:
-#line 2344 "Gmsh.y"
+#line 2350 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SEGM_LINE, (int)(yyvsp[(4) - (18)].d), 
@@ -6277,14 +6283,14 @@ yyreduce:
     break;
 
   case 199:
-#line 2351 "Gmsh.y"
+#line 2357 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = extr.mesh.Recombine = false;
     ;}
     break;
 
   case 200:
-#line 2355 "Gmsh.y"
+#line 2361 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(Shape));
       ExtrudeShape(TRANSLATE_ROTATE, MSH_SURF_PLAN, (int)(yyvsp[(4) - (18)].d), 
@@ -6294,19 +6300,19 @@ yyreduce:
     break;
 
   case 201:
-#line 2366 "Gmsh.y"
+#line 2372 "Gmsh.y"
     {
     ;}
     break;
 
   case 202:
-#line 2369 "Gmsh.y"
+#line 2375 "Gmsh.y"
     {
     ;}
     break;
 
   case 203:
-#line 2375 "Gmsh.y"
+#line 2381 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = true;
       extr.mesh.NbLayer = 1;
@@ -6318,7 +6324,7 @@ yyreduce:
     break;
 
   case 204:
-#line 2384 "Gmsh.y"
+#line 2390 "Gmsh.y"
     {
       extr.mesh.ExtrudeMesh = true;
       extr.mesh.NbLayer = List_Nbr((yyvsp[(3) - (7)].l));
@@ -6341,7 +6347,7 @@ yyreduce:
     break;
 
   case 205:
-#line 2404 "Gmsh.y"
+#line 2410 "Gmsh.y"
     {
       yymsg(0, "Explicit region numbers in layers are deprecated");
       extr.mesh.ExtrudeMesh = true;
@@ -6367,14 +6373,14 @@ yyreduce:
     break;
 
   case 206:
-#line 2427 "Gmsh.y"
+#line 2433 "Gmsh.y"
     {
       extr.mesh.Recombine = true;
     ;}
     break;
 
   case 207:
-#line 2431 "Gmsh.y"
+#line 2437 "Gmsh.y"
     {
       int num = (int)(yyvsp[(3) - (9)].d);
       if(FindSurface(num)){
@@ -6396,14 +6402,14 @@ yyreduce:
     break;
 
   case 208:
-#line 2454 "Gmsh.y"
+#line 2460 "Gmsh.y"
     {
       (yyval.v)[0] = (yyval.v)[1] = 1.;
     ;}
     break;
 
   case 209:
-#line 2458 "Gmsh.y"
+#line 2464 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(2) - (3)].c), "Progression") || !strcmp((yyvsp[(2) - (3)].c), "Power"))
         (yyval.v)[0] = 1.;
@@ -6419,14 +6425,14 @@ yyreduce:
     break;
 
   case 210:
-#line 2473 "Gmsh.y"
+#line 2479 "Gmsh.y"
     {
       (yyval.i) = -1; // left
     ;}
     break;
 
   case 211:
-#line 2477 "Gmsh.y"
+#line 2483 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (1)].c), "Right"))
         (yyval.i) = 1;
@@ -6439,35 +6445,35 @@ yyreduce:
     break;
 
   case 212:
-#line 2489 "Gmsh.y"
+#line 2495 "Gmsh.y"
     {
      (yyval.l) = List_Create(1, 1, sizeof(double));
    ;}
     break;
 
   case 213:
-#line 2493 "Gmsh.y"
+#line 2499 "Gmsh.y"
     {
      (yyval.l) = (yyvsp[(2) - (2)].l);
    ;}
     break;
 
   case 214:
-#line 2498 "Gmsh.y"
+#line 2504 "Gmsh.y"
     {
       (yyval.i) = 45;
     ;}
     break;
 
   case 215:
-#line 2502 "Gmsh.y"
+#line 2508 "Gmsh.y"
     {
       (yyval.i) = (int)(yyvsp[(2) - (2)].d);
     ;}
     break;
 
   case 216:
-#line 2509 "Gmsh.y"
+#line 2515 "Gmsh.y"
     {
       int type = (int)(yyvsp[(6) - (7)].v)[0];
       double coef = fabs((yyvsp[(6) - (7)].v)[1]);
@@ -6524,7 +6530,7 @@ yyreduce:
     break;
 
   case 217:
-#line 2563 "Gmsh.y"
+#line 2569 "Gmsh.y"
     {
       int k = List_Nbr((yyvsp[(4) - (6)].l));
       if(k != 0 && k != 3 && k != 4){
@@ -6597,7 +6603,7 @@ yyreduce:
     break;
 
   case 218:
-#line 2633 "Gmsh.y"
+#line 2639 "Gmsh.y"
     {
       yymsg(1, "Elliptic Surface is deprecated: use Transfinite instead (with smoothing)");
       List_Delete((yyvsp[(7) - (8)].l));
@@ -6605,7 +6611,7 @@ yyreduce:
     break;
 
   case 219:
-#line 2638 "Gmsh.y"
+#line 2644 "Gmsh.y"
     {
       int k = List_Nbr((yyvsp[(4) - (5)].l));
       if(k != 0 && k != 6 && k != 8){
@@ -6675,7 +6681,7 @@ yyreduce:
     break;
 
   case 220:
-#line 2705 "Gmsh.y"
+#line 2711 "Gmsh.y"
     {
       if(!(yyvsp[(3) - (5)].l)){
 	List_T *tmp = Tree2List(GModel::current()->getGEOInternals()->Surfaces);
@@ -6721,7 +6727,7 @@ yyreduce:
     break;
 
   case 221:
-#line 2748 "Gmsh.y"
+#line 2754 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (6)].l)); i++){
 	double d;
@@ -6744,7 +6750,7 @@ yyreduce:
     break;
 
   case 222:
-#line 2774 "Gmsh.y"
+#line 2780 "Gmsh.y"
     { 
       Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d));
       if(s){
@@ -6770,7 +6776,7 @@ yyreduce:
     break;
 
   case 223:
-#line 2797 "Gmsh.y"
+#line 2803 "Gmsh.y"
     {
       Surface *s = FindSurface((int)(yyvsp[(8) - (10)].d));
       if(s){
@@ -6796,26 +6802,26 @@ yyreduce:
     break;
 
   case 224:
-#line 2820 "Gmsh.y"
+#line 2826 "Gmsh.y"
     {
     ;}
     break;
 
   case 225:
-#line 2823 "Gmsh.y"
+#line 2829 "Gmsh.y"
     {
     ;}
     break;
 
   case 226:
-#line 2832 "Gmsh.y"
+#line 2838 "Gmsh.y"
     { 
       ReplaceAllDuplicates();
     ;}
     break;
 
   case 227:
-#line 2836 "Gmsh.y"
+#line 2842 "Gmsh.y"
     { 
       if(!strcmp((yyvsp[(2) - (3)].c), "Geometry"))
         ReplaceAllDuplicates();
@@ -6828,47 +6834,47 @@ yyreduce:
     break;
 
   case 228:
-#line 2851 "Gmsh.y"
+#line 2857 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (1)].d);           ;}
     break;
 
   case 229:
-#line 2852 "Gmsh.y"
+#line 2858 "Gmsh.y"
     { (yyval.d) = (yyvsp[(2) - (3)].d);           ;}
     break;
 
   case 230:
-#line 2853 "Gmsh.y"
+#line 2859 "Gmsh.y"
     { (yyval.d) = -(yyvsp[(2) - (2)].d);          ;}
     break;
 
   case 231:
-#line 2854 "Gmsh.y"
+#line 2860 "Gmsh.y"
     { (yyval.d) = (yyvsp[(2) - (2)].d);           ;}
     break;
 
   case 232:
-#line 2855 "Gmsh.y"
+#line 2861 "Gmsh.y"
     { (yyval.d) = !(yyvsp[(2) - (2)].d);          ;}
     break;
 
   case 233:
-#line 2856 "Gmsh.y"
+#line 2862 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) - (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 234:
-#line 2857 "Gmsh.y"
+#line 2863 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) + (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 235:
-#line 2858 "Gmsh.y"
+#line 2864 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) * (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 236:
-#line 2860 "Gmsh.y"
+#line 2866 "Gmsh.y"
     { 
       if(!(yyvsp[(3) - (3)].d))
 	yymsg(0, "Division by zero in '%g / %g'", (yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d));
@@ -6878,307 +6884,307 @@ yyreduce:
     break;
 
   case 237:
-#line 2866 "Gmsh.y"
+#line 2872 "Gmsh.y"
     { (yyval.d) = (int)(yyvsp[(1) - (3)].d) % (int)(yyvsp[(3) - (3)].d);  ;}
     break;
 
   case 238:
-#line 2867 "Gmsh.y"
+#line 2873 "Gmsh.y"
     { (yyval.d) = pow((yyvsp[(1) - (3)].d), (yyvsp[(3) - (3)].d));  ;}
     break;
 
   case 239:
-#line 2868 "Gmsh.y"
+#line 2874 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 240:
-#line 2869 "Gmsh.y"
+#line 2875 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) > (yyvsp[(3) - (3)].d);      ;}
     break;
 
   case 241:
-#line 2870 "Gmsh.y"
+#line 2876 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) <= (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 242:
-#line 2871 "Gmsh.y"
+#line 2877 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) >= (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 243:
-#line 2872 "Gmsh.y"
+#line 2878 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) == (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 244:
-#line 2873 "Gmsh.y"
+#line 2879 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) != (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 245:
-#line 2874 "Gmsh.y"
+#line 2880 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) && (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 246:
-#line 2875 "Gmsh.y"
+#line 2881 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (3)].d) || (yyvsp[(3) - (3)].d);     ;}
     break;
 
   case 247:
-#line 2876 "Gmsh.y"
+#line 2882 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (5)].d) ? (yyvsp[(3) - (5)].d) : (yyvsp[(5) - (5)].d); ;}
     break;
 
   case 248:
-#line 2877 "Gmsh.y"
+#line 2883 "Gmsh.y"
     { (yyval.d) = exp((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 249:
-#line 2878 "Gmsh.y"
+#line 2884 "Gmsh.y"
     { (yyval.d) = log((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 250:
-#line 2879 "Gmsh.y"
+#line 2885 "Gmsh.y"
     { (yyval.d) = log10((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 251:
-#line 2880 "Gmsh.y"
+#line 2886 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 252:
-#line 2881 "Gmsh.y"
+#line 2887 "Gmsh.y"
     { (yyval.d) = sin((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 253:
-#line 2882 "Gmsh.y"
+#line 2888 "Gmsh.y"
     { (yyval.d) = asin((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 254:
-#line 2883 "Gmsh.y"
+#line 2889 "Gmsh.y"
     { (yyval.d) = cos((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 255:
-#line 2884 "Gmsh.y"
+#line 2890 "Gmsh.y"
     { (yyval.d) = acos((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 256:
-#line 2885 "Gmsh.y"
+#line 2891 "Gmsh.y"
     { (yyval.d) = tan((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 257:
-#line 2886 "Gmsh.y"
+#line 2892 "Gmsh.y"
     { (yyval.d) = atan((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 258:
-#line 2887 "Gmsh.y"
+#line 2893 "Gmsh.y"
     { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;}
     break;
 
   case 259:
-#line 2888 "Gmsh.y"
+#line 2894 "Gmsh.y"
     { (yyval.d) = sinh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 260:
-#line 2889 "Gmsh.y"
+#line 2895 "Gmsh.y"
     { (yyval.d) = cosh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 261:
-#line 2890 "Gmsh.y"
+#line 2896 "Gmsh.y"
     { (yyval.d) = tanh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 262:
-#line 2891 "Gmsh.y"
+#line 2897 "Gmsh.y"
     { (yyval.d) = fabs((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 263:
-#line 2892 "Gmsh.y"
+#line 2898 "Gmsh.y"
     { (yyval.d) = floor((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 264:
-#line 2893 "Gmsh.y"
+#line 2899 "Gmsh.y"
     { (yyval.d) = ceil((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 265:
-#line 2894 "Gmsh.y"
+#line 2900 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 266:
-#line 2895 "Gmsh.y"
+#line 2901 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 267:
-#line 2896 "Gmsh.y"
+#line 2902 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (6)].d) * (yyvsp[(3) - (6)].d) + (yyvsp[(5) - (6)].d) * (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 268:
-#line 2897 "Gmsh.y"
+#line 2903 "Gmsh.y"
     { (yyval.d) = (yyvsp[(3) - (4)].d) * (double)rand() / (double)RAND_MAX; ;}
     break;
 
   case 269:
-#line 2899 "Gmsh.y"
+#line 2905 "Gmsh.y"
     { (yyval.d) = exp((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 270:
-#line 2900 "Gmsh.y"
+#line 2906 "Gmsh.y"
     { (yyval.d) = log((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 271:
-#line 2901 "Gmsh.y"
+#line 2907 "Gmsh.y"
     { (yyval.d) = log10((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 272:
-#line 2902 "Gmsh.y"
+#line 2908 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 273:
-#line 2903 "Gmsh.y"
+#line 2909 "Gmsh.y"
     { (yyval.d) = sin((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 274:
-#line 2904 "Gmsh.y"
+#line 2910 "Gmsh.y"
     { (yyval.d) = asin((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 275:
-#line 2905 "Gmsh.y"
+#line 2911 "Gmsh.y"
     { (yyval.d) = cos((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 276:
-#line 2906 "Gmsh.y"
+#line 2912 "Gmsh.y"
     { (yyval.d) = acos((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 277:
-#line 2907 "Gmsh.y"
+#line 2913 "Gmsh.y"
     { (yyval.d) = tan((yyvsp[(3) - (4)].d));      ;}
     break;
 
   case 278:
-#line 2908 "Gmsh.y"
+#line 2914 "Gmsh.y"
     { (yyval.d) = atan((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 279:
-#line 2909 "Gmsh.y"
+#line 2915 "Gmsh.y"
     { (yyval.d) = atan2((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d));;}
     break;
 
   case 280:
-#line 2910 "Gmsh.y"
+#line 2916 "Gmsh.y"
     { (yyval.d) = sinh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 281:
-#line 2911 "Gmsh.y"
+#line 2917 "Gmsh.y"
     { (yyval.d) = cosh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 282:
-#line 2912 "Gmsh.y"
+#line 2918 "Gmsh.y"
     { (yyval.d) = tanh((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 283:
-#line 2913 "Gmsh.y"
+#line 2919 "Gmsh.y"
     { (yyval.d) = fabs((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 284:
-#line 2914 "Gmsh.y"
+#line 2920 "Gmsh.y"
     { (yyval.d) = floor((yyvsp[(3) - (4)].d));    ;}
     break;
 
   case 285:
-#line 2915 "Gmsh.y"
+#line 2921 "Gmsh.y"
     { (yyval.d) = ceil((yyvsp[(3) - (4)].d));     ;}
     break;
 
   case 286:
-#line 2916 "Gmsh.y"
+#line 2922 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 287:
-#line 2917 "Gmsh.y"
+#line 2923 "Gmsh.y"
     { (yyval.d) = fmod((yyvsp[(3) - (6)].d), (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 288:
-#line 2918 "Gmsh.y"
+#line 2924 "Gmsh.y"
     { (yyval.d) = sqrt((yyvsp[(3) - (6)].d) * (yyvsp[(3) - (6)].d) + (yyvsp[(5) - (6)].d) * (yyvsp[(5) - (6)].d)); ;}
     break;
 
   case 289:
-#line 2919 "Gmsh.y"
+#line 2925 "Gmsh.y"
     { (yyval.d) = (yyvsp[(3) - (4)].d) * (double)rand() / (double)RAND_MAX; ;}
     break;
 
   case 290:
-#line 2928 "Gmsh.y"
+#line 2934 "Gmsh.y"
     { (yyval.d) = (yyvsp[(1) - (1)].d); ;}
     break;
 
   case 291:
-#line 2929 "Gmsh.y"
+#line 2935 "Gmsh.y"
     { (yyval.d) = 3.141592653589793; ;}
     break;
 
   case 292:
-#line 2930 "Gmsh.y"
+#line 2936 "Gmsh.y"
     { (yyval.d) = Msg::GetCommRank(); ;}
     break;
 
   case 293:
-#line 2931 "Gmsh.y"
+#line 2937 "Gmsh.y"
     { (yyval.d) = Msg::GetCommSize(); ;}
     break;
 
   case 294:
-#line 2932 "Gmsh.y"
+#line 2938 "Gmsh.y"
     { (yyval.d) = Get_GmshMajorVersion(); ;}
     break;
 
   case 295:
-#line 2933 "Gmsh.y"
+#line 2939 "Gmsh.y"
     { (yyval.d) = Get_GmshMinorVersion(); ;}
     break;
 
   case 296:
-#line 2934 "Gmsh.y"
+#line 2940 "Gmsh.y"
     { (yyval.d) = Get_GmshPatchVersion(); ;}
     break;
 
   case 297:
-#line 2939 "Gmsh.y"
+#line 2945 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(1) - (1)].c))){
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (1)].c));
@@ -7191,7 +7197,7 @@ yyreduce:
     break;
 
   case 298:
-#line 2952 "Gmsh.y"
+#line 2958 "Gmsh.y"
     {
       char tmpstring[1024];
       sprintf(tmpstring, "%s_%d", (yyvsp[(1) - (5)].c), (int)(yyvsp[(4) - (5)].d)) ;
@@ -7206,7 +7212,7 @@ yyreduce:
     break;
 
   case 299:
-#line 2964 "Gmsh.y"
+#line 2970 "Gmsh.y"
     {
       int index = (int)(yyvsp[(3) - (4)].d);
       if(!gmsh_yysymbols.count((yyvsp[(1) - (4)].c))){
@@ -7224,7 +7230,7 @@ yyreduce:
     break;
 
   case 300:
-#line 2979 "Gmsh.y"
+#line 2985 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(2) - (4)].c))){
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(2) - (4)].c));
@@ -7237,7 +7243,7 @@ yyreduce:
     break;
 
   case 301:
-#line 2989 "Gmsh.y"
+#line 2995 "Gmsh.y"
     {
       if(!gmsh_yysymbols.count((yyvsp[(1) - (2)].c))){
 	yymsg(0, "Unknown variable '%s'", (yyvsp[(1) - (2)].c));
@@ -7250,7 +7256,7 @@ yyreduce:
     break;
 
   case 302:
-#line 2999 "Gmsh.y"
+#line 3005 "Gmsh.y"
     {
       int index = (int)(yyvsp[(3) - (5)].d);
       if(!gmsh_yysymbols.count((yyvsp[(1) - (5)].c))){
@@ -7268,7 +7274,7 @@ yyreduce:
     break;
 
   case 303:
-#line 3017 "Gmsh.y"
+#line 3023 "Gmsh.y"
     {
       NumberOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), (yyval.d));
       Free((yyvsp[(1) - (3)].c)); Free((yyvsp[(3) - (3)].c));
@@ -7276,7 +7282,7 @@ yyreduce:
     break;
 
   case 304:
-#line 3022 "Gmsh.y"
+#line 3028 "Gmsh.y"
     {
       NumberOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), (yyval.d));
       Free((yyvsp[(1) - (6)].c)); Free((yyvsp[(6) - (6)].c));
@@ -7284,7 +7290,7 @@ yyreduce:
     break;
 
   case 305:
-#line 3027 "Gmsh.y"
+#line 3033 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (4)].c), 0, (yyvsp[(3) - (4)].c), d)){
@@ -7297,7 +7303,7 @@ yyreduce:
     break;
 
   case 306:
-#line 3037 "Gmsh.y"
+#line 3043 "Gmsh.y"
     {
       double d = 0.;
       if(NumberOption(GMSH_GET, (yyvsp[(1) - (7)].c), (int)(yyvsp[(3) - (7)].d), (yyvsp[(6) - (7)].c), d)){
@@ -7310,7 +7316,7 @@ yyreduce:
     break;
 
   case 307:
-#line 3047 "Gmsh.y"
+#line 3053 "Gmsh.y"
     { 
       (yyval.d) = Msg::GetValue((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].d));
       Free((yyvsp[(3) - (6)].c));
@@ -7318,70 +7324,70 @@ yyreduce:
     break;
 
   case 308:
-#line 3055 "Gmsh.y"
+#line 3061 "Gmsh.y"
     {
       memcpy((yyval.v), (yyvsp[(1) - (1)].v), 5*sizeof(double));
     ;}
     break;
 
   case 309:
-#line 3059 "Gmsh.y"
+#line 3065 "Gmsh.y"
     {
       for(int i = 0; i < 5; i++) (yyval.v)[i] = -(yyvsp[(2) - (2)].v)[i];
     ;}
     break;
 
   case 310:
-#line 3063 "Gmsh.y"
+#line 3069 "Gmsh.y"
     { 
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(2) - (2)].v)[i];
     ;}
     break;
 
   case 311:
-#line 3067 "Gmsh.y"
+#line 3073 "Gmsh.y"
     { 
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] - (yyvsp[(3) - (3)].v)[i];
     ;}
     break;
 
   case 312:
-#line 3071 "Gmsh.y"
+#line 3077 "Gmsh.y"
     {
       for(int i = 0; i < 5; i++) (yyval.v)[i] = (yyvsp[(1) - (3)].v)[i] + (yyvsp[(3) - (3)].v)[i];
     ;}
     break;
 
   case 313:
-#line 3078 "Gmsh.y"
+#line 3084 "Gmsh.y"
     { 
       (yyval.v)[0] = (yyvsp[(2) - (11)].d);  (yyval.v)[1] = (yyvsp[(4) - (11)].d);  (yyval.v)[2] = (yyvsp[(6) - (11)].d);  (yyval.v)[3] = (yyvsp[(8) - (11)].d); (yyval.v)[4] = (yyvsp[(10) - (11)].d);
     ;}
     break;
 
   case 314:
-#line 3082 "Gmsh.y"
+#line 3088 "Gmsh.y"
     { 
       (yyval.v)[0] = (yyvsp[(2) - (9)].d);  (yyval.v)[1] = (yyvsp[(4) - (9)].d);  (yyval.v)[2] = (yyvsp[(6) - (9)].d);  (yyval.v)[3] = (yyvsp[(8) - (9)].d); (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 315:
-#line 3086 "Gmsh.y"
+#line 3092 "Gmsh.y"
     {
       (yyval.v)[0] = (yyvsp[(2) - (7)].d);  (yyval.v)[1] = (yyvsp[(4) - (7)].d);  (yyval.v)[2] = (yyvsp[(6) - (7)].d);  (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 316:
-#line 3090 "Gmsh.y"
+#line 3096 "Gmsh.y"
     {
       (yyval.v)[0] = (yyvsp[(2) - (7)].d);  (yyval.v)[1] = (yyvsp[(4) - (7)].d);  (yyval.v)[2] = (yyvsp[(6) - (7)].d);  (yyval.v)[3] = 0.0; (yyval.v)[4] = 1.0;
     ;}
     break;
 
   case 317:
-#line 3097 "Gmsh.y"
+#line 3103 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(List_T*));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].l)));
@@ -7389,14 +7395,14 @@ yyreduce:
     break;
 
   case 318:
-#line 3102 "Gmsh.y"
+#line 3108 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].l)));
     ;}
     break;
 
   case 319:
-#line 3109 "Gmsh.y"
+#line 3115 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));
@@ -7404,14 +7410,14 @@ yyreduce:
     break;
 
   case 320:
-#line 3114 "Gmsh.y"
+#line 3120 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(1) - (1)].l);
     ;}
     break;
 
   case 321:
-#line 3118 "Gmsh.y"
+#line 3124 "Gmsh.y"
     {
       // creates an empty list
       (yyval.l) = List_Create(2, 1, sizeof(double));
@@ -7419,14 +7425,14 @@ yyreduce:
     break;
 
   case 322:
-#line 3123 "Gmsh.y"
+#line 3129 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (3)].l);
     ;}
     break;
 
   case 323:
-#line 3127 "Gmsh.y"
+#line 3133 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(3) - (4)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7437,7 +7443,7 @@ yyreduce:
     break;
 
   case 324:
-#line 3135 "Gmsh.y"
+#line 3141 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(4) - (5)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7448,14 +7454,14 @@ yyreduce:
     break;
 
   case 325:
-#line 3146 "Gmsh.y"
+#line 3152 "Gmsh.y"
     { 
       (yyval.l) = (yyvsp[(1) - (1)].l); 
     ;}
     break;
 
   case 326:
-#line 3150 "Gmsh.y"
+#line 3156 "Gmsh.y"
     {
       if(!strcmp((yyvsp[(1) - (1)].c), "*") || !strcmp((yyvsp[(1) - (1)].c), "all"))
         (yyval.l) = 0;
@@ -7467,7 +7473,7 @@ yyreduce:
     break;
 
   case 327:
-#line 3162 "Gmsh.y"
+#line 3168 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (2)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7478,7 +7484,7 @@ yyreduce:
     break;
 
   case 328:
-#line 3170 "Gmsh.y"
+#line 3176 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(3) - (3)].l);
       for(int i = 0; i < List_Nbr((yyval.l)); i++){
@@ -7489,7 +7495,7 @@ yyreduce:
     break;
 
   case 329:
-#line 3178 "Gmsh.y"
+#line 3184 "Gmsh.y"
     { 
       (yyval.l) = List_Create(2, 1, sizeof(double)); 
       for(double d = (yyvsp[(1) - (3)].d); ((yyvsp[(1) - (3)].d) < (yyvsp[(3) - (3)].d)) ? (d <= (yyvsp[(3) - (3)].d)) : (d >= (yyvsp[(3) - (3)].d)); 
@@ -7499,7 +7505,7 @@ yyreduce:
     break;
 
   case 330:
-#line 3185 "Gmsh.y"
+#line 3191 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double)); 
       if(!(yyvsp[(5) - (5)].d) || ((yyvsp[(1) - (5)].d) < (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) < 0) || ((yyvsp[(1) - (5)].d) > (yyvsp[(3) - (5)].d) && (yyvsp[(5) - (5)].d) > 0)){
@@ -7513,7 +7519,7 @@ yyreduce:
     break;
 
   case 331:
-#line 3196 "Gmsh.y"
+#line 3202 "Gmsh.y"
     {
       // Returns the coordinates of a point and fills a list with it.
       // This allows to ensure e.g. that relative point positions are
@@ -7536,7 +7542,7 @@ yyreduce:
     break;
 
   case 332:
-#line 3216 "Gmsh.y"
+#line 3222 "Gmsh.y"
     {
       (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double));
       for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){
@@ -7549,7 +7555,7 @@ yyreduce:
     break;
 
   case 333:
-#line 3226 "Gmsh.y"
+#line 3232 "Gmsh.y"
     {
       (yyval.l) = List_Create(List_Nbr((yyvsp[(1) - (1)].l)), 1, sizeof(double));
       for(int i = 0; i < List_Nbr((yyvsp[(1) - (1)].l)); i++){
@@ -7562,7 +7568,7 @@ yyreduce:
     break;
 
   case 334:
-#line 3236 "Gmsh.y"
+#line 3242 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       if(!gmsh_yysymbols.count((yyvsp[(1) - (3)].c)))
@@ -7575,7 +7581,7 @@ yyreduce:
     break;
 
   case 335:
-#line 3246 "Gmsh.y"
+#line 3252 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       if(!gmsh_yysymbols.count((yyvsp[(1) - (6)].c)))
@@ -7595,7 +7601,7 @@ yyreduce:
     break;
 
   case 336:
-#line 3266 "Gmsh.y"
+#line 3272 "Gmsh.y"
     {
       (yyval.l) = List_Create(2, 1, sizeof(double));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].d)));
@@ -7603,21 +7609,21 @@ yyreduce:
     break;
 
   case 337:
-#line 3271 "Gmsh.y"
+#line 3277 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(1) - (1)].l);
     ;}
     break;
 
   case 338:
-#line 3275 "Gmsh.y"
+#line 3281 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].d)));
     ;}
     break;
 
   case 339:
-#line 3279 "Gmsh.y"
+#line 3285 "Gmsh.y"
     {
       for(int i = 0; i < List_Nbr((yyvsp[(3) - (3)].l)); i++){
 	double d;
@@ -7629,21 +7635,21 @@ yyreduce:
     break;
 
   case 340:
-#line 3291 "Gmsh.y"
+#line 3297 "Gmsh.y"
     {
       (yyval.u) = CTX.PACK_COLOR((int)(yyvsp[(2) - (9)].d), (int)(yyvsp[(4) - (9)].d), (int)(yyvsp[(6) - (9)].d), (int)(yyvsp[(8) - (9)].d));
     ;}
     break;
 
   case 341:
-#line 3295 "Gmsh.y"
+#line 3301 "Gmsh.y"
     {
       (yyval.u) = CTX.PACK_COLOR((int)(yyvsp[(2) - (7)].d), (int)(yyvsp[(4) - (7)].d), (int)(yyvsp[(6) - (7)].d), 255);
     ;}
     break;
 
   case 342:
-#line 3307 "Gmsh.y"
+#line 3313 "Gmsh.y"
     {
       int flag;
       (yyval.u) = Get_ColorForString(ColorString, -1, (yyvsp[(1) - (1)].c), &flag);
@@ -7653,7 +7659,7 @@ yyreduce:
     break;
 
   case 343:
-#line 3314 "Gmsh.y"
+#line 3320 "Gmsh.y"
     {
       unsigned int val = 0;
       ColorOption(GMSH_GET, (yyvsp[(1) - (5)].c), 0, (yyvsp[(5) - (5)].c), val);
@@ -7663,14 +7669,14 @@ yyreduce:
     break;
 
   case 344:
-#line 3324 "Gmsh.y"
+#line 3330 "Gmsh.y"
     {
       (yyval.l) = (yyvsp[(2) - (3)].l);
     ;}
     break;
 
   case 345:
-#line 3328 "Gmsh.y"
+#line 3334 "Gmsh.y"
     {
       (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
       GmshColorTable *ct = Get_ColorTable((int)(yyvsp[(3) - (6)].d));
@@ -7685,7 +7691,7 @@ yyreduce:
     break;
 
   case 346:
-#line 3343 "Gmsh.y"
+#line 3349 "Gmsh.y"
     {
       (yyval.l) = List_Create(256, 10, sizeof(unsigned int));
       List_Add((yyval.l), &((yyvsp[(1) - (1)].u)));
@@ -7693,21 +7699,21 @@ yyreduce:
     break;
 
   case 347:
-#line 3348 "Gmsh.y"
+#line 3354 "Gmsh.y"
     {
       List_Add((yyval.l), &((yyvsp[(3) - (3)].u)));
     ;}
     break;
 
   case 348:
-#line 3355 "Gmsh.y"
+#line 3361 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(1) - (1)].c);
     ;}
     break;
 
   case 349:
-#line 3359 "Gmsh.y"
+#line 3365 "Gmsh.y"
     {
       if(!gmsh_yystringsymbols.count((yyvsp[(1) - (1)].c))){
 	yymsg(0, "Unknown string variable '%s'", (yyvsp[(1) - (1)].c));
@@ -7723,7 +7729,7 @@ yyreduce:
     break;
 
   case 350:
-#line 3372 "Gmsh.y"
+#line 3378 "Gmsh.y"
     { 
       const char *val = "";
       StringOption(GMSH_GET, (yyvsp[(1) - (3)].c), 0, (yyvsp[(3) - (3)].c), val);
@@ -7734,7 +7740,7 @@ yyreduce:
     break;
 
   case 351:
-#line 3380 "Gmsh.y"
+#line 3386 "Gmsh.y"
     { 
       const char *val = "";
       StringOption(GMSH_GET, (yyvsp[(1) - (6)].c), (int)(yyvsp[(3) - (6)].d), (yyvsp[(6) - (6)].c), val);
@@ -7745,14 +7751,14 @@ yyreduce:
     break;
 
   case 352:
-#line 3391 "Gmsh.y"
+#line 3397 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(1) - (1)].c);
     ;}
     break;
 
   case 353:
-#line 3395 "Gmsh.y"
+#line 3401 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc(32 * sizeof(char));
       time_t now;
@@ -7763,7 +7769,7 @@ yyreduce:
     break;
 
   case 354:
-#line 3403 "Gmsh.y"
+#line 3409 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (6)].c)) + strlen((yyvsp[(5) - (6)].c)) + 1) * sizeof(char));
       strcpy((yyval.c), (yyvsp[(3) - (6)].c));
@@ -7774,7 +7780,7 @@ yyreduce:
     break;
 
   case 355:
-#line 3411 "Gmsh.y"
+#line 3417 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
       int i;
@@ -7791,7 +7797,7 @@ yyreduce:
     break;
 
   case 356:
-#line 3425 "Gmsh.y"
+#line 3431 "Gmsh.y"
     {
       (yyval.c) = (char *)Malloc((strlen((yyvsp[(3) - (4)].c)) + 1) * sizeof(char));
       int i;
@@ -7808,14 +7814,14 @@ yyreduce:
     break;
 
   case 357:
-#line 3439 "Gmsh.y"
+#line 3445 "Gmsh.y"
     {
       (yyval.c) = (yyvsp[(3) - (4)].c);
     ;}
     break;
 
   case 358:
-#line 3443 "Gmsh.y"
+#line 3449 "Gmsh.y"
     {
       char tmpstring[1024];
       int i = PrintListOfDouble((yyvsp[(3) - (6)].c), (yyvsp[(5) - (6)].l), tmpstring);
@@ -7838,7 +7844,7 @@ yyreduce:
 
 
 /* Line 1267 of yacc.c.  */
-#line 7842 "Gmsh.tab.cpp"
+#line 7848 "Gmsh.tab.cpp"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -8052,7 +8058,7 @@ yyreturn:
 }
 
 
-#line 3463 "Gmsh.y"
+#line 3469 "Gmsh.y"
 
 
 int PrintListOfDouble(char *format, List_T *list, char *buffer)
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index b04118f1cbe477a312f5519cb1d5ce9889f8f09e..fa9522ba3bda4d89a3b752ca4de0e054efd2b5ea 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -1742,7 +1742,13 @@ Delete :
     }
   | tDelete tSTRING tEND
     {
-      if(!strcmp($2, "Model") || !strcmp($2, "Meshes") || !strcmp($2, "All")){
+      if(!strcmp($2, "Meshes") || !strcmp($2, "All")){
+        for(unsigned int i = 0; i < GModel::list.size(); i++){
+          GModel::list[i]->destroy();
+          GModel::list[i]->getGEOInternals()->destroy();
+        }
+      }
+      else if(!strcmp($2, "Model")){
 	GModel::current()->destroy();
 	GModel::current()->getGEOInternals()->destroy();
       }