How to create surface mesh from intersection of plane and mesh

I am trying to use a plane to slice through a geometry, and generate a new mesh for the surface that represents the intersection of the plane and the geometry. I am using a clipping plane and getting the clipping plane surface plane. I then use the Mesh.CreateContourCurves method to get an array of curves from the intersection of the plane and the mesh. I then use the Brep.CreatePlanarBreps method to create a collection of breps from those curves, and finally create a mesh using the Mesh.CreateFromBrep method. Sometimes however, I do not get the mesh I expect.

The intersection of the geometry and the clipping plane look correct (there are 5 curves outlined in black, the clipping plane is in yellow).

When I add the output of the Mesh.CreateContourCurves method to the document to visualize the curves, those curves look correct.

But the mesh that is created does not have the expected holes.

I have attached the geometry also. Is this the correct way to create a mesh from the intersection of a plane and a mesh? Any ideas why the mesh that is created is not as expected?
connecting_rod_assembly.3dm (490.0 KB)

Hi @Paul_Novak,

without seeing your code it’s hard to know why it fails. Below is an example python script how i would obtain the planar mesh from the section.

It creates an intersection with the clipping plane and the brep, then creates planar breps from the intersection curves which are meshed. You can run this using _EditPythonScript and your file.

MeshClippingPlaneBrepIntersection.py (1.3 KB)

There are many ways. Imho i would not rely on any mesh operation if it can be avoided. btw. there is also GetFillSurfaces which gives the planar breps without using Intersection.BrepPlane
_
c.

Thanks for the sample code and pointers, especially to the Intersection.MeshPlane and Intersection.BrepPlane methods.