Resizing pipes using formula in Dynamo

Hello, I am new to Dynamo, I have prepared a script for automation of resizing of sprinkler pipes in Revit model using Dynamo. I have used a formula that reads ‘flow’ value of pipes in the model, and changes their diameter accordingly. I have been able to successfully run this script to the point of identifying the pipes, their flow values and figure out their required diameter as per the formula.

I am facing an issue of not being able to feed a list of elements (pipes) to the ‘Element.SetParameterByName’ node in order to change diameter of all pipes together.

P.S. this script works if one element is fed to this node at a time but that clearly beats the purpose of automation.
Any help regarding how to feed the entire list OR feeding elements from pipe list and diameter list one by one by order would be appreciated.
Pipe sizing automation.dyn (22.2 KB)

Firstly, I suggest using a code block, and using Category.ByName(“Category Name”) as the input to take all the elements in the project of that category. (This is better than the “Category” node, as it hard codes a specific category, which I think you need if its just pipes")

Secondly, when using setparameter with multiple elements, you generally need to use List levels (have a read on Dynamo Primer).

Good luck!


Thank you for replying Daniel. I will surely read up on List levels. Could you please suggest how to convert this formula to code block? I do not know python.

No need for python. Just double click in the dynamo space, and this will bring up a code block. Then copy and paste:


And connect this to an “All Elements of Category” node

1 Like

Hi, I could finally resolve this issue. Turns out it did not require each list element to be fed to the parameter change node one by one. The issue was the method of lacing for the parameter change node, which when changed from ‘Auto’ to ‘Cross product’ seems to have solved the issue.
I hope this helps.

Hi daniel. Thank you for this extremely helpful tip regarding codeblock. I seem to have resolved the problem for now. Apparently the lacing method was the issue. Let’s hope it works for other similar instances too.