[vtkusers] Storing an independent piece of information in a VTP file

David Doria daviddoria at gmail.com
Fri Apr 17 13:41:25 EDT 2009


Say I have a vtp file which contains 100 points (and vertices). I know how
to add a vector of the same length with information about each point, but is
there a way to add just a single integer or double or something? For
example, if I want to know this was the 4th file, I would want to store
FileIndex=4 in the file. If I add a vtkIntArray with only one element,
paraview gets mad when I open the file because that array is not the same
length as the point array.

This is what I was doing:
vtkSmartPointer<vtkIntArray> FileIndex =
vtkSmartPointer<vtkIntArray>::New();
    FileIndex->SetNumberOfComponents(1);
    FileIndex->SetName("FileIndex");
    FileIndex->InsertNextValue(4);
    pdata->GetPointData()->AddArray(FileIndex);

What I want to do would be something like this:
    pdata->AddData("FileIndex")->AddValue(4); //this is not valid VTK syntax

Is there any way to do this?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090417/2817566d/attachment.htm>


More information about the vtkusers mailing list