# RhinoCommon Mesh Face/NGon enumeration and count

**URL:** <https://discourse.mcneel.com/t/rhinocommon-mesh-face-ngon-enumeration-and-count/220480>\
**Category:** Rhino Developer\
**Tags:** windows\
**Created:** [July 1, 2026, 8:30am UTC](https://discourse.mcneel.com/t/rhinocommon-mesh-face-ngon-enumeration-and-count/220480 "2026-07-01T08:30:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeJM](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/mikejm/32/764139_2.png) [@mikeJM](https://discourse.mcneel.com/u/mikeJM)\
**Post date:** [July 1, 2026, 8:30am UTC](https://discourse.mcneel.com/t/rhinocommon-mesh-face-ngon-enumeration-and-count/220480/1 "2026-07-01T08:30:32Z")

</div>

It seems that in some cases `Rhino.Geometry.Mesh.GetNgonAndFacesEnumerable()` also unexpectedly enumerates the internal triangles of every ngon.  
Interestingly, `Rhino.Geometry.Mesh.GetNgonAndFacesCount()` does not, as expected.

At least according to my (possibly wrong) expectations?

> **C# Example script, run via ScriptEditor, I used Rhino 8 SR32**
>
> ```csharp
> // #! csharp
> using System;
> using System.Linq;
> using Rhino;
> using Rhino.Geometry;
> 
> // some points
> var points = new Point3d[] {
> new(729, 1108, -62), new(3006, 1078, -76), new(4100, 1072, -62),
> new(7432, 1075, 75), new(11077, 1089, 264), new(0, 0, 0),
> new(3688, 470, -53), new(2116, -1861, 46), new(5797, -1334, 140),
> new(9588, -913, 518), new(7921, -3225, 600)
> };
> 
> // connect points with lines to define faces
> var lines = new LineCurve[] {
> // face 1: start with 5-sided ngon
> new(points[0], points[1]), new(points[1], points[6]),
> new(points[6], points[7]), new(points[5], points[7]), 
> new(points[0], points[5]),
> // face 2: add triangle
> new(points[1], points[2]), new(points[2], points[6]),
> // face 3: add quad
> new(points[2], points[3]), new(points[3], points[8]),
> new(points[6], points[8]),
> // face 4: add another quad
> new(points[3], points[9]), new(points[9], points[10]),
> new(points[8], points[10]),
> // face 5: add another triangle
> new(points[3], points[4]), new(points[4], points[9]),
> };
> 
> // create a mesh from the lines
> var mesh = Mesh.CreateFromLines(lines, 6, __rhino_doc__.ModelAbsoluteTolerance);
> 
> // count the faces/ngons by specific method (should correctly count 5)
> RhinoApp.WriteLine($"Mesh counts {mesh.GetNgonAndFacesCount()} ngons/faces");
> 
> // count the faces/ngons by enumeration (should incorrectly count 8)
> // somehow the 3 internal triangles of the 5-sided ngon are also enumerated
> RhinoApp.WriteLine($"Mesh enumerates {mesh.GetNgonAndFacesEnumerable().Count()} ngons/faces");
> 
> // draw mesh and lines for visual inspection
> __rhino_doc__.Objects.AddMesh(mesh);
> foreach (var line in lines)
> __rhino_doc__.Objects.AddCurve(line);
> 
> ```

---

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/772741_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [July 2, 2026, 3:30pm UTC](https://discourse.mcneel.com/t/rhinocommon-mesh-face-ngon-enumeration-and-count/220480/2 "2026-07-02T15:30:27Z")

</div>

Hi @mikeJM,

Thanks for reporting - I’ve logged the issue so a developer can review.

> **[Mesh.GetNgonAndFacesEnumerable() enumerates internal ngon faces when the ngon...](https://mcneel.myjetbrains.com/youtrack/issue/RH-96694)**
>
> https://discourse.mcneel.com/t/rhinocommon-mesh-face-ngon-enumeration-and-count/220480 It seems that in some cases Rhino.Geometry.Mesh.GetNgonAndFacesEnumerable() also unexpectedly enumerates the internal triangles of every ngon. Interestingly,...

– Dale

---

<div class="post-metadata">

**Author:** ![brian](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/brian/32/504171_2.png) [@brian](https://discourse.mcneel.com/u/brian)\
**Post date:** [August 4, 2026, 9:38pm UTC](https://discourse.mcneel.com/t/rhinocommon-mesh-face-ngon-enumeration-and-count/220480/3 "2026-08-04T21:38:58Z")

</div>

[RH-96694](https://mcneel.myjetbrains.com/youtrack/issue/RH-96694) is fixed in Rhino [BETA](https://discourse.mcneel.com/t/welcome-to-serengeti/9612)
