Recursive Offset Curve

python
unhandled

(Sasan Kml) #1

Hello

I want to offset a non-flatten curve several time. But I get this error message if recursive in my code be bigger than 2:

“Runtime error (TypeErrorException): Parameter must be a Guid or string representing a Guid”

here is my code:

import rhinoscriptsyntax as rs

curve_list = []

def offsetCRV(Crv,Pt,Dis,recursive):
while recursive>0:
recursive -= 1
Crv = rs.OffsetCurve(Crv,Pt,Dis)
Crv = rs.coercecurve(Crv)
curve_list.append(Crv)
offsetCRV(Crv,Pt,Dis,recursive)
offsetCRV(Crv,Pt,Dis,recursive)

offsetCurve.3dm (46.0 KB)
offsetCurve.gh (5.9 KB)

*** Crv, Pt, Dis & recursive are input from grasshopper


(David Rutten) #2

I think the problem is that OffsetCurve can return an array of curves sometimes. When that happens, Crv is no longer a single Guid.


(Sasan Kml) #3

Thank you very much David,

your guid was very helpful and i found that the output of OffsetCurve is a list, so I changed and checked my code but it returns just one item in list.offsetCRV2.3dm (45.7 KB)
offsetCRV2.gh (5.3 KB)