Count vertices of faces C#

how do I get the number of the vertices per face after unweld a mesh?

.

M.Unweld(0, true);

List<int> facesVerticesCount = new List<int>();
for(int i = 0;i < M.Faces.Count;i++){
}

A = M;
B = facesVerticesCount;

221121_faceVerticesCount.gh (6.4 KB)

For a standard mesh you get the MeshFace
MeshFace mf = M.Faces[i]
if (mf.IsQuad) facesVerticesCount .Add(4);
if (mf.IsTriangle) facesVerticesCount .Add(3);

and for ngon

More simple with Ngon

 private void RunScript(Mesh M, ref object A, ref object B)
  {

    M.Unweld(0, true);

    List<int> facesVerticesCount = new List<int>();
    IEnumerable<MeshNgon> ngs = M.GetNgonAndFacesEnumerable();
    foreach (MeshNgon ng in ngs)
    {
      facesVerticesCount.Add(ng.BoundaryVertexCount);
    }
  

    A = M;
    B = facesVerticesCount;
1 Like