[vtkusers] Unintuitive use of	vtkStructuredPointsWriter/vtkFloatArray
    Ganesh Swami 
    ganesh at iamganesh.com
       
    Tue Oct  6 12:09:15 EDT 2009
    
    
  
Hi,
I'm trying to write a bunch of rank-2 tensors to a VTK file, and I can't 
figure out why my output file is empty. I turned debugging on and it 
prints out that the StructuredPointsWriter's input has no PointData. 
When I print the writer object or the result of writer.GetInput(), it 
shows me the tensor data as expected. I'm using the latest stable 
version of VTK 5.4.2.
import vtk
f = vtk.vtkFloatArray()
f.SetNumberOfComponents(9)
for i in range(50):
   b = [x*1.0 for x in range(9)]
   f.InsertTuple9(i, *b)
sp=vtk.vtkStructuredPoints()
sp.GetPointData().SetTensors(f)
sp.Update()
writer = vtk.vtkStructuredPointsWriter()
writer.SetFileName('foo.vtk')
writer.SetInput(sp)
writer.Write()
Any help is greatly appreciated!
Thanks,
Ganesh
    
    
More information about the vtkusers
mailing list