Index: /trunk/gui/scripts/mesh.tcl
===================================================================
--- /trunk/gui/scripts/mesh.tcl	(revision 4392)
+++ /trunk/gui/scripts/mesh.tcl	(revision 4393)
@@ -454,5 +454,4 @@
     return $value
 }
-
 
 itcl::body Rappture::Mesh::ReadVtk { path } {
@@ -789,5 +788,5 @@
     set _type "triangles"
     set _numPoints [$xv length]
-    set count 0
+    set _numCells 0
     set data {}
     set celltypes {}
@@ -795,5 +794,5 @@
 	append data " 3 $a $b $c\n"
 	append celltypes "5\n"
-	incr count
+	incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
@@ -802,7 +801,8 @@
 	append out " $x $y $z\n"
     }
-    append out "CELLS $count [expr $count * 4]\n"
+    set count [expr $_numCells * 4]
+    append out "CELLS $_numCells $count\n"
     append out $data
-    append out "CELL_TYPES $count\n"
+    append out "CELL_TYPES $_numCells\n"
     append out $celltypes
     set _limits(x) [$xv limits]
@@ -820,5 +820,5 @@
     set _type "quads"
     set _numPoints [$xv length]
-    set count 0
+    set _numCells 0
     set data {}
     set celltypes {}
@@ -826,5 +826,5 @@
 	append data " 4 $a $b $c $d\n"
 	append celltypes "9\n"
-	incr count
+	incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
@@ -833,7 +833,8 @@
 	append out " $x $y $z\n"
     }
-    append out "CELLS $count [expr $count * 5]\n"
+    set count [expr $_numCells * 5]
+    append out "CELLS $_numCells $count\n"
     append out $data
-    append out "CELL_TYPES $count\n"
+    append out "CELL_TYPES $_numCells\n"
     append out $celltypes
     set _limits(x) [$xv limits]
@@ -851,5 +852,5 @@
     set _type "tetrahedrons"
     set _numPoints [$xv length]
-    set count 0
+    set _numCells 0
     set data {}
     set celltypes {}
@@ -857,5 +858,5 @@
 	append data " 4 $a $b $c $d\n"
 	append celltypes "10\n"
-	incr count
+	incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
@@ -864,7 +865,8 @@
 	append out " $x $y $z\n"
     }
-    append out "CELLS $count [expr $count * 5]\n"
+    set count [expr $_numCells * 5]
+    append out "CELLS $_numCells $count\n"
     append out $data
-    append out "CELL_TYPES $count\n"
+    append out "CELL_TYPES $_numCells\n"
     append out $celltypes
     set _limits(x) [$xv limits]
@@ -879,5 +881,5 @@
     set _type "hexahedrons"
     set _numPoints [$xv length]
-    set count 0
+    set _numCells 0
     set data {}
     set celltypes {}
@@ -885,5 +887,5 @@
 	append data " 8 $a $b $c $d $e $f $g $h\n"
 	append celltypes "12\n"
-	incr count
+	incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
@@ -892,7 +894,8 @@
 	append out " $x $y $z\n"
     }
-    append out "CELLS $count [expr $count * 9]\n"
+    set count [expr $_numCells * 9]
+    append out "CELLS $_numCells $count\n"
     append out $data
-    append out "CELL_TYPES $count\n"
+    append out "CELL_TYPES $_numCells\n"
     append out $celltypes
     set _limits(x) [$xv limits]
@@ -907,5 +910,5 @@
     set _type "wedges"
     set _numPoints [$xv length]
-    set count 0
+    set _numCells 0
     set data {}
     set celltypes {}
@@ -913,5 +916,5 @@
 	append data " 6 $a $b $c $d $e $f\n"
 	append celltypes "13\n"
-	incr count
+	incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
@@ -920,7 +923,8 @@
 	append out " $x $y $z\n"
     }
-    append out "CELLS $count [expr $count * 7]\n"
+    set count [expr $_numCells * 7]
+    append out "CELLS $_numCells $count\n"
     append out $data
-    append out "CELL_TYPES $count\n"
+    append out "CELL_TYPES $_numCells\n"
     append out $celltypes
     set _limits(x) [$xv limits]
@@ -935,5 +939,5 @@
     set _type "pyramids"
     set _numPoints [$xv length]
-    set count 0
+    set _numCells 0
     set data {}
     set celltypes {}
@@ -941,5 +945,5 @@
 	append data " 5 $a $b $c $d $e\n"
 	append celltypes "14\n"
-	incr count
+	incr _numCells
     }
     append out "DATASET UNSTRUCTURED_GRID\n"
@@ -948,7 +952,8 @@
 	append out " $x $y $z\n"
     }
-    append out "CELLS $count [expr $count * 6]\n"
+    set count [expr $_numCells * 6]
+    append out "CELLS $_numCells $count\n"
     append out $data
-    append out "CELL_TYPES $count\n"
+    append out "CELL_TYPES $_numCells\n"
     append out $celltypes
     set _limits(x) [$xv limits]
