Transitioning from mesh.xml to mesh.xdmf, from dolfin-convert to meshio

Hello!

I’m having a similar problem. I have mesh.msh file generated with

gmsh mesh.geo -2 -format msh2 -o mesh.msh

And when I read it a try to create a new meshio Mesh as

mesh = meshio.read(‘mesh.msh’)
mesh.points = mesh.points[:, :2] # remove z-values to force 2d
mesh = meshio.Mesh(points=mesh.points, cells={“triangle”: mesh.cells[“triangle”]})

I got KeyValue error ‘triangle’ since mesh.cells are only ‘lines’ not ‘triangle’.

Could anybody please help me with that?

Thanks!