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)

  • Hi. I’ve tried a lot of different methods to create a correct boolean Union, and so far, this is the best thing I’ve found * ManifoldNET more stable performance and speed. especially when it comes to planar (intersections).

Test.3dm (8.6 MB)

ManifoldNET.zip (702.1 KB)

The mesh boolean you are using in Grasshopper was an old CGAL method. The problem there was that Rhino uses double types at the core of its kernel, so when you do boolean operations, the meshes self-intersect. For intersections and booleans, you never want to use imprecise numbers — it’s the same problem Clipper solves for 2D booleans.

In CGAL 6.1, the mesh booleans were rewritten, which solves all the issues you see in your video. I know Manifold too, but right now I really like CGAL 6.1 for its reliability.

Can you recommend a tool for fixing self-intersections?

This is the reason I made this post:

I also wrapped manifold to compas / python:

Both are great mesh boolean, solutions: