Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8546

Why a 2.1 document tolerance for joining breps

$
0
0

@Willem wrote:

Hi,

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)

Thanks
-Willem

def JoinSurfaces(object_ids, delete_input=False):
    """Joins two or more surface or polysurface objects together to form one
    polysurface object
    Parameters:
      object_ids = list of object identifiers
    Returns:
      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)
    scriptcontext.doc.Views.Redraw()
    return rc

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8546

Trending Articles