-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while running meshfix.repair() #41
Comments
Could you share the mesh file? |
Thanks for your answer, here you go: https://www.file-upload.net/download-14873962/waxup_slm_cad.stl.html |
hey @banesullivan, can you assume what could be the issue or do i have to pass maybe another parameter to the function? best regards, |
I can reproduce a segfault on my debian linux (which is the same thing as "Windows fatal exception: access violation" in your case). Here's the snippet I used, taken from your question on Stack Overflow: import pymeshfix
import trimesh
model = trimesh.load("waxup_slm_cad.stl")
# Create object from vertex and face arrays
meshfix = pymeshfix.MeshFix(model.vertices, model.faces)
# Repair the mesh
meshfix.repair() I don't know exactly what's going on, but I've investigated a bit:
Here's the layout of execution: pymeshfix/pymeshfix/meshfix.py Lines 207 to 209 in a7f91fc
-> pymeshfix/pymeshfix/cython/_meshfix.pyx Lines 427 to 429 in a7f91fc
(note that this is before the actual repairing starts; the segfault happens during pymeshfix/pymeshfix/cython/_meshfix.pyx Lines 214 to 215 in a7f91fc
-> pymeshfix/pymeshfix/cython/meshfix.cpp Lines 319 to 320 in a7f91fc
-> pymeshfix/pymeshfix/cython/checkAndRepair.cpp Lines 310 to 323 in a7f91fc
We're getting close: the segfault happens on line 317, inside the call to pymeshfix/pymeshfix/cython/io.cpp Lines 1003 to 1004 in a7f91fc
And the final destination is pymeshfix/pymeshfix/cython/checkAndRepair.cpp Lines 128 to 169 in a7f91fc
The segfault seems to happen on line 138 of the above: pymeshfix/pymeshfix/cython/checkAndRepair.cpp Lines 136 to 138 in a7f91fc
Since I'm not familiar with the library I'm not going to try and reverse-engineer that data structure with somewhat opaque member names :) Hopefully this will help someone who knows the library figure out what's wrong. |
maybe this problem has been fixed. I didnt run into any issue loading the geometry with pyvista |
@chen112p loading the mesh is fine. What breaks is |
Got similar error, while trying to repair my mesh. Any workarounds? |
For what it's worth, I get this error nondeterministically. When using faulthandler to try to localize it, I see the following:
That line number is the point at which clean_from_arrays gets called: pymeshfix/pymeshfix/meshfix.py Lines 201 to 203 in ce69762
(Actually, I see this is the exact same problem that @adeak has already pinpointed more precisely.) |
Unfortunately segfaults inherently have a tendency to be nondeterministic. The reason for a segfault is that the process tries to access (actually, write to) memory that doesn't belong to it. When you have a minor off-by-few indexing issue you might end up addressing memory that is out of bounds for the given object (say, an array), but still within the memory allocated to your process. In this situation you can normally change the value at the corresponding memory address, so instead of a segfault you get silently corrupted state for your program (something somewhere changed accidentally). But when the referenced memory address is so far from the intended place (or when the constellation of memory allocation in a modern operating system is such) that it doesn't belong to the same process, you get the segfault. |
Hello again. I managed to avoid this problem by using pyvista like this: pv_mesh = pv.wrap(model.get_mesh())
pv_mesh.save('pyvista_mesh.ply')
tin = PyTMesh(False)
tin.load_file('pyvista_mesh.ply')
tin.fill_small_boundaries(nbe=nbe, refine=refine) P.S. |
Hey,
If i try to repair an input mesh file, the following error will follow:
i got the following pyvista Report:
The text was updated successfully, but these errors were encountered: