saving the mesh in .vol format

i am using the following script for converting the mesh from gmesh to netgen .vol but I would like to save the mesh also through my script.

from netgen.read_gmsh import ReadGmsh
from netgen.meshing import *

import the Gmsh file to a Netgen mesh object

mesh = ReadGmsh(“coarse_test”)

wrap it into an NGSolve mesh

from ngsolve import *
mesh = Mesh(mesh)
Draw(mesh)
print (“num vol elements:”, mesh.GetNE(VOL))
print (“num bnd elements:”, mesh.GetNE(BND)).

When I am using mesh.Save (“newmesh.vol”), its throwing back the following error:
Traceback (most recent call last):
File “testgmsh.py”, line 18, in
mesh.Save (“newmesh.vol”)
AttributeError: ‘ngsolve.comp.Mesh’ object has no attribute ‘Save’.

So could someone help me with saving the mesh after its converted using the script

There is a difference between the NGSolve mesh (used for FE computations) and the Netgen mesh (from the mesher). When you do

mesh = Mesh(mesh)

you convert the mesh to a NGSolve mesh, but only the Netgen mesh has the Save function. You can either call Save before this conversion or you can get the Netgen mesh from the NGSolve one by calling

mesh.ngmesh.Save("newmesh.vol")