Hey guys, Im hoping someone can help me with a little problem I have.
So I am making a program that is supposed to set a parameter if the element contains a string in the text property that is specified in a list containing a string and a number.
As you can see in the screenshot, the first item is a string and the second is a value in each sublist. I want to be able to check if the string (i.e. Bergen Kommune) is in the properties list of an area element, if that is the case, the number (i.e. 2.0469…) should be written to a parameter called “PP” for that area element.
Does anyone have any idea on how I can accomplish this?
A dictionnary will do what you are after
How can I use this to obtain the desired output when writing to parameter? I have created the dictionary, but I am still stuck trying to select the correct areas to write to parameters to
Hi @oyvind.s ,
See if an approach like this helps:
- Split the list in your screenshot (or don’t even combine it in the first place)
- Use the node String.Contains or == (depending if you want an exact match or a contains operation). This node will output a list with booleans.
- Using the list of booleans you can filter your list of Revit Elements and the corresponding parameter-values. You will now end up with only two lists of the “to-be-overwritten” Revit elements and their corresponding parameter-values.
- Use those lists, together with the Element.SetParameterByName node to overwrite the parameter-values in Revit.
2022-10-01 Filter List by Other List.dyn (20.8 KB)