<div>I don&#39;t use vtk for rendering, but have you try to make a </div>
<div> </div>
<div>   contour.Update()</div>
<div>   print contour.GetOutput()</div>
<div> </div>
<div>before the polydatamapper, and see if the bounds of the returned polydata are correct, in order to localise if the issue is in the rendering code or in the contourfilter/reader ? <br></div>
<div class="gmail_quote">2011/2/3 Alexandr Kuzmin <span dir="ltr">&lt;<a href="mailto:kuzmin@ualberta.ca">kuzmin@ualberta.ca</a>&gt;</span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hello,<br><br>Could you please help me with the following issue:<br><br>I read my file data which contains two scalar fields with the velocity field. I want to create a contour filter to obtain a surface contour for a phase value 0.0. However, nothing works and not only for me (few of my friends tried to find a solution but without success). I tried to switch off other fields from the field data but it didn&#39;t help. Note that the same contour can be easily obtained by Paraview but not with python vtk.<br>

<br>Here is the snippet:<br>   import vtk<br>   import numpy<br><br>   gridreader = vtk.vtkXMLStructuredGridReader()<br>   gridreader.SetFileName(name)<br>   #gridreader.SetPointArrayStatus(&quot;Density&quot;,0)<br>   selection=gridreader.GetPointDataArraySelection()<br>

   selection.DisableArray(&quot;Density&quot;)<br>   selection.DisableArray(&quot;Velocity&quot;)<br>   gridreader.Update()<br><br>   grid  = gridreader.GetOutput()<br>   data  = grid.GetPointData()<br>   points=grid.GetPoints()<br>

   dims  =grid.GetDimensions()<br><br>   phase= data.GetArray(&quot;Phase&quot;)<br>   #velocity=data.GetArray(&quot;Velocity&quot;)<br><br>   contour=vtk.vtkContourFilter()<br>   contour.SetInputConnection(gridreader.GetOutputPort())<br>

   contour.SetValue(0,0.0)<br>   #contour.GenerateValues(1, (0,0.01))<br><br><br>   contourMapper = vtk.vtkPolyDataMapper()<br>   #contourMapper.SetScalarRange(phase.GetRange())<br>   contourMapper.SetInputConnection(contour.GetOutputPort())<br>

<br>   stlActor = vtk.vtkActor()<br>   stlActor.SetMapper(contourMapper)<br><br>   ren = vtk.vtkRenderer()<br>   renWin = vtk.vtkRenderWindow()<br>   renWin.AddRenderer(ren)<br>   iren = vtk.vtkRenderWindowInteractor()<br>

   iren.SetRenderWindow(renWin)<br><br>   # Add the actors to the render; set the background and size<br>   ren.AddActor(stlActor)<br>   ren.SetBackground(1.0,1.0,1.0)<br>   #ren.SetBackground(0.1, 0.2, 0.4)<br>   renWin.SetSize(500, 500)<br>

<br>   # Zoom in closer<br>   ren.ResetCamera()<br>   cam1 = ren.GetActiveCamera()<br>   cam1.Zoom(1.4)<br><br>   iren.Initialize()<br>   renWin.Render()<br>   iren.Start()<br><br>Thank you for your help,<br>Alex<br>_______________________________________________<br>

Powered by <a href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br><br>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>

<br>Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br><br>Follow this link to subscribe/unsubscribe:<br><a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>

</blockquote></div><br>