Getting array rank reduction error

Hi all, did anyone get this error before? “Warning: Converting an array to Revit.Elements.Element would cause array rank reduction and is not permitted”.

I am using a node that @Vykr did in the past. I have exported his nodes from a custom node because I found it troublesome to use the custom node he created. (Thanks so much Vyrk for your node btw, it’ll really help me in my school project and I’ll credit you for your work! The link to his node files can be found at the bottom of the link: Shortest Route?)

I am getting the picture as shown below. Hope that someone can help me in this. Thank you!

Hi, does anyone know what the issue is? I really need help on this!

Thank you!

IIRC, array rank reduction error is when certain nodes cannot accept an input where the levels are inconsistent, meaning there are elements in and out of nested list, at all @L’s instead of a consistent level. For example using a list like:

[1,2,3,[4,5,6],7]; where the elements are at different levels would give you an error but
[[1,2,3],[4,5,6,7]]; would not because it is consistently 2 levels deep.

The best way to resolve this is to use a consistent leveled input. If that is not possible, a workaround would be to flatten completely, do the changes you need to, then restructure the new list to match the old.

1 Like