# Mesh boolean difference operation problem

**URL:** <https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054>\
**Category:** Rhino Developer\
**Created:** [September 3, 2020, 12:17pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054 "2020-09-03T12:17:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabiopasquarell](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fabiopasquarell/32/164703_2.png) [@fabiopasquarell](https://discourse.mcneel.com/u/fabiopasquarell)\
**Post date:** [September 3, 2020, 12:17pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/1 "2020-09-03T12:17:12Z")

</div>

Hi everybody.  
I came through this problem and I can’t figure out what’s wrong with the input.  
In the attached file I try to make a boolean difference, subtracting the blue items from the red one.  
I tried using Mesh.CreateBooleanDifference in my plugin, I tried both subtracting single blue items and a list of the two blue items.  
Looks like the first difference succeeds while the second is completely missed.  
I tried manually on Rhino as well getting the same result.  
I think the problem lies in the input but all the objects look fine to me, correct normals etc.  
Can anybody please help me out with this ?  
Thank you!  
f

[developer\_rhino.3dm](https://discourse.mcneel.com/uploads/short-url/954uCvhjF2Rmmwmo082R2t1QNn8.3dm) (235.1 KB)

---

<div class="post-metadata">

**Author:** ![johnharding](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/johnharding/32/490155_2.png) [@johnharding](https://discourse.mcneel.com/u/johnharding)\
**Post date:** [September 3, 2020, 12:39pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/2 "2020-09-03T12:39:42Z")

</div>

Hi Fabio,

Mesh booleans are notoriously difficult to work if you have triangles in plane. Generally, you want to have two distinct bodies before conducting an operation. At the moment your two blue meshes have parallel base and top planes… but there is a way to workaround this.

Firstly, scale one of your blue meshes so that the top and bottom planes do not align with the other. Then boolean union them. Then chop the base of this new thing (5 units down as per your 3dm file). Then finally, use this to subtract with when conducting the mesh boolean difference. There might be other elaborate ways to do the same thing as this, but generally avoiding these difficult in-plane mesh triangle operations is something to strive for.

 ![meshBooleans](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/0/2/022a13b9e6dc384d29f0c1a8a704b09852b47691.png)

[developer\_rhino\_edit.3dm](https://discourse.mcneel.com/uploads/short-url/3EJAU1PSHPsSnfD0UFMIj8tTe9i.3dm) (410.2 KB)

Hope this helps,

John.

---

<div class="post-metadata">

**Author:** ![fabiopasquarell](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fabiopasquarell/32/164703_2.png) [@fabiopasquarell](https://discourse.mcneel.com/u/fabiopasquarell)\
**Post date:** [September 3, 2020, 3:02pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/3 "2020-09-03T15:02:50Z")

</div>

Hi John,  
thank you so much for the hint. I’ll rethink my code chunk in the light of this workaround.  
Cheers 🙂

---

<div class="post-metadata">

**Author:** ![piac](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/piac/32/769366_2.png) [@piac](https://discourse.mcneel.com/u/piac)\
**Post date:** [September 3, 2020, 3:07pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/4 "2020-09-03T15:07:44Z")

</div>

Hi @fabiopasquarell

If you use Rhino 7 WIP, you could use MeshSplit commands. However, MeshBoolean\* are still the same as in Rhino 6 for now. See more at [New Mesh Intersection Milestones](https://discourse.mcneel.com/t/new-mesh-intersection-milestones/88387).

---

<div class="post-metadata">

**Author:** ![fabiopasquarell](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fabiopasquarell/32/164703_2.png) [@fabiopasquarell](https://discourse.mcneel.com/u/fabiopasquarell)\
**Post date:** [September 3, 2020, 3:20pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/5 "2020-09-03T15:20:48Z")

</div>

Hi Giulio,  
I’m working with Rhino 6 at the moment since the plugin I’m developing works on that version… I’ll check the new functions on the WIP.  
Thank you!  
f

---

<div class="post-metadata">

**Author:** ![fabiopasquarell](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fabiopasquarell/32/164703_2.png) [@fabiopasquarell](https://discourse.mcneel.com/u/fabiopasquarell)\
**Post date:** [September 4, 2020, 2:34pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/6 "2020-09-04T14:34:49Z")

</div>

Hello John,  
since you’ve provided a good workaround for my problem yesterday, I try my luck, maybe you’ve a good hint for this too… I’m trying to cut my teeth on mesh geometries.  
This time I’m trying to create a union of the two on the attached file, but the result is pretty bizarre…  
Any idea?  
Thank you!  
f

[mesh\_union.3dm](https://discourse.mcneel.com/uploads/short-url/2M6xwMT7ei68ghfz8jWE02zcE9o.3dm) (176.0 KB)

---

<div class="post-metadata">

**Author:** ![johnharding](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/johnharding/32/490155_2.png) [@johnharding](https://discourse.mcneel.com/u/johnharding)\
**Post date:** [September 4, 2020, 4:16pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/7 "2020-09-04T16:16:15Z")

</div>

My best advice would be to work on the quality of the initial mesh. The ones you are using look pretty _nasty_ to be honest and are likely to result in errors. This is the stuff of Giulio’s nightmares:

 ![nastyMesh](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/2/f/2f84dbf8b67c804238d239039387aced808a928e.jpeg)

Anyway, I tried just redrawing the top curves and extruding to make capped solids (a). Solid boolean worked fine (b). Then I tried by meshing these solids first (c ) and using the mesh boolean union which when offset, also worked fine (d).

 ![meshBoolean](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/e/5/e5f023b17ae13c69be13ae8661dba981322d86a2.jpeg)

[mesh\_union\_edit.3dm](https://discourse.mcneel.com/uploads/short-url/rsyXV0pyG1IqzX5xb8NUEixpim3.3dm) (431.7 KB)

So my point stands, I hope you can find a way to create some cleaner initial geometry, otherwise I can’t think of anything else that will work if I’m honest.

John.

---

<div class="post-metadata">

**Author:** ![fabiopasquarell](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fabiopasquarell/32/164703_2.png) [@fabiopasquarell](https://discourse.mcneel.com/u/fabiopasquarell)\
**Post date:** [September 7, 2020, 7:14am UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/8 "2020-09-07T07:14:01Z")

</div>

Hello John,  
thank you for your explanation, it’s pretty clear.  
I do the same, creating capped extrusions starting from top curves and meshing them using these parameters:

 ![discourse](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/a/3/a321a6bec904d08624d355053243d52c268195a0.jpeg)  
Is there something wrong with these parameters in your opinion?  
My problem is that I’m working with an iteration on boolean unions, so I try to boolean union of a freshly meshed extrusion with the result of a previous boolean meshing and so on.  
I wonder if the nasty mesh comes from a previous boolean union operation (the tallest one in my example).  
If so, it would be a problem…  
Any ideas?  
Thank you!  
f

---

<div class="post-metadata">

**Author:** ![johnharding](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/johnharding/32/490155_2.png) [@johnharding](https://discourse.mcneel.com/u/johnharding)\
**Post date:** [September 7, 2020, 10:25am UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/9 "2020-09-07T10:25:48Z")

</div>

After you draw (or extract it), try _rebuilding_ the top curve with say, 100 points.  
Then extrude the curve down and finally mesh (I just used the ‘more polygons’ in the simple settings to be honest).

---

<div class="post-metadata">

**Author:** ![fabiopasquarell](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fabiopasquarell/32/164703_2.png) [@fabiopasquarell](https://discourse.mcneel.com/u/fabiopasquarell)\
**Post date:** [September 8, 2020, 12:19pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/10 "2020-09-08T12:19:34Z")

</div>

Hi John,  
yes it’s an option, I’ll surely try rebuilding the curves… what we’re trying to do is finding a way of simulating some material removal, progressively subtracting shapes from a base stock shape… maybe this means pushing Rhino a bit too far… we don’t know if anyone already tried this…  
Thank you  
f

---

<div class="post-metadata">

**Author:** ![johnharding](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/johnharding/32/490155_2.png) [@johnharding](https://discourse.mcneel.com/u/johnharding)\
**Post date:** [September 8, 2020, 5:18pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/11 "2020-09-08T17:18:22Z")

</div>

There was this thread recently, albeit with BReps rather than meshes:

> [@Solid Difference](https://discourse.mcneel.com/t/solid-difference/107924/13):
>
> I’ve never tried to make a tool path using Grasshopper before. Don’t like Anmeone though (component-to-component iterations quite slow) so I tried using the Slider animation instead, and expanding a horizontal Pipe along the curve (evaluating a new extended sub curve at each anim step), then split off upper part of the pipe, keeping only the lower half, then extruding the edges upwards, and Boolean Difference the full “tool path” at each step. Looks a bit smoother than “dip cutting” at each step…

I would also use solids if I were doing this, but granted I’m not sure of your constraints.

---

<div class="post-metadata">

**Author:** ![fabiopasquarell](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/fabiopasquarell/32/164703_2.png) [@fabiopasquarell](https://discourse.mcneel.com/u/fabiopasquarell)\
**Post date:** [September 10, 2020, 1:36pm UTC](https://discourse.mcneel.com/t/mesh-boolean-difference-operation-problem/108054/12 "2020-09-10T13:36:22Z")

</div>

John,  
this looks really interesting… we’ll get through the gh solution and see what we can do.  
Thanks, much appreciated  
f
