BrepFace.GetMesh() returns null

Hello,

So I was following a discourse post about getting cached meshes from Breps and saw this post from @dale

Im working in a Rhino plugin were I need quick access to the mesh representation of my Breps, so I can send them to PostDrawing events. I was using Mesh.CreateFrom Brep but it was showing heavy performance issues.

However my Breps are not hosted in Rhino Objects, and the BrepFaces meshs are returning null, just like spotted in this post

There is anyway I can store cached meshes in my Breps that are not part of a Rhino Object?

Assigned to Developer category

Yes, use BrepFace.SetMesh.

– Dale

So Anyway I need to provide a generate mesh right?

What if instead of call DrawMesh I call DrawBrep in my PostDrawing event? This cached mesh behaviour is exposed when I do this or DrawBrep will always force the generation of a new mesh?

Yes, use Mesh.CreateFromBrep for this. The results will contain a mesh for every Brep face.

If you want something shaded, then that’s an option. DrawBrep will not generate a mesh for you.

– Dale