So, basically I am reading ductwork from Revit to export into Excel for Duct Pressure Drop
Calcs. Our firm uses our own calculations and does not like how Revit calculates pressure drop loss. So, we are using dynamo to pull out all of the inputs we need from out Revit Duct model for our excel file. The duct is broken up by sections, so I am getting straight ducts / fittings from the model. Sorting them by their section identifier and then grouping them together by section as well. This is so when I export the data I need to excel it is already in numerical order by each section.
The problem is coming when I have a section that only has straight pieces and no fittings. Not having a fitting means my list is skipping over a section when sorting/grouping the fittings and my list are uneven. How can
I tell dynamo to compare the fitting and straight duct lists and add a null value at the specific index where a section does not have any fittings? See the simple system example I am working with here. Duct Section 4 has no fittings, so I need to add a null value to represent this, but I cannot figure out how. Every duct system we work with will be different and have a lot more sections than this simple example so I need a good way to automate it so it knows exactly which index(s) to add a null value to. My dynamo graph is also attached.
Any help would be appreciated. If you need any more explanation from me please let me know.
Pressure Drop Loss Dynamo Graph.dyn (145.0 KB)
You’re potentially going to have multiple pipe sections without a fitting, meaning you’ll have to add additional sublists in multiple places. This requires using either a custom node or python. I would recommend python as you could easily check your fitting sections against your pipe sections and add empty or null sublists all at once.
Nick, thank you for the response! You are exactly right in that I will have to add additional sub lists at multiple places.
I get a little lost when using python script in Dynamo. Do you have any idea what this python script would look like or have any examples with a similar python script that could get me started?
It would actually be very straight forward and a great way to learn some of the basics in python. Look up some quick examples on
appending, and searching lists for objects.
For each fitting section you would check to see if that number is also in the pipe section list. If it is then you know you have fittings already and can move on to the next section. If the section does not exist yet then you know there are no fittings and can append an empty list in its place.
Thanks for the pointers! I will try this out with python and see how it goes. Once I get the solution or get close I will post here with any questions. Thanks again!
Alright this is where I have gotten to so far. I know my code is not correct, but am I heading in the correct direction? I pretty much want it to add the 0 to the third list at the location where x doesn’t = y in the first two list I am pretty sure, but I do not know how to do so yet because after the first instance is wrong all the rest in the two list will become incorrect as well. Is there a way to continue the for loop with the same value it compared with before the incorrect comparison?
Nick, I think I got it! I did something a little different than what you said. I pretty much check my straight duct section list to my fitting section list, pull that number then subtract it by 1 and insert 0 into my output list at that location. I have to try it out on a larger system with more than 1 section without fittings, but do you see any errors with this simple code right off the bat? I can’t thank you enough to leading me in the right direction, I think I know either have or am very close to the solution. Maybe would of taken me days without your suggestions earlier.
Yeah, after looking at this in more detail I more or less had your groups reversed in my head so my initial suggestion was a little off. Glad you figured it out though. Yes, as long as your sections can be converted to zero-based indices that should work.
Really, you just need to create a dictionary with a default/missing value. Springs has exactly what you need already.