[vtkusers] How to use more than one set of scalar (or other) data from a dataset?

tom fogal tfogal at apollo.sr.unh.edu
Mon Oct 18 09:55:42 EDT 2004


 <20041018115934.57007.qmail at web61101.mail.yahoo.com>s comp writes:
>How, for example, do I contour 2 different scalar fields from the one data set
> at the same time?
>
>The obvious way of using SetScalarsName once creating a contour, and then usin
>g SetScalarsName again to change the scalar field, and creating another contou
>r does not work - both contours are of the same scalar field.

Try 'SetActiveScalars(char*)'. The string it takes is the name given to
the scalars via AddArray() and SetArray() [which both use the name of
the vtk<X>Array which is passed into it].
These methods are off of vtkPointData or one of its parents, I believe.
For example, for a rectilinear grid (at least) I would do:

Grid->GetPointData()->SetActiveScalars("data1");
[ . . . generate contour . . .]
Grid->GetPointData()->SetActiveScalars("data2");
[ . . . generate contour . . .]

HTH,

-tom

<snip>



More information about the vtkusers mailing list