IntersectBreps() Error

Hi,

I got an error with this simple code -

def test():
    box = AddBrepBox(-5000, -5000, 0, 10000, 10000, 10000)
    if box is None: return
        
    planesrf = rs.AddPlaneSurface( rs.WorldXYPlane(), 100000.0, 50000.0 )
    rs.TransformObjects( planesrf, rs.XformTranslation([-10000,-25000,1000]), False )
    
    curves = rs.IntersectBreps( box, planesrf )

The error msg I got is -
unable to convert Success into Brep geometry

Any ideas? Many thanks for help!

–Max

Your code is incomplete - where is your AddBrepBox function?

Please post complete code that we can test. You can upload Python files. When editing a post, click the “Upload” button.

– Dale

Sorry, here’s the definition of AddBrepBox -

def AddBrepBox(x0, y0, z0, l, w, h):
pt0 = Rhino.Geometry.Point3d(x0, y0, z0)
pt1 = Rhino.Geometry.Point3d(x0+l, y0+w, z0+h)
box = Rhino.Geometry.BoundingBox(pt0, pt1)
brep = box.ToBrep()
rc = Rhino.Commands.Result.Failure
if( scriptcontext.doc.Objects.AddBrep(brep) != System.Guid.Empty ):
    rc = Rhino.Commands.Result.Success
    scriptcontext.doc.Views.Redraw()
return rc

I found the problem - what AddBrepBox returns is not the object, but a status. Thank you Dale.