RhinoCommon CreateBooleanUnion doesn’t work

Hello there,
Rhinocommon CreateBooleanUnion doesn’t work well.
I think it’s probably due to tolerance, but after trying several tolerances, the booleans on this model don’t work.
Rhinocommand’s BooleanUnion worked with this model
Does anyone have any idea what caused this?

Thanks a lot
BooleanUnion.3dm (187.0 KB) BooleanUnion.py (516 Bytes)

One of your Breps is non-manifold, So you’d better use another overload of Brep.CreateBooleanUnion that accept an option for non-manifold Breps:

import Rhino.Geometry as rg
import rhinoscriptsyntax as rs
from scriptcontext import doc
objs = rs.GetObjects("select objects")
breps = [rs.coercebrep(obj) for obj in objs]
def BooleanUnion(uBreps):
    tolerance = sc.doc.ModelAbsoluteTolerance
    newbreps = rg.Brep.CreateBooleanUnion(uBreps, tolerance, False)
    if newbreps is None or len(newbreps) != 1: 
        return sc.errorhandler()
    return newbreps[0]
brep = BooleanUnion(breps)

BooleanUnion.py (505 Bytes)

Hi, @Mahdiyar Thank you for the reply.
Its works!!
Thank you so much!!