Hi,<div><br></div><div>I am working on my first vtk application (tcl) that I want to read a .vtu file which contains several scalar data and select one of them to be drawn in the window.</div><div><br></div><div>But for some reason I cannot see the effect I like so I wonder if anyone here can give me some pointers, thank in advance.</div>
<div><br></div><div>(I have tried to open my .vtu file in Paraview and it works so I don&#39;t think it is because of my .vtu file.)</div><div><br></div><div><br></div><div>My tcl file:</div><div>===============================================</div>
<div><div>package require vtk</div><div><br></div><div>vtkXMLUnstructuredGridReader greader</div><div>&nbsp;&nbsp; &nbsp;greader SetFileName &quot;3dfiscr02-20-M.vtu&quot;</div><div><br></div><div>&nbsp;</div><div>vtkAssignAttribute a</div><div>
&nbsp;&nbsp; &nbsp;a SetInput [greader GetOutput]</div><div>&nbsp;&nbsp; &nbsp;a Assign &quot;P0&quot; SCALARS POINT_DATA</div><div><br></div><div><br></div><div>vtkLookupTable table</div><div>&nbsp;&nbsp; &nbsp;table SetHueRange &nbsp;0 1&nbsp;</div><div>&nbsp;&nbsp; &nbsp;table SetSaturationRange 0 1</div>
<div>&nbsp;&nbsp;&nbsp;</div><div>vtkColorTransferFunction ctf</div><div>&nbsp;&nbsp; &nbsp;ctf SetColorSpaceToHSV</div><div><br></div><div>vtkDataSetMapper mapper</div><div>&nbsp;&nbsp; &nbsp;mapper SetInput [a GetOutput]</div><div>&nbsp;&nbsp; &nbsp;mapper SetLookupTable table</div>
<div>&nbsp;&nbsp; &nbsp;set datarange [mapper GetScalarRange]</div><div>&nbsp;&nbsp; &nbsp;puts $datarange</div><div><br></div><div>vtkActor actor</div><div>&nbsp;&nbsp; &nbsp;actor SetMapper mapper&nbsp;</div><div><br></div><div>vtkCamera camera</div><div>&nbsp;&nbsp; &nbsp;camera SetFocalPoint 1 1 1</div>
<div><br></div><div>vtkRenderer ren</div><div>&nbsp;&nbsp; &nbsp;ren AddActor actor</div><div>&nbsp;&nbsp; &nbsp;ren SetBackground 0 0 0</div><div>&nbsp;&nbsp; &nbsp;ren SetActiveCamera camera</div><div>&nbsp;&nbsp; &nbsp;ren ResetCamera</div><div><br></div><div>vtkRenderWindow renWin</div>
<div>&nbsp;&nbsp; renWin AddRenderer ren</div><div>&nbsp;&nbsp; renWin SetSize 500 500</div><div>&nbsp;&nbsp; renWin Render</div><div><br></div><div>vtkRenderWindowInteractor iren</div><div>&nbsp;&nbsp; iren SetRenderWindow renWin</div><div><br></div><div>iren Initialize</div>
<div><br></div><div># prevent the tk window from showing up then start the event loop</div><div>wm withdraw .</div><div><br></div></div><div><br></div><div>The structure of my .vtu file</div><div><div>===============================================</div>
<div></div><div><div>&lt;?xml version=&quot;2.0&quot;?&gt;</div><div>&lt;VTKFile type=&quot;UnstructuredGrid&quot; version=&quot;0.1&quot; byte_order=&quot;LittleEndian&quot;&gt;</div><div>&lt;UnstructuredGrid&gt;</div><div>
&lt;Piece NumberOfPoints=&quot;1718&quot; NumberOfCells=&quot;8223&quot;&gt;</div><div>&lt;Points&gt;</div><div>&lt;DataArray type=&quot;Float64&quot; format=&quot;ascii&quot; NumberOfComponents=&quot;3&quot;&gt;</div><div>
x y z</div><div>...</div><div>...</div><div>...</div><div><br></div><div><div>&lt;/DataArray&gt;</div><div>&lt;/Points&gt;</div><div>&lt;Cells&gt;</div><div>&lt;DataArray type=&quot;Int32&quot; Name=&quot;connectivity&quot; format=&quot;ascii&quot;&gt;</div>
<div>v1 v2 v3 v4</div><div>....</div><div>....</div><div>....</div><div><div>&lt;/DataArray&gt;</div><div>&lt;DataArray type=&quot;Int32&quot; Name=&quot;offsets&quot; format=&quot;ascii&quot;&gt;</div><div>4</div><div>8</div>
<div>12</div><div>16</div><div>.</div><div>.</div><div>.</div></div><div><div>&lt;/DataArray&gt;</div><div>&lt;DataArray type=&quot;UInt8&quot; Name=&quot;types&quot; format=&quot;ascii&quot;&gt;</div><div>10</div><div>10</div>
<div>.</div><div>.</div><div>.</div><div><div>&lt;/DataArray&gt;</div><div>&lt;/Cells&gt;</div><div>&lt;PointData Scalar=&quot;P0 S0 &quot;&gt;</div><div>&lt;DataArray type=&quot;Float32&quot; Name=&quot;P0&quot; format=&quot;ascii&quot;&gt;</div>
<div>159.488</div><div>.</div><div>.</div><div>.</div><div><div>&lt;/DataArray&gt;</div><div>&lt;DataArray type=&quot;Float64&quot; Name=&quot;P0&quot; format=&quot;ascii&quot;&gt;</div></div><div>0.1</div><div>.</div><div>
.</div><div>.</div><div><div>&lt;/DataArray&gt;</div><div>&lt;/PointData&gt;</div><div>&lt;/Piece&gt;</div><div>&lt;/UnstructuredGrid&gt;</div><div>&lt;/VTKFile&gt;</div><div><br></div><div><br></div><div><br></div><div><br>
</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></div></div></div></div>-- <br><a href="mailto:ckhuangf@hotmail.com">ckhuangf@hotmail.com</a><br><a href="mailto:Chung.Kan.Huang@utah.edu">Chung.Kan.Huang@utah.edu</a><br>
<a href="http://www.perc.utah.edu/Members/ckhuangf">http://www.perc.utah.edu/Members/ckhuangf</a><br><br>Office: 801-585-5594<br>Cell: 801-651-8098
</div>