[vtkusers] XMLStructuredGridReader python 2 scalar phases
Alexandr Kuzmin
kuzmin at ualberta.ca
Thu Feb 3 12:19:26 EST 2011
Hi Aurelian,
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?
Thank you,
Alex
vtkPolyData (0x2014760)
Debug: Off
Modified Time: 616
Reference Count: 2
Registered Events: (none)
Source: (none)
Information: 0x20141f0
Data Released: False
Global Release Data: Off
UpdateTime: 620
Release Data: Off
UpdateExtent: Not Initialized
Update Number Of Pieces: 1
Update Piece: 0
Update Ghost Level: 0
WholeExtent: 0, 51, 0, 51, 0, 1499
MaximumNumberOfPieces: -1
ExtentTranslator: (0x1ca8d60)
RequestExactExtent: Off
Field Data:
Debug: Off
Modified Time: 607
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Number Of Points: 0
Number Of Cells: 0
Cell Data:
Debug: Off
Modified Time: 614
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 )
Pass Through Flags: ( 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
Point Data:
Debug: Off
Modified Time: 616
Reference Count: 1
Registered Events: (none)
Number Of Arrays: 0
Number Of Components: 0
Number Of Tuples: 0
Copy Tuple Flags: ( 1 1 1 1 1 0 1 )
Interpolate Flags: ( 1 1 1 1 1 0 0 )
Pass Through Flags: ( 1 1 1 1 1 1 1 )
Scalars: (none)
Vectors: (none)
Normals: (none)
TCoords: (none)
Tensors: (none)
GlobalIds: (none)
PedigreeIds: (none)
Bounds:
Xmin,Xmax: (1, -1)
Ymin,Ymax: (1, -1)
Zmin,Zmax: (1, -1)
Compute Time: 636
Number Of Points: 0
Point Coordinates: 0
Locator: 0
Number Of Vertices: 0
Number Of Lines: 0
Number Of Polygons: 0
Number Of Triangle Strips: 0
Number Of Pieces: 1
Piece: 0
Ghost Level: 0
Thank you for help,
Alex
On 11-02-03 02:04 AM, Aurélien Marsan wrote:
> I don't use vtk for rendering, but have you try to make a
> contour.Update()
> print contour.GetOutput()
> 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 ?
> 2011/2/3 Alexandr Kuzmin <kuzmin at ualberta.ca <mailto:kuzmin at ualberta.ca>>
>
> Hello,
>
> Could you please help me with the following issue:
>
> 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.
>
> Here is the snippet:
> import vtk
> import numpy
>
> gridreader = vtk.vtkXMLStructuredGridReader()
> gridreader.SetFileName(name)
> #gridreader.SetPointArrayStatus("Density",0)
> selection=gridreader.GetPointDataArraySelection()
> selection.DisableArray("Density")
> selection.DisableArray("Velocity")
> gridreader.Update()
>
> grid = gridreader.GetOutput()
> data = grid.GetPointData()
> points=grid.GetPoints()
> dims =grid.GetDimensions()
>
> phase= data.GetArray("Phase")
> #velocity=data.GetArray("Velocity")
>
> contour=vtk.vtkContourFilter()
> contour.SetInputConnection(gridreader.GetOutputPort())
> contour.SetValue(0,0.0)
> #contour.GenerateValues(1, (0,0.01))
>
>
> contourMapper = vtk.vtkPolyDataMapper()
> #contourMapper.SetScalarRange(phase.GetRange())
> contourMapper.SetInputConnection(contour.GetOutputPort())
>
> stlActor = vtk.vtkActor()
> stlActor.SetMapper(contourMapper)
>
> ren = vtk.vtkRenderer()
> renWin = vtk.vtkRenderWindow()
> renWin.AddRenderer(ren)
> iren = vtk.vtkRenderWindowInteractor()
> iren.SetRenderWindow(renWin)
>
> # Add the actors to the render; set the background and size
> ren.AddActor(stlActor)
> ren.SetBackground(1.0,1.0,1.0)
> #ren.SetBackground(0.1, 0.2, 0.4)
> renWin.SetSize(500, 500)
>
> # Zoom in closer
> ren.ResetCamera()
> cam1 = ren.GetActiveCamera()
> cam1.Zoom(1.4)
>
> iren.Initialize()
> renWin.Render()
> iren.Start()
>
> Thank you for your help,
> Alex
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com/>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110203/5e8a9ee0/attachment.htm>
More information about the vtkusers
mailing list