<div><div class="gmail_quote">On Wed, Feb 10, 2010 at 12:33 AM, Shahid Rauf <span dir="ltr">&lt;<a href="mailto:srauf106326@gmail.com">srauf106326@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<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="&#39;courier new&#39;, monospace"><font color="#3333ff">&lt;PointData Scalars=&quot;var_1&quot;&gt;<br>        &lt;DataArray type=&quot;Float32&quot; Name=&quot;var_1&quot; format=&quot;ascii&quot;&gt;<br>

          ...<br>        &lt;/DataArray&gt;<br>        &lt;DataArray type=&quot;Float32&quot; Name=&quot;var_2&quot; format=&quot;ascii&quot;&gt;<br>          ...<br>        &lt;/DataArray&gt;<br>        &lt;DataArray type=&quot;Float32&quot; Name=&quot;var_3&quot; format=&quot;ascii&quot;&gt;<br>

          ...<br>        &lt;/DataArray&gt;<br>      &lt;/PointData&gt;</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 (&quot;var_1&quot;).  So far I have not been able to figure out how to make VTK plot the other variables (&quot;var_2&quot;, &quot;var_3&quot;).  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="&#39;courier new&#39;, monospace"><font color="#ff0000">vtkRenderer *renderer = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin-&gt;AddRenderer(renderer);<br>
 vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>
 iren-&gt;SetRenderWindow(renWin);<br><br> vtkXMLUnstructuredGridReader *reader = vtkXMLUnstructuredGridReader::New();<br> char *cfname = &quot;vtk.vtu&quot;;<br> reader-&gt;SetFileName( cfname );<br> delete[] cfname;<br>

 reader-&gt;Update();<br><br> vtkExtractUnstructuredGrid *usplane=vtkExtractUnstructuredGrid::New();<br> usplane-&gt;SetInput(reader-&gt;GetOutput());<br> usplane-&gt;SetExtent(-10,10,-10,10,-10,10);<br><br> vtkPlane *planefunction=vtkPlane::New();<br>

 planefunction-&gt;SetOrigin(0.0,0.0,0.05);<br> planefunction-&gt;SetNormal(0,0,1);<br><br> vtkCutter *cutter=vtkCutter::New();<br> cutter-&gt;SetInput(usplane-&gt;GetOutput());<br> cutter-&gt;SetCutFunction(planefunction);<br>

 <br> vtkPolyDataMapper *planeMapper=vtkPolyDataMapper::New();<br> planeMapper-&gt;SetInputConnection(cutter-&gt;GetOutputPort());<br> planeMapper-&gt;SetScalarModeToUsePointData();<br> planeMapper-&gt;SetScalarRange(0.0,100.0);<br>

 vtkActor *planeActor=vtkActor::New();<br> planeActor-&gt;SetMapper(planeMapper);<br><br> renderer-&gt;AddActor(planeActor);<br> <br> renWin-&gt;Render();<br> iren-&gt;Start();</font></font> 
<div><font face="&#39;courier new&#39;, 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="&#39;courier new&#39;, monospace"></font></div></div></blockquote></div><br></div><div>I believe you can use</div><div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; font-size: 13px; border-collapse: collapse; color: rgb(255, 0, 0); ">usplane-&gt;GetPointData()-&gt;SetActiveScalars(&quot;var_2&quot;);</span></div>
<div><font class="Apple-style-span" color="#FF0000" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="border-collapse: collapse;"><br><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: arial; ">Please let us know if that does the trick.</span><br>
</span></font><div><font class="Apple-style-span" color="#FF0000" face="&#39;courier new&#39;, monospace"><span class="Apple-style-span" style="border-collapse: collapse; "><br clear="all"></span></font>Thanks,<br><br>David</div>
</div>