Script to Overwrite parameters of select Revit Spaces

I am trying to find the missing link on writing data from excel to Revit parameters, in this case parameters for Revit MEP spaces.
My ultimate end goal is to populate each space in an HVAC model with a parameter for the supply airflow required to the space which we calculate in an excel spreadsheet.
I effectively end up with two lists from excel (one of the space names and one of the supply airflow rates corresponding to each one of those spaces) The order of these lists correspond. In other words, the first item (space name) in list 1 corresponds to the first airflow in list 2 and so on down the line.
My question is, how do I write this script to make sure the association of the lists holds correctly and does not scramble the airflow for one space and overwrite the parameter for an incorrect space in revit?
It seems like the space names in the excel file must match that of Revit exactly and I should then be able to query for space name line-by-line down the dynamo list and overwrite the airflow parameter sequentially line-by-line using the rates from the second list but I am not sure how to accomplish that.
Any input on if this is heading down the correct path?
Supply Airflow from Excel to Revit_MSW.dyn (51.6 KB)

Thanks folks!

Sorry if this feels like I’m avoiding your question, but this question gets asked all the time. Try searching through the forum for similar questions first. You may not be able to find any specifically about MEP Spaces (although I’d be surprised if there are none) but it’s the same process regardless of category. If you run into any issues or come up with specific questions to your workflow then we can answer those more accurately.

1 Like

Thanks for the quick response Nick. I have done numerous searches of previous threads using keywords such as “write to parameters” “excel to revit” “parameters from lists” and the like but have not found a response to my question to this point (which prompted me to create my own thread). Sorry if it is asked repeatedly but I am not finding the instances of this question. Perhaps somebody can point me to one.

Not at a pc at the moment but when writing the Space names to excel are you also writing the Element IDs? If so its easy to say get elements by ElementGUIDs and then say set parametervaluebyname with the data being from the list of desired values. I think Archi-lab has an ID to Element node or it might be Select.ByElementId (not sure working from memory on my phone).

A side note if you export element GUID’s as strings (object to string node) you can also change and update the Space Name parameter not just the Design Supply Airflow parameter. that would be using the Element.SetParameterByName node.

Keep in mind all elements in Revit have a unique GUID number and this is the best way to call the element, parameters like Name or Number can be anything and thus you should avoid using them as Identifiers for collecting items. That’s why the select element node shows the element ID number/ why preview lists show the ID number in green

Here are a few quick examples I found. Some aren’t marked as solved but the information is still relevant.

The basic idea is that you need to sort your Revit elements in the same order that your Excel file is setup. ElementId is great if you have it. Otherwise, using the Space Name (and Number if you have duplicates) with a dictionary is usually the way to go.

2 Likes

And the element’s GUID is better. :slight_smile:

5 Likes

Thanks for the help everyone, it is definitely a good community on here.
So future folks can reference an end result, My scripts ended up as follows:
Identifiers from Revit to excel_MSW.dyn (32.8 KB)
Supply Airflow from Excel to Revit_MSW.dyn (36.3 KB)
I am using UniqueIDs for each space, exporting to excel from Revit, and using some excel to get the correct UniqueID strings placed into an excel row with the correct data which will end up as a parameter associated with each space. I ended up using two separate scripts to accomplish this, one for the export and one for the import. I’m sure there are some extra nodes included in there which aren’t entirely necessary but the concept is there.

2 Likes

Awesome! Thanks for sharing to complete out this thread as well. Glad you were able to solve it. I work in a similar way for Design Airflows ands some other information I mess with in excel. I am a fan of the 2 script method for this kind of task. Pair it with some VBA in Excel and you can do some interesting stuff

Personally I prefer running the entire thing inside of Dynamo (you can always write out to excel to verify data). :slight_smile:

I am in Totally Agreement, but with some older Engineers you will never get them to stop using Carrier HAP & Excel for Rule of Thumb Calcs because “I don’t Revit”. :expressionless: This also was due to the custom Load/Airflow adjustment Calculations being done for some… lets say manufacturing process clients… That don’t follow the conventional load calculation processes. But Pushing the new generation towards the EnergyPlus/OpenStudio methods is the way to go IMO

Yes, our firm still uses HAP almost exclusively. Some of the younger guys are starting to dabble and investigate into the newer softwares but we run frequently into the “devil you don’t know” argument. We also do a lot of airside systems that are not handled well in many of the softwares and excel ends up being the best alternative. I’m really hoping to use some of these scripts and make them as user friendly as possible so we can streamline the excel to Revit manual inputs we get stuck doing all the time because of it.

1 Like

If you can run the calc in excel you can run the calc in Dyanmo, even with a snappy UI that asks for input on those pesky custom parameters which go into the ‘input’ sheet, and are consumed by the ‘raw calcs’ sheet and the ‘display’ sheet and the ‘send to revit’ sheet. :wink:

1 Like

I’ve had good success leveraging this question in conversion conversations:

“How many wall surfaces are you allowed to model in HAP?”

1 Like