[vtkusers] Conversion from VRML into VTK format

Nour Mestiri nourmestiri at yahoo.fr
Thu Jan 22 15:01:17 EST 2009


Hi all vtk users,
I have a VRML file and i want  to convert it into VTK files. I found a code but i have some problems with it :
 
vtkVRMLImporter *imp1 = vtkVRMLImporter::New();
imp1->SetFileName("C:/vrmlFile");
imp1->Read();
imp1->Update();
 
vtkDataSet *pDataset1;
vtkActorCollection *actors1 = imp1->GetRenderer()->GetActors();
actors1->InitTraversal();
pDataset1 = actors1->GetNextActor()->GetMapper()->GetInput();
    
vtkGeometryFilter *geometryFilter1 = vtkGeometryFilter::New();
geometryFilter1->SetInput(pDataset1);
    
vtkPolyData *polyData1 = vtkPolyData::New();
polyData1 = geometryFilter1->GetOutput();
polyData1->Update();
 
vtkDataSetWriter *writer1 = vtkDataSetWriter::New();
writer1->SetInput(polyData1);
writer1->SetFileName(OutputFile);
writer1->SetFileTypeToASCII();
    
ostream *vtkFile1 = writer1->OpenVTKFile();
writer1->WriteHeader(vtkFile);
writer1->WritePointData(vtkFile, pDataset1);
writer1->CloseVTKFile(vtkFile);
 
Can you tell me if that code makes the conversion from VRML to VTK format?
If yes, can you specify me the extensions to add for "OutputFile" and "vtkFile"?
 
Thank you sooooo much for your help.


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090122/adea9431/attachment.htm>


More information about the vtkusers mailing list