Assigning colours to elements based on the value of the parameter

Hi,

So I’d like to be able to assign colour to any Revit elements by depending on the value of the parameter assigned to the element. The value of the parameter would be a text type.
For eg: very high-red colour,
high-orange colour.
It’ll be a shared parameter named “Level of Risk”
Basically, the idea is to be able to visualise the risk level in the model depending on the level of risk assigned to the model element.
Would appreciate any help on this.

Thank you :slight_smile:

you might use the below but you need to filter elements due to the shared parameter you mentioned.

image

Hi @Becky,
Welcome to the Dynamo community.
You can create a dictionary and then use it to find which color needs to be applied to the element based on its Shared Parameter Value.



ColorByDictionaryValue.dyn (13.6 KB)

Hello @ingenieroahmad
Thanks a lot for taking the time to address my query. I’ll try it out

1 Like

Hey! @AmolShah
Thanks a lot. This is so helpful. It sounds silly but the elements can be selected from any view right? Idk why i’m unable to select the elements. If i’m doing something wrong. Apart from this I think it’s gonna work perfectly fine.
I have another question. To add a step before this current solution, I’d like to create a list of shared parameters to avoid creating and assigning manually, by importing it from excel and from among these is the one parameter i.e., the “Level of Risk” to which I want to assign the colour (Same as the one that’s already one). Would appreciate your input on this as well. :slight_smile:

Yes, you should be able to select the elements from any view.

The previous solution might not work for Plan Views.
So in case if you want to use this on a plan view, try this updated graph.


ColorByDictionaryValue.dyn (23.8 KB)

I didn’t quite follow your question regarding bringing in the values from excel. Can you share a screenshot showing what you want to do?

This is what I want to do
image

This is how I tried creating the shared parameter, but it’s not getting created.

rough.xlsx (9.1 KB)
SafetyParameter.dyn (19.7 KB)

@Becky You were on the right track. Seems like you forgot to provide the categories and mix up inputs for groupName, group and type.

Try this out
SafetyParameter.dyn (22.3 KB)


image

Btw, a more dynamic approach in my opinion would be to ask Dynamo to create view filters so that you don’t have to run the graph over and over again.
RiskLevelFilter.dyn (58.6 KB)




Ah! I hadn’t thought of that. This is a way better approach. Will probably go for this one. Can’t thank you enough for all the help. Thanks a million
Cheers!

1 Like