Import 2d polygon mesh in .stl format

Hi, I have a 2d polygon mesh in .stl format. What’s the recommended way to import the mesh in the latest fenicsx? I read a bit about dolfin-convert in old threads. Is it still the right way to do it with Fenicsx?

Regards
JT

'dolfin-convert’ is long deprecated. To convert to a compatible format (xdmf) I would suggest using meshio.

If you have used the mesh in legacy dolfin, simply write it to xdmf with dolfin.XDMFFile.

Thanks dokken. I managed save into XDMFFile. I tried to following another post by import xdmf file as follows, but it seems no longer working for Fenicsx. Is there some changes in how mesh is imported?

mesh = Mesh()
with XDMFFile("mesh.xdmf") as infile:
    infile.read(mesh)
mvc = MeshValueCollection("size_t", mesh, 1)
with XDMFFile("mf.xdmf") as infile:
    infile.read(mvc, "name_to_read")
mf  = cpp.mesh.MeshFunctionSizet(mesh, mvc))

See Defining subdomains for different materials — FEniCSx tutorial