Change color fills for spaces from their parameter values

Hi guys I have a question about color fills.

I was looking at this picture:

And I was wandering if it would be possible to change color fills with few logical conditions.
Let me explain better…

Let’s say that spaces have two shared parameters:
A and B

I would like to change color fills with those conditions:

  • If the parameter value “A” is <= 99% of the parameter “B” then the color of the Space has to be Red
  • If 100% of “B” <= “A” <= 150% of “B” then the color of the Space has to be green.
  • If the parameter value “A” is >150% of the parameter “B” then the color of the Space has to be Blue
  • if “B” is == 0 and “A” is ==0 then the color of the Space has to be white
  • if “B” is == 0 and “A” is not == 0 then the color of the Space has to be white

Do you think it’s possible?
Thanks indeed! :slight_smile:

I guess you could use some Element.GetParameterValueByName nodes (to read paramaters A and B) combined with some AND and NOT nodes to compile a new parameter (with Element.SetParameterByName) (e.g. strings called “red”, “green”…) to be used in the color scheme (in which you manually assign the correct color to the corresponding string).

EDIT:

I thought that using revit calculated parameters was quicker so I gave it a try but then I remembered that you cannot use those in Dynamo or in the color scheme, so unless you want to retype the calculated parameter by hand in another parameter here is what I thought:

I wanted to use the “excel-styled” IF statement:

if(B = 0, “White”, if(C < 1, “Red”, if(C > 1.5, “Blue”, if(C > 1, “Green”, “Unknown”))))

(not fully tested)

I then read how to convert this language to dynamo: http://dynamoprimer.com/en/04_The-Building-Blocks-of-Programs/4-3_logic.html
and found an example here: http://dynamobim.org/forums/topic/if-then-else-in-dynamo/

So i wrote a codeblock with:

(B==0?“White”:
(C<1?“Red”:
(C>1.5?“Blue”:
(C>1?“Green”:“Unkown”))));


Now you should have a parameter telling you what color that room should be, so you just have to open the view color scheme and assign the corrisponding color to each value.

Hi GregX,

Sorry for my belated answer but I was busy…
What you are showing on you answer is exactly what I was looking for. I will have a look and let you know if I still have any problems.

Thanks again for your help.
P.s. Are you Italian?

Ciao Ciao =)