"Empty List" Creating Error with Curve.Length Node

Hi everyone,

I am attempting to intersect a number of categorized lines with a cube and pull the intersection geometry length. This script works when all of my lines intersect with the cube or the first line in the list intersects with the cube. I have many instances where there are lines that do not pass through the given cube. I need to get the length for each list in the list without loosing the list structure.

The error in the Curve.Length node is: “Dereferencing a non pointer”

I tried to flatten the list but obviously it lost the structure which I need to tell the lines apart.

Does anyone have any ideas on how I can make sure to not lose the list structure but not have my list contain “empty list”? Or does anyone have a better way of finding the combined lengths of each group of lines that intersects with the cube?

All help is appreciated, thank you!

Not Working Script due to empty list:

Working Script:

This approach should work for the list structure depicted in your screenshots:


Since Curve.Length will fail for any EmptyList it encounters we have no alternative to flattening the list. But we can later rebuild the list structure. In one case I needed to use a custom node from Clockwork because of a bug in the OOTB List.Chop node.

1 Like

@Andreas_Dieckmann

That work perfectly. It took me a sec because my node is named ‘by List Chop by Lengths’ in my version of clockwork. Thank you so much for the help.

Here is my updated screenshot:

Time to update your Clockwork :wink: