My guess of what that component additionally does, I might be wrong:
It extracts the naked boundaries as a closed polyline, runs the Mesh.MeshFromClosedPolyline(), converts the resulting meshes to breps and joins everything together.
Thanks, @visose, this is a promising workaround! I’m unsure if it will work 100%, since it heavily relies on what the mesher does, but for my needs it should suffice. Also, the MergeCoplanarFaces method is quite expensive, so we’ll see how that will work out for the case that the mesher returns a lot of faces.
If you’re using Rhino 6, rather than using Brep.MergeCoplanarFaces() you could run mesh.Ngons.AddPlanarNgons() on the mesh first, then loop through the ngons, get the planar boundary and create brep faces using Brep.CreateTrimmedPlane(). Unforunately Brep.CreateFromMesh() ignores ngons even if they’re planar.
This would be equivalent to running MergeCoplanarFaces() only on the patches and not on the final joined brep (if one of the patches is coplanar to the existing brep, it won’t merge them).
@visose, thanks again for your routine, i just tested it.
Unfortunately, i found that my initial example where the curve to cap exhibits only four straight segments may have been a bit too simple.
So, while the extraction of a naked boundary curve works, the mesher won’t accept the curve, since it consists of quite a lot of straight AND curved sub-curves.
Even if the curve would get meshed properly, it would consist of a lot of triangles in order to satisfy my tolerance needs. I like your idea of employing n-gons, but i have been using these already and i think they’re limited to 12 sides, besides having problems with non-convex faces.
In my opinion, it would be better to identify the curve’s two coplanar sub-parts, close each and create a breps from closed planar loops for each sub-curve.
However, that’s not really trivial, since you’d need to generate planes for each triple of successive points, rule out co-linear triples, compare all of these planes with each other, etc. etc. Or similar.