[vtkusers] Help: How to generate active view from series .vtu files?

Ming Qi chimaeraqm at yahoo.com
Sat Jun 13 08:21:39 EDT 2015

Hello! I have a problem in programme vtk project with vs2010.Now I have a series .vtu files in a folder with the name like PART001, PART002, PART003 and so on. If I open this bunch of files in paraview, it shows a active view. Now with the class of  vtuXMLUnstructuredGridReader, i am able to open a .vtu file in this folder and a static graphic shown in a window. But if i made a loop to read .vtu files files. it will read one .vtu at a time, generating one window with static graphic and then close this window, and open a new window to show the next graphic read from the next .vtu file. I want to know which class i should use to read all the .vtu files as a whole and generate an active view just like shown in the ParaView. The code I read one .vtu file is listed as follows. How should I change the code if I want to achieve my target.

>>vtkSmartPointer<vtkXMLUnstructuredGridReader> reader = vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();>> char fileName[128]; >> sprintf(fileName,"G:/ParaviewFiles/ParaviewFiles/VTU/VTUinp.pvd");>> reader->SetFileName(fileName); >> vtkNew<vtkDataSetSurfaceFilter> surfaces;>> surfaces->SetInputConnection(reader->GetOutputPort());>> vtkNew<vtkPolyDataMapper> mapper;>> mapper->SetInputConnection(surfaces->GetOutputPort());>> vtkNew<vtkActor> actor;>> actor->SetMapper(mapper.GetPointer());>> vtkNew<vtkRenderer> renderer;>> renderer->AddActor(actor.GetPointer());>> renderer->SetBackground(0,0,0);>> vtkNew<vtkRenderWindow> renwin;>> renwin->SetMultiSamples(0);>> renwin->AddRenderer(renderer.GetPointer());>>renwin->SetSize(500, 500);>> vtkNew<vtkRenderWindowInteractor> iren;>> iren->SetRenderWindow(renwin.GetPointer());>> iren->Initialize();>> renderer->ResetCamera();>> vtkCamera *camera = renderer->GetActiveCamera();>> camera->Elevation(-90);>> camera->SetViewUp(0.0, 0.0, 0.0);>> camera->Azimuth(0);>> renwin->Render();>> int retVal = vtkRegressionTestImage( renwin.GetPointer() );
Thanks very much!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150613/7b482741/attachment.html>

More information about the vtkusers mailing list