[vtkusers] scalars in PolyDataWriter

Randy Heiland heiland at ncsa.uiuc.edu
Wed Apr 3 14:13:20 EST 2002


Simple question (vtk 4.0) - I have an ascii polydata file with multiple sets of
(pointdata) scalars and I want to read it in and write it out as a binary
polydata file.  When I do so, I don't get the scalars.  What am I missing?  I
blindly tried this (actually just writing back out in ascii here to see
results):

pdatRead = vtkPolyDataReader()
pdatRead.SetFileName(infname)
pdatRead.GetOutput().GetCellData().CopyScalarsOff()
pdatRead.GetOutput().GetPointData().CopyScalarsOn()
pdatRead.SetScalarsName("species2")
pdatRead.Update()

writer = vtkPolyDataWriter()
writer.SetFileName(outfname)
#writer.SetFileTypeToBinary()
writer.SetInput(pdatRead.GetOutput())
writer.Write()

thanks!
--Randy



More information about the vtkusers mailing list