Index out of range while creating sublayers in Grasshopper Python

The script and definition work fine for most layers but on line 44 for sublayer “Transport” it shows a runtime error: “IndexOutOfRangeException”


_pythonSublayers.gh (6.0 KB)

It looks like the error is in line 38. The index is out of range for the Visibility and Locked list (since their length is 8)

If you used the line below instead, it would work.

rs.AddLayer(full_path, colors[i], True, False)

I see. That’s perfect. Thanks

1 Like