wolph / numpy-stl

Simple library to make working with STL files (and 3D objects in general) fast and easy.
http://numpy-stl.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
624 stars 105 forks source link

mesh not closed warning message not relevant in various case. #86

Closed usrpy closed 6 years ago

usrpy commented 6 years ago

Hello WoLpH, Thanks for the great job !

The warning message here after, seems often to appear even when the mesh is closed.

Your mesh is not closed, the mass methods will not function correctly on this mesh. For more info: https://github.com/WoLpH/numpy-stl/issues/69

This was confirmed using AdMesh python3-admesh (from ubuntu synaptic) version 0.98.8-1 (bionic) use to check mesh quality. Counter-check was also done from other professional soft.

note : python 3 script of admesh command line can be shared.

Does it would be possible to improve the warning reliability or let the choice to deactivate it when mesh quality is checked previous its use by another way.

Best regards usrpy

wolph commented 6 years ago

It's definitely possible to improve the warning, right now it's a rather simple check which should work in most cases but I could be mistaken.

Perhaps @Uvar can help?

As for temporarily disabling the warning, the only way right now would be to decrease the logging level:

import logging

# decrease loglevel
your_mesh.logger.setLevel(logging.ERROR)

# do your thing here

# increase loglevel again
your_mesh.logger.setLevel(logging.INFO)
usrpy commented 6 years ago

Hello WoLpH, Thanks for your helpful answer, Python 3.6.5, trials seems not to solve the issue : remove INFO message.

But the following way works properly.

# getLogger argument is the name of the imported module ; and in the present case imported module is     stl.

logging.getLogger("stl").setLevel(logging.ERROR)
logging.getLogger(stl.__name__).setLevel(logging.ERROR)     works as well,
Best regards
usrpy commented 6 years ago

(sorry copy past leads huge police size)

Uvar commented 6 years ago

Some more info can be found in the discussion of #74 .

To avoid arbitrary numerical precision issues, one could just exhaustively check whether every v0-v1, v1-v2 and v2-v0 pair (hence edges) appear exactly once and have exactly 1 corresponding v1-v0, v2-v1 or v0-v2 pair.

If this condition is not met, there is at least 1 flaw in the mesh.