I think i have create the script you are looking for!
I have build this script up from almost fully OOTB nodes, but i needed to use a handful of ClockWork Package nodes, so make sure to install that Package!
Firstly i started by extracting all the “Structural Framing” Elements by Category. (In your case Piping Networks.)
When i got all these elements i extracted all parameters which contain in the name “Family and Type”. (In your case Assembly Name).
Then i used these parameter values to Sort all Elements by their corresponding “Family and Type / Assembly Name”.
After this i sorted all the families by their name so i have an order like: 1,2,3 or A,B,C or, in your case, all Assembly Names in Order.
Now we have a split up list, sorted alfabetically. From this we extract all parameters once again to Sort these lists, now becoming sublists, by their Mark. In your Case 1 to 9, in my case A to I. The concept is the same.
I do this for the Mark and for the “Elevation at Bottom”, in your case “Digi Length”, because we need them both.
Because we want the marks always to be in the right order (1…9), do we sort the list by their parameter value. Because we do not need the mark values but the Digi Length values, we sort the Digi length parameter by the sorting output from the Mark.
Now we have a list, with sublists which represent Assembly Names with Marks within them. List 0 is Mark 1 and so forth. Because these values are now always sorted by their Mark level we can make the Sum calculations for each amount you specified in this Topic (1, 1 to 3, 1 to 5, 1 to 7, 1 to 9 and Total Amount.) This looks like this:
Now we have gathered all the data we need and the only thing left to do is to create an export to Excel to be able to read this data in a comfortable way. This is done in this way:
And this will look like this in Excel:
And here is the Dynamo File, you will need to change some small bits but that is all:
Dynamo Forum Post 15-01-2020 AssemblyName Then Mark Then Sum MJacobson71E.dyn (156.9 KB)
If you didnt understand some parts let me know and i will try to explain to the best of my abilities.