# TriangulateClosedPolyline

**URL:** <https://discourse.mcneel.com/t/triangulateclosedpolyline/11395>\
**Category:** Rhino Developer\
**Created:** [September 4, 2014, 7:28am UTC](https://discourse.mcneel.com/t/triangulateclosedpolyline/11395 "2014-09-04T07:28:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![karol\_wierzbicki](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/karol_wierzbicki/32/164716_2.png) [@karol\_wierzbicki](https://discourse.mcneel.com/u/karol_wierzbicki)\
**Post date:** [September 4, 2014, 7:28am UTC](https://discourse.mcneel.com/t/triangulateclosedpolyline/11395/1 "2014-09-04T07:28:43Z")

</div>

Hi,

I get a problem with creating TriangulateClosedPolyline, the command doesn’t succeed on closed polyline, is it because the mesh can not be created for current polyline? This is what I do:

```
            if (polyLine.IsClosed)
            {
                var meshFace = polyLine.TriangulateClosedPolyline();

                Mesh mesh = new Mesh();
                mesh.Faces.AddFaces(polyLine.TriangulateClosedPolyline());
                mesh.Normals.ComputeNormals();
                mesh.UnifyNormals();
                mesh.Compact();
                doc.Objects.AddMesh(mesh);
            }

```

and it crashes on mesh.Compact();  
What could be wrong here?

---

<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:** [September 10, 2014, 3:10pm UTC](https://discourse.mcneel.com/t/triangulateclosedpolyline/11395/2 "2014-09-10T15:10:22Z")

</div>

Can you post the offending polyline?
