Setting the value of a parameter based on another parameter value

Hi, I want to add a parameter values based on the value of another parameter. I have a list of parameters that will dictate what 3 other parameter values will be. I have been trying to match lists but to no avail i.e.: If “Parameter 1” = Item 0 from list one the other parameters will draw their values from Item 0 in the other lists and then use “Parameter.SetValue” to push that data into Revit. I could be coming at this from completely the wrong angle!

I have had no luck on this with anything I have tried. Any advice would be greatly appreciated!!!

Sounds like it’d be easy in Python.

What are you trying to match and what have you tried?

@Alien I am new to Dynamo and I have had no luck with Python so far! I have tried to select all elements with a certain parameter value eg: Structural Material = Metal - Steel 43-275 but that will only do for one case at a time which is not what I am aiming for. I found a few similar solutions but they were all limited to selecting one category, I want to select all categories.
This image might explain what I am trying to achieve a bit better. I want the values of the 3 parameters in green to be set by the value of the structural material. These values are being pulled from and excel sheet so sometimes it might be structural material and others it will be material. (I hope to use Google Sheets eventually, but one problem at a time!!)

Yep, you can definitely do that.

You can read directly from excel into Dynamo too.

Do the columns in excel always contain the same parameter?

Eg, does column A always have the Embodied Carbon?

I’m asking how the excel is presented.

Excel will be consistent. I am pulling some data from model (material, volume and density) to a “Raw Data” Sheet in excel then into the sheet presented above, then another user (site manager perhaps will enter green columns, then another script to pull from here to Revit. so I have been able to pull lists from the relevant columns into dynamo but this is where I run into difficulty.

I think you’ll either have to share your dynamo graph or read up on ‘get’ and ‘set’ in dynamo AND ‘for loop’ in Python.

I think I’d feed the different columns (not including header) into the Python node as different lists then enumerate through them.

Something like…

Param1List = [ ] 
Param2List = [ ]
for i , item in enumerate (first_list):
    Param2List .append( third_list[i])

OUT = Param1List, Param2List

Part_01_Revit_Sustainability_Materials_V001.dyn (107.4 KB)
Part_02_Revit_Sustainability_Pull Data and add to Parameters_V001.dyn (82.5 KB)

Thank you I really appreciate it. I will look into those. Here are my scripts as they stand.

This is moreorless the approach I use for adding external data such as carbon intensity. Make sure your Excel units are consistent with your parameter storage types. You can always use the header names as parameter names vs manually providing them if you are dealing with unknown header count, but generally I just do it manually as it’s often project specific.

Sample model.rvt (428 KB)
Compare table.xlsx (8.9 KB)

match material to values.dyn (32.5 KB)

1 Like

Thank you Gavin, This seems to be what I am after, as I said I am new to Dynamo so it may take me a bit of time to test it out properly. I ran it with my data and it threw up some issues but I think it is more to do with the spreadsheet than the script.

1 Like