pyvista / pymeshfix

Python Wrapper for MeshFix: easily repair holes in surface meshes
http://pymeshfix.pyvista.org
GNU General Public License v3.0
293 stars 29 forks source link

Segmentation fault with meshes containing 2 holes or more when trying to repair them #20

Closed AymericFerreira closed 4 years ago

AymericFerreira commented 4 years ago

I receive the error message

WARNING:root:DEPRECATED: ``.extract_edges`` is deprecated. Use ``.extract_feature_edges`` > instead.
WARNING- forceNormalConsistence: Basic_TMesh was not orientable. Cut performed.
Fatal Python error: Segmentation fault

Current thread 0x00007f212e597740 (most recent call first):
  File "/mnt/4EB2FF89256EC207/anaconda3/envs/pymesh/lib/python3.7/site- packages/pymeshfix/meshfix.py", line 164 in repair

When trying to repair these meshes with 2 holes or more, is there a way to repair this type of meshes ?

mini_mesh4.zip spinetest.zip

Thank you

akaszynski commented 4 years ago

Sorry for the almost month delay!

This has been fixed in the latest pymeshfix==0.14.1. Please upgrade with:

pip install pymeshfix --upgrade

import pymeshfix
import pyvista as pv
mesh = pv.read('mini_mesh4.ply')

cpos = [(-1.3929236007870838, 4.833749352303792, 43.20824934766468),
        (0.4005449689082239, 1.974186544303787, 42.22896653288012),
        (-0.856754747942019, -0.4527997858860601, -0.2468676888139592)]

mfix = pymeshfix.MeshFix(mesh)
mfix.plot(cpos=cpos)
mfix.repair()
mfix.plot(cpos=cpos)

sc0 sc1

mesh = pv.read('spinetest.ply')

cpos = [(1.0207721082272285, 5.022610893203265, 5.060511175630762),
        (3.5885198272032457, 1.2667712687692603, 1.113049711178362),
        (-0.9008369720007641, -0.22673492134496934, -0.3702485993480395)]

mfix = pymeshfix.MeshFix(mesh)
mfix.plot(cpos=cpos)
mfix.repair()
mfix.plot(cpos=cpos)

sc2 sc3