# How to boolean union closed 2D curves within same bezier object with geometry nodes?

I'm working with a number of closed 2D curves within the same Bezier object and I've created a simple Geometry Nodes setup to preview them filled and extruded while keeping them editable at the same time. When the curves intersect the default behaviour is that the overlapping faces get deleted. Is there a way to change this to automatically perform a boolean union on all intersecting parts?

I've tried playing around with the mesh island and mesh boolean nodes but couldn't change the result.

• Good question. But I'm afraid that there is (currently) no simple solution to this problem. Would you be happy with a less simple answer? Mar 16, 2023 at 0:10
• Yes, good thing with GN is that once we've got the solution we can pack it into a node group and reuse it any time (hide the complex stuff and enjoy the result). I'm sure this is something I'd use in the future more. Also in my case I'm not using an impossibly big number of intersecting curves so I'd be interested in a "merging them one by one" solution too as a less beautiful solution. Mar 16, 2023 at 8:39

There are several possibilities here, but since I don't know exactly what you want to do with the result, I suggest the following solution:

The first hurdle is that Fill Curve always creates holes when the curves are intersecting, but the splines cannot be completely converted to filled curves separately at the same location.

To work around this problem, first move all curves along the X or Y axis using the Spline Index so that they are far apart.

This allows you to apply Fill Curve to them without creating holes. You could also create Mesh Primitives in such a case, and move their points to the positions of the curve points, but that seemed more complicated to me.

Now that you have filled each curve completely, you can move them back to their original positions. With that, you've solved the first hurdle.

The second hurdle is that the faces still overlap, so you can't create a solid mesh.

To remove these areas, use the Mesh Boolean node and send a raycast to a duplicate of the object, which you scale by a factor of $$0.9999$$. This will detect the inside edges, which can then be removed. The remaining points should be merged with Merge by Distance to create a continuous mesh line.

Finally, you only have to convert this object into a curve and fill it again with Fill Curve. After that, this shape can be extruded into a solid object.

(Blender 3.4+)

• wow, this sounds like a very clever solution - please allow me some time to examine and understand it in detail and I'll be definitely back, reacting to it. Mar 20, 2023 at 10:49
• @Booth You're welcome! Take your time and if you have any questions, I'll be happy to help. Mar 20, 2023 at 11:26
• This works perfectly! I studied the node setup along with your description and I fully understand the concept. The technical part of removing excess edges was a bit harder as I don't have a solid knowledge of selection techniques. I was surprised in the first place that the mesh boolean node offers no easy way to remove excess.. The manual syis "Union: The two input meshes are joined, then any interior elements are removed" + there's also an intersecting edges output. I suppose these don't work because we're operating within the same object? Mar 22, 2023 at 10:22
• @Booth Not exactly: The Intersecting Edges at Mesh Boolean select these edges, which are newly created by the boolean operation. But since in this case only new vertices are created at the intersecting edges of the curves, this does not work in this case. So it has more to do with the fact that this is a two-dimensional shape instead of a three-dimensional one. And since all shapes are on the same plane, Union does not remove any interior elements. Mar 22, 2023 at 11:49

Just adding to this, perhaps you want to separate the Curves before Fill, so it does not "Compound" so this might be simpler logic. But you do want "compound curve" that overlaps, so that's also something to consider.

However the BOOLEAN thing might be best.

• Ah, that's a good idea! ..at the time I wrote the answer (3.4) the node Split to Instances didn't exist yet. May 6 at 10:26