Why a 2.1 document tolerance for joining breps


What is the reasoning behind allowing a tolerance of ModelAbsoluteTolerance * 2.1 in pythons JoinSurfaces method? Is this the tolerance for the Join command as well?

I ask because I’m scripting the Brep.MergeCoplanarFaces(tolerance) method and want to set a tolerance in order for it to work as expected based on tolerance settings.

Do I best set a tolerance multiplied by 2.1 as well? Brep.MergeCoplanarFaces (ModelAbsoluteTolerance * 2.1)


def JoinSurfaces(object_ids, delete_input=False):
    """Joins two or more surface or polysurface objects together to form one
    polysurface object
      object_ids = list of object identifiers
      identifier of newly created object on success
      None on failure
    breps = [rhutil.coercebrep(id, True) for id in object_ids]
    if len(breps)<2: return scriptcontext.errorhandler()
    tol = scriptcontext.doc.ModelAbsoluteTolerance * 2.1
    joinedbreps = Rhino.Geometry.Brep.JoinBreps(breps, tol)
    if joinedbreps is None or len(joinedbreps)!=1:
        return scriptcontext.errorhandler()
    rc = scriptcontext.doc.Objects.AddBrep(joinedbreps[0])
    if rc==System.Guid.Empty: return scriptcontext.errorhandler()
    if delete_input:
        for id in object_ids:
            id = rhutil.coerceguid(id)
            scriptcontext.doc.Objects.Delete(id, True)
    return rc

Think of the tolerance as the radius of an uncertainty pipe along the edges. This means that, when joined, the two pipes should overlap. This is only possible, in general, when the join tolerance is larger than 2 times the radius of the pipes, hence the factor of 2.1.

1 Like