[vtkusers] vtkIdTypeArray export with vtkXMLPolyDataWriter

Matthias Schneider schneider at vision.ee.ethz.ch
Sat Jun 15 09:29:17 EDT 2013


Hi everybody,

Exporting a vtkPolyData object with a vtkIdTypeArray property via 
vtkXMLPolyDataWriter, the vtkIdTypeArray is written in a (portable) 
native type (Int32/Int64).
Reading the xml file again, the vtkIdTypeArray is then stored as an vtk 
array corresponding to the native type, e.g. vtkLongArray for the 64-bit 
case. A SafeDownCast to vtkIdTypeArray fails for obvious reasons.

This behavior is different from the legagy vtk format 
(vtkPolyDataWriter) where vtkIdType is an 'export type' on its own and 
can hence be imported as vtkIdTypeArray again even though one might run 
into portability issues at some point...

I was wondering if there is some way to do the cast for the xml case. In 
other words, is there any (efficient) way to cast a 
vtkLongArray/vtkIntArray to a vtkIdTypeArray depending on the size of 
vtkIdType.

Thanks in advance for the help

Best,
matthias



More information about the vtkusers mailing list