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 giveFalse
for curves with a wid gap (like the5.0
you have). - In your first sample you typo
cCrv
asccCrv
in theelse
-block. This typo makes you end up withNone
/null
, since theIsClosable
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