[vtkusers] updating SG scalars

Randy Heiland heiland at ncsa.uiuc.edu
Thu Oct 24 14:03:35 EDT 2002


I've visited this problem in the past, but I just like to relive these
moments...

I have a vtkStructuredGrid containing a grid and just one scalar field.  I want
to read in/display filters for the SG, then read in a vtkFieldData file and
update the scalar field (and filters).  I currently try this for the update:

dor = vtkDataObjectReader()
dor.SetFileName(fieldfile)
dor.Update()

print 'doing GetArray(0)'
scalars = vtkFloatArray()
scalars = dor.GetOutput().GetFieldData().GetArray(0)
vtkSG1.GetPointData().SetScalars(scalars)
vtkSG1.GetPointData().Modified()
vtkSG1.Update()

However, it doesn't change seem to change the scalar field.  Is this more or
less the proper approach, or should I do it differently?

--Randy



More information about the vtkusers mailing list