Change color fills for spaces from their parameter values

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.

3 Likes