Getting sublists from list automated

Hello,
I have a list of 7 items which are basically 7 houses, which have further sublists. Manually its easy for me to get any list giving index from 0 to 6 as shown in figure. I want to make it flexible and automated. Because sometimes it could be 5 or 4 houses and then it would be 5 or 4 main lists respectively. I dont know how to make it autoamated so as each time i run it should count how much items it has and give me that much of lists separatelyC1

Does this help?

yes i also tried on counting and its helping but whats bothering me is the next step. For example, ok we got to know that the list has 6 items now should it automatically create 6 different lists. As we can manually use List.GetItemAtIndex 6 times to create 6 separate lists

How about this?

image

This node says it would repeat an item by certain number of times. My case is i think different

I think you need to post more of what you’re trying to do with a dynamo graph.
Explaining it all in text can be very confusing.

For example, In this picture, we can split this list to 4 times as we can manually get every main list. Suppose next time it is having 8 items in main list instead of 4. I want to automatiacally create other small lists equal to main items in this main sublist.

What is the reasoning for this? I’m guessing whatever you’re going to do with those separated lists can be done with sublists. Breaking your graph apart to do the same thing multiple times is actually what you should be avoiding. Proper lacing and list levels will probably get you what you want.

1 Like

you are right and upto some extent i was doing with lists considering suitable lacing. But actually the results i have to show separately for each house and then within same house for each level. Thats why i have to divivde in the end.

That may get tricky. Taking your base example, you are developing 7 lists that then need to get pushed into at least 7 new nodes, and then revising it so that 5 lists get pushed into at least 5 nodes, etc… What you are in effect asking for is for the script to re-build itself.

It may help to take a quick step back: what is your next task after generating multiple lists? Do you need to do unique things to each list? If not, there’s probably some method available that allows the list to stay grouped.

List.Chop with length 1 will do it

1 Like

After getting each separate list from list i am doing all these tasks for each separate list as shown in green colored group in picture. I need to divide each inti two groups (R and S) Based on paramter given in Revit , then exploding the geometry(Solids) of both groups, getting its botom suface area and area of walls of mass.

After getting each separate list from list i am doing all these tasks for each separate list as shown in green colored group in picture. I need to divide each inti two groups (R and S) Based on paramter given in Revit , then exploding the geometry(Solids) of both groups, getting its botom suface area and area of walls of mass

So all you have to do is make that group of nodes work for a list rather than a single input. You can either turn it into a custom node and make the custom node run for each sublist or you can make each individual node work for a sublist of elements. It’s all about list structure and lacing/list levels.

Start by using a Transpose node to “flip” your sublists from pairs to x[0] and x[1] sublists.

3 Likes

Thanks @Nick_Boyts. You were right I did all in one long listing.

1 Like