[vtkusers] how do i read multifiles sharing the same topological structure

赖瑞勋 lairuixun at 163.com
Mon Nov 22 22:02:52 EST 2010


hi,all
How do i read multifiles and animate them. these files share the same topological structure but different attribute data. I just want to read them and finally animated them.
the code below just read one file. Must I build up a "for ....next " structure to loop these files? I have no idea.
Any suggestions will be very glad! Or just give me some hints of which VTK class to use.
Thanks!
*********************************************************************************
//access one tecplot file
 const char *fileName;
 vtkTecplotReader *tecR=vtkTecplotReader::New();
 fileName="C:/Program Files/VTK 5.6/mycode/Example01/fort151.plt";
 tecR->SetFileName(fileName);
 tecR->Update();
 //read this file
 vtkMultiBlockDataSet *mbds =vtkMultiBlockDataSet::New ();
 mbds=tecR->GetOutput();
 vtkUnstructuredGrid *ug=vtkUnstructuredGrid::SafeDownCast(mbds->GetBlock(0));
 ug->GetPointData()->SetActiveScalars("H"); //set H as the attribute data to show
 // Now we'll look at it.
 vtkDataSetMapper *cubeMapper = vtkDataSetMapper::New();
   cubeMapper->SetInput(ug);
 vtkActor *cubeActor = vtkActor::New();
   cubeActor->SetMapper(cubeMapper);
 vtkRenderer *renderer = vtkRenderer::New();
 renderer->AddActor(cubeActor);
 vtkRenderWindow *renWin = vtkRenderWindow::New();
 renWin->AddRenderer(renderer);
 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
 iren->SetRenderWindow(renWin);
 renderer->AddActor(cubeActor);
   renderer->ResetCamera();
 renWin->SetSize(500,500);
 // interact with data
 renWin->Render();
 iren->Start();
*************************************************************************************

reece


网易163/126邮箱百分百兼容iphone ipad邮件收发
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101123/b2bb000c/attachment.htm>


More information about the vtkusers mailing list