Python scripting - function returning single item as tuple

Odd situation I can’t figure out -

I have a function that takes a single multiface brep and tries to get its outer borders, flatten those, make a planar surface from them, extrude the surface and return the extrusion - which should be a single brep. In the screenshots below, you see a breakpoint just before the function returns - you can clearly see that extru is a single brep and that it will be returned.

No problem to there, but when I return to the main function, the return value is a tuple that contains the brep and not a single item (the brep itself)…

Why is my single item getting returned inside a tuple? There must be something stupid in the code, but I can’t see it…

Thanks, --Mitch

Hi Mitch,

Have you solved this? Was there a comma on the same line as the return or call statements?


No I have not… No commas - the screenshots above are WYSIWYG…

I have a couple of other projects that I need to work on first, so I haven’t gotten any further. In any case, for what I wanted to do - the function is only a part of it - things are not working correctly, so looks like I’m going to need different approach anyway. But I would be curious to understand why, I’ve never seen this happen before.


Hi Mitch,

I was curious about this and in a test here, all seems normal:

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext

def ExtrusionMethod(path,True):
    return brep.Faces[0].CreateExtrusion(path,True)

objs = rs.NormalObjects() #Only a single plane brep on xy plane in the file
brep = rs.coercebrep(objs[0])
path = Rhino.Geometry.LineCurve(Rhino.Geometry.Point3d(0,0,0),Rhino.Geometry.Point3d(0,0,10))

result_inscope = brep.Faces[0].CreateExtrusion(path,True)
print result_inscope

result_outscope = ExtrusionMethod(path,True)
print result_outscope