Rhinopython error

I want to make an algorithm using rhinopython that works the same as range&domain, but it has an error.
How can I handle this problem?
domain&range.gh (6.7 KB)

The error is in line 6 of your code:

Make this change to line 6 and your code works:



Can you let me know why you change โ€œif i <= len(Y)โ€ to โ€œif i < len(Y)โ€?
I can see it works well but still donโ€™t get why itโ€™s solved.

This is from your original code:

In your gh definition:

  • You have 10 items at input X
  • You have 3 items at input Y
    • Y[0], Y[1], and Y[2]
  • When the loop in line 5 gets to the point where i = 3
    • Line 7 tries to access Y[3] generating the error: Solution exception:index out of range: 3


1 Like