Best mesh boolean method in the west

Hi,

I’m sharing a COMPAS_CGAL mesh boolean method for Rhino.

Mesh booleans are often problematic and rarely work in all cases, especially when meshes are cut multiple times. CGAL has recently reworked its mesh boolean methods, and I’ve ported them for Python users.

The problem often comes not from the boolean methods themselves, but from the imprecise numerical representation of meshes. CGAL uses an exact kernel that represents numbers as fractions, helping to avoid self-intersections caused by numerical inaccuracies. Additionally, passing mesh data back and forth between C++, .NET, and Python can further reduce precision.

The method below sends all meshes at once, executes a chain of mesh boolean operations, and returns the result to Rhino. The command selects meshes, welds and triangulates them, and then asks which sequence of operations you want to apply to all meshes: “Union,” “Difference,” “Intersection,” or “Xor.”

I’ve attached two scripts: one performs the boolean operations, and the other keeps track of the indices of the original mesh objects, displaying them with colors.

Hope this helps some of you. If you encounter any cases where mesh booleans fail, please let us know.

The script should run out of the box, thanks to the ScriptEditor PyPI @eirannejad infrastructure.

example_rhino_boolean_chain_color_exploded.py (5.3 KB)

example_rhino_boolean_chain.py (4.7 KB)

14 Likes