Imperative Blocks


Is it possible to set a Revit element parameter within an imperative block?

I’m trying to use an If else statement to say:

if the name of this element == a
then set parameter value to b
else if
the name of this element == c
then set the parameter value to b

can this be done with DS?


This may be wrong as I am typing design script on my phone while riding the train, but it should work if you type it out and correct any typos (which may be numerous).

Elem.Name == A?
Elem.SetParameterByName("Parameter Name", B:
Elem.Name == C?
Elem.SetParameterByName("Parameter Name", D):

Elem is the element list, A is the first value to test for, B is the desired parameter value, C is the second test value, D is the second parameter. Any object with neither A nor C name values has no change to the parameter value (hence the null).

Hi Jacob,

Thanks for your help.

Here’s my first attempt at setting parameter values from within Imperative blocks:

This is going to save me a lot of time (and nodes!)

PS excuse my silly parameter values :smiley:

1 Like

They are super useful. Glad to have helped.

And as far as parameters go, I have seen sillier. :slight_smile:

1 Like