List length of data tree list

is there any way to sum the number of elements in a data tree,

I have a data tree with three lists, where many rows are empty but some of them contain points, and I need to know how many elements in total has each row… each index correspondingly. …Regardless in which list it belongs too, I need to know the number in total, So as a result I need a list with the summed up list length of three lists.
The length of the output should be the same, and I need to have numbers only…( 0 - if there is no element in that position in any of the lists, or 1,2 depending on the number of the elements)
Many thanks in advance

ListLengthOutofDataTree.gh (333.6 KB)

Is this what you mean? Returning the total number of items in the tree.

The top is including the nulls in the count, the bottom is not including nulls

hmm not really.
Sorry for not phrasing it proporly, I need something like the result list I created manually as example .

ah, here, try this ListLengthOutofDataTree_1.gh (335.0 KB)

or are you looking for a result with one list of 441, with all the lists being looked at all at once?

yes. I need only one list.

ListLengthOutofDataTree_2.gh (340.4 KB)

How about this, then?

Could you please send me the link where to get the Slack for Trees, apperantly it doesnt appear in Food for rhino

ah, apologies, I forgot it isn’t standard GH. It’s part of the treesloth plugin which has many useful data tree management tools:

the components of this plugin show up under Set >> Tree on the GH ribbon

Creating duplicate threads will not help you or anyone else with a similar issue.

You’ll have better luck if you can clarify your objective. I see no evidence of “three lists” in either of the GH files you have posted.

1 Like

I have a Data tree, basically a list of three lists Joseph, Idk how to phrase it. Sorry.

What you have is a tree with 441 branches (lists), each containing 441 items, many of which are null.

datatree

I’m sorry but I don’t have time for private consulting on this, or to dig deeply into your code.

Are you aware of these common patterns for working with data trees in GH? In this case, Shift Paths (PShift) required an ‘O’ (Offset) value of -2 instead of the default -1 before a clear pattern emerged - four lists:


DataTree22.gh (101.5 KB)

thank you it actually helps a lot.

If you go back and examine the code that produced this Data param, you can probably apply these methods earlier in the process to keep the tree from getting wacky.

I wrote this simple tool to visually examine the geometry in data trees and use it all the time: