Mesh.Faces.RemoveZeroAreaFaces() removes all faces

When i call the function RemoveZeroAreaFaces() on a mesh, all faces are deleted.

Here is an example:

import clr
import Rhino
import scriptcontext
import System.Guid
from Rhino import *
from Rhino.Geometry import *
from Rhino.DocObjects import *
from Rhino.Commands import *
from scriptcontext import doc
import System.Guid

def RunCommand():
  
  boundingBox = BoundingBox(0, 0, 0, 10, 10, 10)
  brep = boundingBox.ToBrep();
  qualityRenderMesh = MeshingParameters.QualityRenderMesh
  meshes = Mesh.CreateFromBrep(brep, qualityRenderMesh)
  
  brep_mesh = Mesh();
  for mesh in meshes:
    brep_mesh.Append(mesh)
 
  brep_mesh.Faces.ConvertQuadsToTriangles()

  print "brep_mesh has {0} faces.".format(str(brep_mesh.Faces.Count))

  doc.Objects.AddMesh(brep_mesh);
  doc.Views.Redraw();

  fixedPartially = clr.Reference[System.Int32]()
  fixedWholly = brep_mesh.Faces.RemoveZeroAreaFaces(fixedPartially)

  print "After RemoveZeroAreaFaces faceCount={0}, fidexPartially={1}, fixedWholly={2}".format(str(brep_mesh.Faces.Count), str(fixedPartially), str(fixedWholly))

  return Result.Success


if __name__ == "__main__":
  RunCommand()

The ouput looks like this:

brep_mesh has 12 faces.
After RemoveZeroAreaFaces faceCount=0, fidexPartially=0, fixedWholly=0

Does anyone have any idea what’s going wrong?

I can repeat this - thanks.

https://mcneel.myjetbrains.com/youtrack/issue/RH-56867

– Dale

Thank you very much for your support.
As a workaround, could I simply calculate the area and delete the areas smaller than a tolerance?
I found this method on the internet.

    public static double AreaOfTriangle(Point3d pt1, Point3d pt2, Point3d pt3)
    {
        double a = pt1.DistanceTo(pt2);
        double b = pt2.DistanceTo(pt3);
        double c = pt3.DistanceTo(pt1);
        double s = (a + b + c) / 2;
        return Math.Sqrt(s * (s - a) * (s - b) * (s - c));
    }

The problem is that we cannot quickly install a new Rhino release here.