brep.MergeCoplanarFaces out of tolerance


I’m running into an issue with brep.MergeCoplanarFaces
The attached black polysurface is slightly kinked, but apparently enough to allow for the 2 faces to be regarded coplanar.

However after merging the faces the trimming edges are out of tolerance:

If I brep.Repair the merged brep I do get correct trimming edges, however there is a deviation of the initial surface of 0.459 which exceeds the file tolerance.

However , the Command _MergeFace will correctly state :
“Unable to move edges within face tolerance, nothing done”

How do I go about making sure the merger was within tolerance?
Should I check edge deviations myself or am I missing some additional RhinoCommon functionality?
What coplanarity tolerance is used?


below example file and script

merge_coplanar.3dm (48.2 KB)

import rhinoscriptsyntax as rs
import scriptcontext as sc

obj = rs.GetObject('select brep ro merge coplanars')
if obj:
    brep = rs.coercebrep(obj)
    tolerance = sc.doc.ModelAbsoluteTolerance
    id = sc.doc.Objects.AddBrep(brep)
    rs.ObjectColor(id ,  [255,0,0] )
    brep.Repair(tolerance)#make sure the edges are correct
    id = sc.doc.Objects.AddBrep(brep)
    rs.ObjectColor(id ,  [20,255,0] )

Hi @Willem,

Well, I know the command checks both faces and loop for tolerance. I’m not sure how to help, right now in this, case.

– Dale

1 Like

Hi Dale,

Thanks for your answers. At least I’m sure we did not miss something. I might revert to a scripted command untill I’ve implemented my own deviation check.


Hi @rajaa, Is there any news on this issue:

I ask because I might need to write my own tolerance check if a solution from your side will not be available in the near future.

Thanks Willem

@Willem this is close to the top on my list.

Great! thanks for the quick reply.


RH-46914 is fixed in the latest Service Release Candidate

1 Like