<div class="gmail_quote"><font face="arial, helvetica, sans-serif">I am new to VTK and would greatly appreciate help with the following question.<br><br>I have an XML Unstructured Grid data file (.vtu) which has multiple scalar DataArrays within the PointData block:<br>
<br> <font face="'courier new', monospace"><font color="#3333ff"><PointData Scalars="var_1"><br> <DataArray type="Float32" Name="var_1" format="ascii"><br>
...<br> </DataArray><br> <DataArray type="Float32" Name="var_2" format="ascii"><br> ...<br> </DataArray><br> <DataArray type="Float32" Name="var_3" format="ascii"><br>
...<br> </DataArray><br> </PointData></font></font><br><br>I can visualize the data in this file using Paraview and look at the different variables easily. I am now trying to visualize using a C++ VTK program, but the program is only displaying the first variable ("var_1"). So far I have not been able to figure out how to make VTK plot the other variables ("var_2", "var_3"). Can somebody let me know which class and function to use to change the scalar variable that is plotted. I am including portions of my C++ code to help explain what I am doing.<br>
<br> </font><font face="'courier new', monospace"><font color="#ff0000">vtkRenderer *renderer = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin->AddRenderer(renderer);<br> vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
iren->SetRenderWindow(renWin);<br><br> vtkXMLUnstructuredGridReader *reader = vtkXMLUnstructuredGridReader::New();<br> char *cfname = "vtk.vtu";<br> reader->SetFileName( cfname );<br> delete[] cfname;<br>
reader->Update();<br><br> vtkExtractUnstructuredGrid *usplane=vtkExtractUnstructuredGrid::New();<br> usplane->SetInput(reader->GetOutput());<br> usplane->SetExtent(-10,10,-10,10,-10,10);<br><br> vtkPlane *planefunction=vtkPlane::New();<br>
planefunction->SetOrigin(0.0,0.0,0.05);<br> planefunction->SetNormal(0,0,1);<br><br> vtkCutter *cutter=vtkCutter::New();<br> cutter->SetInput(usplane->GetOutput());<br> cutter->SetCutFunction(planefunction);<br>
<br> vtkPolyDataMapper *planeMapper=vtkPolyDataMapper::New();<br> planeMapper->SetInputConnection(cutter->GetOutputPort());<br> planeMapper->SetScalarModeToUsePointData();<br> planeMapper->SetScalarRange(0.0,100.0);<br>
vtkActor *planeActor=vtkActor::New();<br> planeActor->SetMapper(planeMapper);<br><br> renderer->AddActor(planeActor);<br> <br> renWin->Render();<br> iren->Start();</font></font>
<div><font face="'courier new', monospace"><font color="#ff0000"><br></font></font></div>
<div><font face="arial, helvetica, sans-serif">Thanks a lot for your help,</font></div>
<div><font face="arial, helvetica, sans-serif"><br></font></div>
<div><font face="arial, helvetica, sans-serif">Shahid Rauf.</font></div>
<div><font color="#ff0000" face="'courier new', monospace"><br></font></div><br></div><br>