[vtkusers] get polydata from x3d importer

Karl bulkmailaddress at gmail.com
Sat Dec 19 01:58:11 EST 2009


Hi,
I have been successfully using vtkX3DImporter from XIOT (http://forge.collaviz.org/community/xiot) to display scenes stored in the X3D format.

The need has now arisen for me to manipulate the underlying data before display (each X3D file has a single object).  I see no easy way to access the underlying polydata, and end up moving backwards through the pipeline to get it.  Is there a better way to do this?

    vtkX3DImporter* importer = vtkX3DImporter::New();
    importer->SetFileName( filename );
    importer->Update();

    vtkRenderer* r = importer->GetRenderer();
    vtkActorCollection* actorCollection = r->GetActors();
    actorCollection->InitTraversal();
    vtkActor* actor = actorCollection->GetNextActor();
    vtkMapper* map = actor->GetMapper();
    vtkDataSet* dataSet = map->GetInput();
    vtkPolyData* polyData = dynamic_cast< vtkPolyData* >(dataSet) ;

Thanks,
KB




More information about the vtkusers mailing list