GHPython: PolyCurve is not iterable

This is normal when using treehelpers with simplified trees (no common root branch).

See explanation here:

And here:
https://gist.github.com/piac/ef91ac83cb5ee92a1294#gistcomment-3763417

Original code works with these changes (and changing input type hint to ghdoc as @efestwin pointed out):

import ghpythonlib.treehelpers as th
import rhinoscriptsyntax as rs

crv = th.tree_to_list(crv, lambda crv: crv)

a = []

for i,branch in enumerate(crv):
    
    for j,item in enumerate(branch):
        if rs.IsCurveClosed(item):
            bool = "closed"
            a.append(item)
        else:
            bool = "periodic"
            pts = list(rs.CurveEditPoints(item))
            pts.append(pts[0])
            a.append(rs.AddInterpCurve(pts,1,2))

ghpython_err_210912a.gh (493.1 KB)

-Kevin

2 Likes