Help for Mesh. MergeAllCoplanarFaces API(IN GRASSHOPPER)

HI i need merge Mesh. MergeAllCoplanarFaces API(IN GRASSHOPPER) for Mesh(or SubD)
In Python C # or Rhinoscriptsyntax,…???
Is there a way for MergeCoplanarFaces Work in grasshopper as well as this performance in Rhino for( Mesh Brep and Subd)?
Of course I wrote MergeCoplanarFaces command according to the relevant API for BREPOnly!!, but does not act for Mesh and SUBD

MergeCoplanarFaces(mesh).gh (13.5 KB)

  private void RunScript(Brep Brep, ref object brep, ref object Result)
    if (null != Brep)
    { brep = Brep.MergeCoplanarFaces(RhinoDocument.ModelAbsoluteTolerance);
      Result = brep;
      brep = Brep;}


1 Like

Looks like this api hasn’t been added yet
is there another way to do it with Python vb or macro?( in grasshopper)

Perhaps MeshNgonList.AddPlanarNgons is the magic?

– Dale

private void RunScript(Mesh mesh, ref object A)
  A = mesh;
} (4.6 KB)

1 Like

thanks @Mahdiyar please fix this one

 private void RunScript(Mesh mesh, bool trimmedTriangles, bool MergFace, ref object brep)
    brep = Brep.CreateFromMesh(mesh, trimmedTriangles);
    if (MergFace == true){

AddPlanarNgons (merg coplanerMesh).gh (27.2 KB)

private void RunScript(Mesh mesh, bool trimmedTriangles, bool mergeFaces, ref object A)
  var brep = Brep.CreateFromMesh(mesh, trimmedTriangles);
  if (mergeFaces)
  A = brep;
} (10.7 KB)

1 Like