I try to make mesh containing two triangles to add ngon by call method AddPlanarNgons, it don’t work while it works via toolbar “Add Ngons to mesh”. Actually the method return 1, it means run successfully, but there is nothing changed in ui.
...
ObjRef[] objRefs = go.Objects();
RhinoObject rhinoObject = objRefs[0].Object();
GeometryBase geometry = rhinoObject.Geometry;
Mesh mesh = geometry as Mesh;
int faceCount = mesh.GetNgonAndFacesCount();
int number = mesh.Ngons.AddPlanarNgons(0.01);
int faceCountAfterNgon = mesh.GetNgonAndFacesCount();
MeshNgon meshNgon = mesh.Ngons.GetNgon(0);
doc.Views.ActiveView.Redraw();
Result is
faceCount = 2
number = 1
faceCountAfterNgon = 1
Rhino version:Version 7 SR13(7.13.21348.13001, 2021-12-14)
OS: Windows 10
Nuget package: 7.13.21348.13000
model is attached
two-faces-mesh.3dm (26.7 KB)