[vtkusers] VRML to vtkPolyData

Tim Hutton T.Hutton at eastman.ucl.ac.uk
Tue Apr 13 05:34:30 EDT 2004


Donald,

The following works if there is a single object in the VRML scene that you 
are importing:

vtkDataSet *pDataset;
vtkVRMLImporter *vrml_importer = vtkVRMLImporter::New();
vrml_importer->SetFileName(surface_name);
vrml_importer->Update(); // because we are about to bypass the pipeline
vtkActorCollection *actors = vrml_importer->GetRenderer()->GetActors();
if(actors && actors->GetNumberOfItems()>0) {
   actors->InitTraversal();
   pDataset = actors->GetNextActor()->GetMapper()->GetInput();
}

and you can use vtkGeometryFilter to convert the vtkDataSet to a 
vtkPolyData (if you need to).

Hope this hack helps!

tim.


At 10:55 11/04/2004 -0700, Hamp Donald wrote:
>Hi
>      I am able to read a VRML file and display it.
>Please find the attached file. Can somebody help me
>how to hold the data in vtkPolyData format or writing
>the data in vtk format in a file.
>
>Respond Please.
>
>Best Regards
>Donald
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Tax Center - File online by April 15th
>http://taxes.yahoo.com/filing.html





More information about the vtkusers mailing list