Hello,
I'm trying to export the mesh quality data but I have some difficulties with some processes not being released.
I followed these examples:
to get the mesh data and result objects in a script.
Here's a part of the code:
# Export mesh quality data
# Get the mesh data and result
analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
meshdata = analysis.MeshData
results = analysis.GetResultsData()
mesh_results = results.GetResult("MESH_")
mesh_results.SelectComponents(['ELEMENT_QUALITY'])
for j in range(meshdata.Elements.Count):
elem = meshdata.Elements[j]
elem_id = elem.Id
elem_type = str(meshdata.ElementById(elem_id).Type)
quality = str(mesh_results.GetElementValues(elem_id)[0])
print(quality)
The first execution of the script runs with no problem. However if the model changes for whatever reason and the solution requires to be recalculated, the script fails.
I get this error in Mechanical

and this in Workbench:
An unexpected error occurred: Failed to back up file C:\.am\Calcoli\Tests\EsportaDatiMesh\EsportaMesh_files\dp0\SYS\MECH\file.rst: Error moving file from C:\.am\Calcoli\Tests\EsportaDatiMesh\EsportaMesh_files\dp0\SYS\MECH\file.rst to C:\.am\Calcoli\Tests\EsportaDatiMesh\.EsportaMesh_files.backup\dp0\SYS\MECH\file.rst. Il processo non può accedere al file perché è in uso da un altro processo..
which translate from Italian as:
The process can't open the file because it' been used by another process
I tried to delete the object without success:
del mesh_results
del results
Ansys needs to be restarted in order to work.
I'm using Ansys 2025R1.03.
Please keep in mind I'm a mechanical engineer not a developer 😅, so i'm sorry if the solution is obvious.