From List to Individual Item?

Hi Everyone,

While working with excel data as input to my dynamo code block input, I found out that I need to break the list reading from the excel’s row to individual item. There is a node for creating a list from items. But I could find a good way to smartly break the list to invidual item and output them from that nodes.
I have bruteforce solution, see the screenshot from my script, but I think that there should be a better and more flexible way of doing this routine. Any input will be appreciated on how to approach this issue.
The node should work like this: For a given list, output its items individually.
Please find snapshot of what I did below:

Hi @Ra_AKH

Can you explain why would you break a list like that?
In Dynamo, each node can process a list or an item so breaking a list into its items is not advisable unless you need an item from that list.

-biboy

3 Likes

I agree with what @blsalvio said, however you can make your code block smaller using this approach:

In(0);
In(1);
In(etc.);

Hi @blsalvio: Thank you very much for you comments. The reason that I am want to break list into individual items is that the nodes that I built need 3 values from the table in the excel provided by the user to feed in different location of the computing nodes to get correct result I wanted. For example, the value provided as a from of a pipe sizing chart or table like in the screenshot. I need the two fixture unit values, eg: [84 to 256] to filter the pipes whose fixture units are in the range and the size to the pipe’s diameter to be set to those group of pipe elements selected after filtering. For some case, I have a list of 11 elements to break and some other case I have a list of 8 elements of the 3 values to break into invidual items to feed to those nodes. Can we do it in dynamo with the brute force outputing items like I did?


@blsalvio and @Daan : Do you think that I can achieve the same result by a Python script with the same inputs (that might shorten the who nodes connections? in my case 4 inputs: [pipe elements to filter, fixture range to filter [x1,x2], size of the pipe?
@Daan: That is pretty neat. Thank you very much for the comments. I will change my code to that for sure.
Really appreciate the comments from both of you!

1 Like

Hi @Ra_AKH

You can definitely do that in python or in Dynamo’s OOTB nodes. It really boils down to the logic of your script. After filtering, what do you want as an output? can you provide sample files (sample revit file, your excel file and your brute force dynamo script)?

-biboy

1 Like

@blsalvio: The script is used for sizing the pipe in the building after the design had routed them. So it will change the size of pipe diameter base on the design criteria or building code requirement etc. So the output could be the list of pipe elements that we changed their diameter in the Revit MEP project or just a simple message that the sizing is done so that the user will see the size of the pipe change according etc. I will create a small sample project and provide a sample and the script I had within the forum. Thank you so much for your useful advice and I have a direction to go for the better way write the script for my problem. I think the script for doing the task will not be long. I will start working on Python code to interact with dynamo object and will let you (@blsalvio and @Daan know the result later. Really appreciate your response!