Index: GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.h	(revision 162)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.h	(revision 658)
@@ -15,5 +15,5 @@
   UnigraphicsParser(): Parser() {}
   
-  virtual bool ParseFile(const string filename, SceneGraphNode **root);
+  virtual bool ParseFile(const string filename, SceneGraphNode **root, const bool loadPolygonsAsMeshes = false);
   
 };
Index: GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 657)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 658)
@@ -90,18 +90,52 @@
 X3dParseHandlers::EndShape()
 {
-  if (mCurrentMesh->mFaces.size()) {
-    mCurrentMesh->Preprocess();
-    // make an instance of this mesh
-    MeshInstance *mi = new MeshInstance(mCurrentMesh);
-    mCurrentNode->mGeometry.push_back(mi);
-	// set the object id to a unique value
-	//mi->SetId(mCurrentObjectId ++);
-  } else {
-    cout<<"X";
-    delete mCurrentMesh;
-  }
-  mCurrentMesh = NULL;
-}
-
+	if (mLoadPolygonsAsMeshes)
+	{
+		vector<VertexIndexContainer>::const_iterator it, it_end = mCurrentVertexIndices.end();
+
+		for (it = mCurrentVertexIndices.begin(); it != it_end; ++ it)
+		{
+			// only one face per mesh
+			Mesh *mesh = new Mesh();
+
+			// add vertices
+			for (int i = 0; i < (int)(*it).size(); ++ i)
+			{
+				mesh->mVertices.push_back(mCurrentVertices[(*it)[i]]);
+				
+			}
+			
+			mesh->mFaces.push_back(new Face(0,1,2));
+			mesh->Preprocess();
+			// make an instance of this mesh
+			MeshInstance *mi = new MeshInstance(mesh);
+			mCurrentNode->mGeometry.push_back(mi);
+
+		}
+
+		delete mCurrentMesh;
+		mCurrentVertices.clear();
+		mCurrentVertexIndices.clear();
+	}
+	else
+	{
+ 
+		if (mCurrentMesh->mFaces.size()) 
+		{
+			mCurrentMesh->Preprocess();
+			// make an instance of this mesh
+			MeshInstance *mi = new MeshInstance(mCurrentMesh);
+			mCurrentNode->mGeometry.push_back(mi);
+			// set the object id to a unique value
+			//mi->SetId(mCurrentObjectId ++);
+		} 
+		else 
+		{
+			cout<<"X";
+			delete mCurrentMesh;
+		}
+		mCurrentMesh = NULL;
+	}
+}
 void
 X3dParseHandlers::StartIndexedFaceSet(
@@ -126,19 +160,15 @@
 		  Face *face = new Face(vertices);
 
-		   mCurrentMesh->mFaces.push_back(face);
-
-		   // every polygon is a mesh => store in mesh instance and create new mesh
-		  if (mLoadPolygonsAsMeshes)
-		  {
-			  mCurrentMesh->Preprocess();
-
-			  // make an instance of this mesh
-			  MeshInstance *mi = new MeshInstance(mCurrentMesh);
-			  mCurrentNode->mGeometry.push_back(mi);
-
-			  mCurrentMesh = new Mesh();
-		  }
-
+		   if (!mLoadPolygonsAsMeshes)
+		   {
+			   mCurrentMesh->mFaces.push_back(face);
+		   }
+		   else
+		   // every polygon is a mesh
+		   {
+			   mCurrentVertexIndices.push_back(vertices);
+		   }
 	  }
+
 	  vertices.clear();
 	  if (ptr == endptr)
@@ -223,5 +253,12 @@
 				vertices.push_back(v);
 			}
-			mCurrentMesh->mVertices = vertices;
+			if (mLoadPolygonsAsMeshes)
+			{
+				mCurrentVertices = vertices;
+			}
+			else
+			{
+				mCurrentMesh->mVertices = vertices;
+			}
 		}
 	}
@@ -243,5 +280,5 @@
   if (element == "Shape") {
     cout<<"+";
-    mCurrentMesh = new Mesh;
+	mCurrentMesh = new Mesh;
   }
   
Index: GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp	(revision 340)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp	(revision 658)
@@ -26,5 +26,6 @@
 bool
 UnigraphicsParser::ParseFile(const string filename,
-			     SceneGraphNode **proot)
+			     SceneGraphNode **proot,
+				 const bool loadPolygonsAsMeshese)
 {
   
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Parser.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Parser.h	(revision 508)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Parser.h	(revision 658)
@@ -14,5 +14,7 @@
   Parser() {}
 
-  virtual bool ParseFile(const string filename, SceneGraphNode **root) {return false;};
+  virtual bool ParseFile(const string filename, 
+						 SceneGraphNode **root, 
+						 const bool loadPolygonsAsMeshes = false) {return false;};
 	
 };
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 655)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 658)
@@ -1530,4 +1530,9 @@
 					"false");
 
+	RegisterOption("Preprocessor.loadPolygonsAsMeshes",
+					optBool,
+					"loadPolygonsAsMeshes=",
+					"false");
+
 	RegisterOption("Preprocessor.pvsRenderErrorSamples",
 				   optInt,
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 656)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 658)
@@ -28,4 +28,5 @@
   
   environment->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger);
+  environment->GetBoolValue("Preprocessor.loadPolygonsAsMeshes", mLoadPolygonsAsMeshes);
   environment->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish);
 
@@ -89,5 +90,5 @@
 
 		cout<<filename<<endl;
-		result = parser->ParseFile(filename, &mSceneGraph->mRoot);
+		result = parser->ParseFile(filename, &mSceneGraph->mRoot, mLoadPolygonsAsMeshes);
 
 		delete parser;
@@ -123,4 +124,13 @@
 	  mSceneGraph->CollectObjects(&mObjects);
 	  mSceneGraph->mRoot->UpdateBox();
+
+	  	Exporter *exporter = Exporter::GetExporter("testload.x3d");
+
+		if (exporter)
+		{
+			exporter->ExportGeometry(mObjects);
+			delete exporter;
+		}
+
 	}
 	
Index: GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 599)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 658)
@@ -158,4 +158,6 @@
 
   bool mQuitOnFinish;
+  bool mLoadPolygonsAsMeshes;
+
 protected:
 
Index: GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 651)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 658)
@@ -1051,8 +1051,6 @@
 		if (exporter)
 		{
-			
 			if (0 && mExportRays)
 				exporter->ExportRays(rays, RgbColor(1, 1, 1));
-
 			
 			if (mExportGeometry)
Index: GTP/trunk/Lib/Vis/Preprocessing/src/X3dParserXerces.h
===================================================================
--- GTP/trunk/Lib/Vis/Preprocessing/src/X3dParserXerces.h	(revision 657)
+++ GTP/trunk/Lib/Vis/Preprocessing/src/X3dParserXerces.h	(revision 658)
@@ -63,4 +63,7 @@
   SceneGraphNode *mCurrentNode;
   Mesh *mCurrentMesh;
+  vector<VertexIndexContainer> mCurrentVertexIndices;
+  VertexContainer mCurrentVertices;
+
   Material *mCurrentMaterial;
   bool mLoadPolygonsAsMeshes;
@@ -159,5 +162,5 @@
 
   VertexIndexContainer mCurrentVertexIndices;
-
+ 
   // Handlers for X3D
   void
