Assigning a value to parameter based on a list in dynamo

I am new to dynamo and I want to know if what I require is possible to do without using python.
I have a list that includes sublists. Each sublist has two items.

Let’s say that the first item is the parameter called “Circuit Number” that is already created in filled with appropriate numbers in revit model. The second item is a letter representing the appropriate Circuit Color parameter that I created in revit but is empty and not filled with any values.

What I want to do is this : Assign the second item in each sublist to the parameter called “Circuit Color” based on matching the first item in the same sublist with its equivalent “Circuit Number” in the revit model.

So for example: The script will search for Circuit Number 1 and then write R in the Circuit Color parameter of this circuit. And then searches for Circuit Number 2 and then writes R again in the Circuit Color parameter of this circuit. And then searches for Circuit Number 3 and then writes Y in the Circuit Color parameter of this circuit. And so on…

Any help would be appreciated. Thanks.

Hey,

Does this answer your question?

1 Like

Thanks so much for your great effort and your help. The problem is, the “Circuit Number” parameter is automatically defined by Revit and cannot be overwritten (i.e. you cannot re-write it). So, knowing that, I wanted to search for a particular circuit and then add the appropriate color parameter.
In other words, the script should search for the Circuit “Number” “3” and assign “Y” to its “Color” parameter.

Okey,

Using the package “RIE” you can do a lot with circuits, panels and other MEP items.
The output is circuits in order, next you can get all elements that are connected to that circuit

If i change the order of numbers you see the right circuit will be chosen.

So you can order the circuits you in a the way you need them.
Then using my previous message to assign the color parameter value to the right element.

1 Like

Thanks again for your reply. I am still having the same problem even after trying your recent solution. The circuit number is a reporting parameter, and in now possible ways that it cannot be changed once the a the circuit is created.

What I was thinking of is adding a conditional statement in a code block to check for the circuit number parameter and adding the relevant circuit color from a created list according to that number, But I was not able to pull that off.

Maybe a Dictionary for this part.

1 Like

Thanks for your input. I already planned - originally - to use a dictionary where I created two lists, one for a hypothetical number of circuits (from 1 to 48), and one for the respective color (R,R,Y,Y,B,B,…). Then, I linked them so that Keys are the numbers and Values are the color.

But I was not able to make the conditional statement that would check the actual existing “Circuit Number” (Dictionary Keys) in the revit model, and then add its respective Dictionary Value (Color) to the “Circuit Color” parameter.

Isn’t it just this you need?

1 Like

Wow. That’s it. Thanks very much, my friend. I was trying to reach that solution for a long time. I was trying a more complex solution using dictionaries but your answer is ideal. You saved me a great deal of time. Many thanks.

No problem.

Been there too. :stuck_out_tongue_winking_eye: