<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Aurelian,<br>
<br>
Thank you for advices. It didn't help though. Here is the output of
contour.GetOutput - it sees my grid but doesn't produce the contour.
Has anybody obtained contour plot with multiple scalar fields from
XMLStructuredGridReader? I can extract my scalar field as vtkArray  -
do you have advices as how to produce the contour out of it?<br>
<br>
Thank you,<br>
Alex<br>
<br>
vtkPolyData (0x2014760)<br>
  Debug: Off<br>
  Modified Time: 616<br>
  Reference Count: 2<br>
  Registered Events: (none)<br>
  Source: (none)<br>
  Information: 0x20141f0<br>
  Data Released: False<br>
  Global Release Data: Off<br>
  UpdateTime: 620<br>
  Release Data: Off<br>
  UpdateExtent: Not Initialized<br>
  Update Number Of Pieces: 1<br>
  Update Piece: 0<br>
  Update Ghost Level: 0<br>
  WholeExtent: 0, 51, 0, 51, 0, 1499<br>
  MaximumNumberOfPieces: -1<br>
  ExtentTranslator: (0x1ca8d60)<br>
  RequestExactExtent: Off<br>
   Field Data:<br>
    Debug: Off<br>
    Modified Time: 607<br>
    Reference Count: 1<br>
    Registered Events: (none)<br>
    Number Of Arrays: 0<br>
    Number Of Components: 0<br>
    Number Of Tuples: 0<br>
  Number Of Points: 0<br>
  Number Of Cells: 0<br>
  Cell Data:<br>
    Debug: Off<br>
    Modified Time: 614<br>
    Reference Count: 1<br>
    Registered Events: (none)<br>
    Number Of Arrays: 0<br>
    Number Of Components: 0<br>
    Number Of Tuples: 0<br>
    Copy Tuple Flags: ( 1 1 1 1 1 0 1 )<br>
    Interpolate Flags: ( 1 1 1 1 1 0 0 )<br>
    Pass Through Flags: ( 1 1 1 1 1 1 1 )<br>
    Scalars: (none)<br>
    Vectors: (none)<br>
    Normals: (none)<br>
    TCoords: (none)<br>
    Tensors: (none)<br>
    GlobalIds: (none)<br>
    PedigreeIds: (none)<br>
  Point Data:<br>
    Debug: Off<br>
    Modified Time: 616<br>
    Reference Count: 1<br>
    Registered Events: (none)<br>
    Number Of Arrays: 0<br>
    Number Of Components: 0<br>
    Number Of Tuples: 0<br>
    Copy Tuple Flags: ( 1 1 1 1 1 0 1 )<br>
    Interpolate Flags: ( 1 1 1 1 1 0 0 )<br>
    Pass Through Flags: ( 1 1 1 1 1 1 1 )<br>
    Scalars: (none)<br>
    Vectors: (none)<br>
    Normals: (none)<br>
    TCoords: (none)<br>
    Tensors: (none)<br>
    GlobalIds: (none)<br>
    PedigreeIds: (none)<br>
  Bounds: <br>
    Xmin,Xmax: (1, -1)<br>
    Ymin,Ymax: (1, -1)<br>
    Zmin,Zmax: (1, -1)<br>
  Compute Time: 636<br>
  Number Of Points: 0<br>
  Point Coordinates: 0<br>
  Locator: 0<br>
  Number Of Vertices: 0<br>
  Number Of Lines: 0<br>
  Number Of Polygons: 0<br>
  Number Of Triangle Strips: 0<br>
  Number Of Pieces: 1<br>
  Piece: 0<br>
  Ghost Level: 0<br>
<br>
Thank you for help,<br>
Alex<br>
<br>
On 11-02-03 02:04 AM, Aurélien Marsan wrote:
<blockquote
 cite="mid:AANLkTi=isWfR=rHv8XXaJOziyLge3=AHeWAXDQRbg8Hh@mail.gmail.com"
 type="cite">
  <div>I don'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"><<a
 moz-do-not-send="true" href="mailto:kuzmin@ualberta.ca">kuzmin@ualberta.ca</a>></span><br>
  <blockquote
 style="border-left: 1px solid rgb(204, 204, 204); 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'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("Density",0)<br>
   selection=gridreader.GetPointDataArraySelection()<br>
   selection.DisableArray("Density")<br>
   selection.DisableArray("Velocity")<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("Phase")<br>
   #velocity=data.GetArray("Velocity")<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 moz-do-not-send="true" href="http://www.kitware.com/"
 target="_blank">www.kitware.com</a><br>
    <br>
Visit other Kitware open-source projects at <a moz-do-not-send="true"
 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
 moz-do-not-send="true" 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 moz-do-not-send="true"
 href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
  </blockquote>
  </div>
  <br>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>
Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>
Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>
Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
  </pre>
</blockquote>
<br>
</body>
</html>