GH Python - How to get out result from function?

Several issues

  • you coerce the input parameter to a curve, but then use that as argument to rhinoscriptsyntax methods. Those methods take the GUID of the curve instead of the actual curve
  • You use negative tolerance
  • You need to give the tolerance also to IsClosable, otherwise the document tolerance or zero tolerance is used. That will give False for curves with a wid gap (like the 5.0 you have).
  • In your first sample you typo cCrv as ccCrv in the else-block. This typo makes you end up with None/null, since the IsClosable test fails.

Here my version with direct curve usage:

import rhinoscriptsyntax as rs

ooCrv = rs.coercecurve(oCrv)

if not ooCrv.IsClosed  and ooCrv.IsClosable(tol):
    if ooCrv.MakeClosed(tol):
        cCrv = ooCrv
else:
    cCrv = oCrv