vtkContour

Hello everybody,

Maybe i’m stupid but i want to display the isolines from two different scalars field. To do that i have all nodes, cells (for the mesh) and two scalars node fields store polydata object. I set the activescalar field SetActiveScalars(“Field 1”) and I use vtkContourFilter to generate the isolines for the first field and next i switch to the second field using :
polydata->GetPointData()->SetActiveScalars(“Field 2”);
The first contour disapear, only the last contour computation is visible.
Any help ?
Best regards.

It’s hard to pinpoint exactly what’s going on without seeing the whole pipeline, but my guess is that you are using the same output data object in your pipeline and the contour filter updates/overwrites your mesh when it executes on the second scalar array. Try deep copying the output to another mesh before running the second contour on that algorithm.

psuedoish code:


polydata.GetPointData().SetActiveScalars(“Field 1”);

alg = vtk.vtkContourFilter()
alg.SetInputDatObject(polydata)
alg.Update()
o1 = vtk.vtkPolyData()
o1.DeepCopy(alg.GetOutputDataObject())

polydata.GetPointData().SetActiveScalars(“Field 2”)
alg.Update()
o2 = vtk.vtkPolyData()
o2.DeepCopy(alg.GetOutputDataObject())