Skip to content
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

suggestion: change error to a warning in boolean operations #358

Open
XuliaDS opened this issue Jan 18, 2024 · 0 comments
Open

suggestion: change error to a warning in boolean operations #358

XuliaDS opened this issue Jan 18, 2024 · 0 comments

Comments

@XuliaDS
Copy link

XuliaDS commented Jan 18, 2024

Hi:
Every time two meshes have empty intersection or one mesh is inside the other, pymeshlab raises an exception: "vertex matrix is empty", killing the program.
In my opinion, the error is too harsh... It should raise a warning saying "empty intersection", etc. and create an empty mesh. For some usage, one may want to compare two meshes to see their relative position, etc. rather than actually using the resulting boolean mesh.
I did a dirty wrap around my boolean call:

try:
    ms.generate_boolean_difference(first_mesh=obj1, second_mesh=obj2, transfer_face_quality=transfer)
except:
    msg=f" Object {obj1} is completely inside of object {obj2}. Boolean difference is empty "
    logging.warning(msg)
    return -1

and similarly for the intersection

try:
    ms.generate_boolean_intersection(first_mesh=obj1, second_mesh=obj2, transfer_face_quality=transfer)
except:
    msg = f" Object {obj1} does not intersect with object {obj2}. Boolean intersection is empty "
    logging.warning(msg)
    return -1

In my case, I have a dictionary with names associated with meshes ID: eg. obj["cube"] = 1. so then know that when I get obj["m1_vs_m2"] = my_boolean(obj[m1], obj[m2], "DIFFERENCE")
obj["m1_vs_m2"] == -1,
it was an empty operation but the algotirhm doesn't end there.

Probably there are better fixes... Or maybe nobody finds this useful...

Cheers,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant