[vtkusers] updating SG scalars
Jeff Lee
jeff at cdnorthamerica.com
Thu Oct 24 14:22:50 EDT 2002
Randy Heiland wrote:
>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?
>
I do something like
Grid->GetCellData()->AddArray(da);
Grid->GetCellData()->SetActiveScalars(da->GetName());
Grid->Modified();
-Jeff
>
>--Randy
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
More information about the vtkusers
mailing list