[Paraview] Displaying texts from pointdata

ChiaWeng Boon chiaweng at gmail.com
Sun Aug 7 19:42:02 EDT 2011


Hi,

I would like to display the ID numbers of my bodies.  They are saved
as a Point Data as follows from vtkUnstructuredGridWriter.  Is there a
way to display the IDs as texts using Paraview?  I've been trying out
different Filters for hours but am unsuccessful.

vtkSmartPointer<vtkFloatArray> spheresId =
vtkSmartPointer<vtkFloatArray>::New();
	spheresId->SetNumberOfComponents(1);
	spheresId->SetName("id");
vtkSmartPointer<vtkUnstructuredGrid> spheresUg =
vtkSmartPointer<vtkUnstructuredGrid>::New();

FOR EVERY BODY:
spheresUg->SetPoints(spheresPos);
spheresUg->SetCells(VTK_VERTEX, spheresCells);
spheresId->InsertNextValue(b->getId());
spheresUg->GetPointData()->AddArray(spheresId);
END FOR

vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
string fn=fileName+"spheres."+lexical_cast<string>(scene->iter)+".vtu";
writer->SetFileName(fn.c_str());
writer->SetInput(spheresUg);
writer->Write();


Yours faithfully,

Boon


More information about the ParaView mailing list