Thank you for answering me. I already tried this solution, but then it appears only the widget (sphere) but no streamlines are plotted. I can move/rotate the widget or change parameters, but nothing happens. In the VTK files there are four arrays (density, velocity, magnetic and pressure). So, from the pipeline window, in the File path menu, I selected
Cell scalars name : density Cell vectors name : magnetic The "Point" fields (scalars, vectors, tensors) are empty, I cannot select anything. However nothing happens... These are my last attempts of today. I did the following from tvtk.api import tvtk r = tvtk.UnstructuredGridReader() r.file_name = 'file001.vtk' r.update() ug = r.output mag = ug.cell_data.get_array(2) den = ug.cell_data.get_array(0) where array 2 contains the values of "magnetic" and array 0 the values of "density". I also noticed that ug.number_of_cells gives... as expected (!) the number of cells, in my case 865109L. Besides, the commands den.get_tuple1(j) mag.get_tuple3(j) give the value of density and the three components of magnetic field at position j in the number_of_cells list. I was wondering at this point, how it is possible to retrieve the position of the cells' centres. However, I would be stuck again, since in my previous cases, I knew the magnetic field components (Bx, By, Bz) on a regular grid. I did that Bxcube = Bx.reshape(res,res,res) Bycube = By.reshape(res,res,res) Bzcube = Bz.reshape(res,res,res) and then I could easily plot streamlines through fl = flow(Bxcube, Bycube, Bzcube, seed_scale=1, seed_resolution=15, seedtype = 'sphere', integration_direction='both') But now the grid is unstructured... Any other ideas? Thank you for your time spent helping me. ----- Mensaje original ----- De: Gael Varoquaux <gael.varoqu...@normalesup.org> Para: Ee Y <noctu...@yahoo.es> CC: "mayavi-users@lists.sourceforge.net" <mayavi-users@lists.sourceforge.net> Enviado: Martes 29 de enero de 2013 16:48 Asunto: Re: [MayaVi-users] Rv: Retrieve arrays from Unstructuredgrid VTK file + plotting streamlines On Tue, Jan 29, 2013 at 01:47:20PM +0000, Ee Y wrote: > from enthought.tvtk.api import tvtk > r = tvtk.UnstructuredGridReader() > r.file_name = 'file001.vtk' > r.update() from mayavi import mlab src = mlab.pipeline.open('file001.vtk') flow = mlab.pipeline.streamline(src) mlab.show_pipeline() Then use GUI to set parameters and Co. Hope this helps, Gaël ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d _______________________________________________ MayaVi-users mailing list MayaVi-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mayavi-users