marcomusy / vedo

A python module for scientific analysis of 3D data based on VTK and Numpy
https://vedo.embl.es
MIT License
2.03k stars 265 forks source link

Syntax error in reading a meshio.Mesh #170

Open bhaveshshrimali opened 4 years ago

bhaveshshrimali commented 4 years ago

https://github.com/marcomusy/vedo/blob/7cd9ed525ea48c66588d997ec3c612689e06bd6e/vedo/examples/other/pygmsh1.py#L28

Hi Marco, Thanks for supporting meshio imported meshes in vedo :) . In fact coincidentally I was trying to use vedo to render some of the meshes that I generated using pygmsh yesterday and stumbled across the above example. I think that the above lines would throw error with meshio-4.0.13. For instance

from vedo import show, Mesh
m2 = Mesh([mesh.points, mesh.cells['triangle']]) #this does throw an error
show(m2)

should be something like

import numpy as np
from vedo import show, Mesh
m2 = Mesh([mesh.points, np.vstack((
        cell.data for cell in mesh.cells if cell.type=="triangle"))
        ]) # this seems to render what I expect
show(m2)

and likewise. What do you think?

marcomusy commented 4 years ago

Hi Bhavesh, thanks a lot for spotting the issue and for the fixing.. I probably tested it on an old meshio version!