Possible to get the resultant mesh from a mesh difference?

Hi,

I’m trying to find a way to get the the resulting mesh of a boolean difference and calculate the area of that mesh from Grasshopper. This is so I can average how much paint I need for each 3D printed mold piece.

In Rhino it’s easy, I can take a mesh and difference it from another mesh then use the “Extract Mesh Part” to get the extracted mesh. This doesn’t always work though on some models especially with straight edges and fails. See pic.

ExtractMeshPart command here:
http://docs.mcneel.com/rhino/5/help/en-us/commands/extractmeshfaces_commands.htm

I can use this to extract the part but it still fails with other meshes with sharp sides or steps.

private void RunScript(Mesh InMesh, ref object OutMeshes)
{
OutMeshes = InMesh.ExplodeAtUnweldedEdges();
}

Is there an equivalent way to accomplish this in Grasshopper or API call from C#/script?

What exactly is the mesh difference doing for you here that Mesh Split or Mesh Boolean Split wouldn’t? Using a mesh plane instead of box, this way you don’t need to extract.

http://docs.mcneel.com/rhino/5/help/en-us/commands/meshsplit.htm
http://docs.mcneel.com/rhino/5/help/en-us/commands/meshbooleansplit.htm

Hi Michael,

Thank you for the suggestions.

Mesh boolean split works on the bunny model but makes closed meshes on the simple objects box, spline tube, cone.

Mesh boolean difference works great on the simple models but fails on the bunny model in some instances unless I make a very high poly plane. The simple models still have edge cases where sharp edges wouldn’t be extracted.

The goal is to automate and run multiple mesh models through Grasshopper to consolidate the mesh from each mold into a final tally.

I kept getting mixed results from testing the mesh difference and split so I went through and made a script to accomplish the goal. While this may be a narrow use case I attached it so if someone else runs into a similar need.ExtractDifference.gh (2.0 MB)