cnr-isti-vclab / PyMeshLab

The open source mesh processing python library
GNU General Public License v3.0
780 stars 63 forks source link

.ply export works in meshlab, but fails in PyMeshLab (with identical steps and data) #28

Closed KeithT closed 3 years ago

KeithT commented 3 years ago

The steps in MeshLab: File->Import Test0001.asc Filters->Normals, Curv....->Compuete normals for points sets (with default settings) Filters ->Remeshing..->Surface Reconstruction Screen Poisson (with default settings) File - Export Mesh Test0001.ply Generates a .ply without issues.

Doing the same from PyMeshLab by saving the filter script and then running the following python code generates a .ply that can't be opened. Meshlab reports. "Bad vertex index in face"

ms = ml.MeshSet()
ms.set_versbosity(True)
ms.load_new_mesh(filename)
ms.load_filter_script('D:\MeshLab\PointsToMesh.mlx')
ms.apply_filter_script()
tempMeshName = filename[-12:]
newMeshName = tempMeshName[0:8]
newPath = path + newMeshName + '.ply'
ms.save_current_mesh(newPath)

.asc and .mlx in attached .zip

test0001.zip

(It's great to be able to access meshlab from python, thank you for this 🥇

alemuntoni commented 3 years ago

Hi @KeithT, thanks for reporting this! We are aware of this issue: it is actually related to the double precision version of meshlab. It should be already solved (see https://github.com/cnr-isti-vclab/meshlab/issues/859 and https://github.com/cnr-isti-vclab/meshlab/pull/860), but I'll check if there are still other issues. The fix will be available in the next pymeshlab release, but in the meantime a workaround is to save the ply file without binary encoding:

ms.save_current_mesh(newPath, binary=False)

(Thanks for the feedback, very appreciated! :) )

KeithT commented 3 years ago

Great, thanks for the workaround, that worked.