Mesh boolean difference resulting in sum

Hi,

I am performing a boolean difference on a sets of meshes, but as a result I get sum. Can you say what could be the reason?

Mesh.CreateBooleanDifference(meshPlate, meshHoles);

Very hard to tell what is happening here…can you post a file or some more detail about what result you are getting?

OK, so I have exported a mesh and polylines which are the base for resulting mesh. The procedure is to use polyline as a firstSet and inner contours as secondSet. As mentioned C# is used.

Example.3dm (51.1 KB)

Did you check the normals ?
Put a backface color different from front face.

So when normals are in the same direction for both sets, then I get nothing, and when normals are oposite I get a Sum. With this setting:

innerMesh.Flip(true, true, true);

I will play a bit more with the3 bools.
The other thing is, that there is no tolerance used with the Mesh.CreateBooleanDifference(meshPlate, meshHoles); which is a bit surprising for me.

@dale Can you try to help here please?

Edit:

OK, so logically thinking the Bool operation is valid only for volumes. When I use shells, then bool gives unpredictable results.

Also using mesh.Split(IEnumerable) gives the same results.

On the other hand I tried to use RH6 native method with standard settings and it also fails in each case I use it, this is how I use it.
var mesh = Mesh.CreatePatch(polyLine, RhinoMath.ToRadians(15), null, curves, null, null, false, 10);

where polyline is closed polyline and curves are valid (non null) and closed curves. Can I ask anyone for a bit of a guidance?

I believe this to be the case.

I’m not sure this the best approach, but you could always create planar surfaces with the input curves using Brep.CreatePlanarBreps. Then perform your Boolean operation.

Or, create a planar surface form the outer curve and then add the inner loops manually.

https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsCommands/SampleCsPlanarFaceLoops.cs

And, mesh the results when finished.

– Dale

Thank you for your input. Let me give you more holistic view. I am trying to import shells, which are not always flat. What is important is to represent their inner and outer contours precisely, and a patch representation doesn have to be so precise and nice looking.
I’ve discovered, that Mesh.CreatePatch could work best with what I try to achieve, however I can’t get this method to work for me.

var mesh = Mesh.CreatePatch(polyLine, RhinoMath.ToRadians(15), null, curves, null, null, false, 10);

The same command Mesh2 in Rhino 6 is working well with the same input curves. Can I ask for a bit of help with specifically this command CreatePatch(…) please?

Using the Carve library might also be a general approach forwards here (i.e. stable mesh booleans etc), there is a Rhino wrapper available by @tom_svilans.

Cheers for the shoutout!

Just to let you know, the repository for Carverino lives at: https://github.com/tsvilans/carverino

Check it out and see if it can help…

Thank you, but it’s not what I need.The bool operation made on shells was just a mistake form my side, but what I need actually is to create a shell (not flat) basing only on outer and inner contours.

I’d like to come back to this topic. @dale can I ask you for a bit of help employing the Mesh.CreatePatch methode? I am getting only null, no matter what I do.

var mesh = Mesh.CreatePatch(polyLine, RhinoMath.ToRadians(15), null, curves, null, null, false, 10);

Hi @karol_wierzbick,

I believe the problem you are seeing is that the code behind Mesh.CreatePatch is wanting points even thought the comments say they optional and they are not required for the calculation. This is a bug on our our part, which I have logged.

https://mcneel.myjetbrains.com/youtrack/issue/RH-43531

I’ve attached a simple workaround.

SampleCsMeshPatch.cs (2.1 KB)

Let me know if this helps.

– Dale

Thank you, this is working as expected for most of the meshes. Many thanks for your effort.

I can only add a comment, that whenever the mesh is halve cylinder, it starts to be messy.