Changing Family Based on Parameter Value

Hey everyone, I need some help. I have been trying to find a way to change a family type based on a parameter value and I am having trouble. In this script, I find the “specified supply airflow” and then divide it among all diffusers in a space. I’d like to give cfm ranges and automatically have the family change to the correct type based on what range it falls in. I was thinking the “if” node, but can’t seem to get it to function how I’d like. Any help is appreciated. I’ve attached the dynamo file and a screenshot.

Apply CFM across ATs.dyn (21.8 KB)

If it is a numerical range or number you are using to define the inputs, then this may work for you.
Multiple Inputs

Thanks for the response! I’m going to try this out and see if it gets me where I want to be.

UPDATE: When I try this, it runs without error, but doesn’t change any families inside the revit file.

I have shown Strings as inputs/outputs. Are you feeding actual family types into the inputs?

That’s what I tried. That’s the end goal is to select actual families based on parameter values that are pulled from the revit file.

The entire script reads “specified supply airflow” of a space and divides that among all the diffusers it finds within a space. I would like to take the divided values and auto pick a family based on a given cfm range (i.e. select Family 1 if cfm is between 0-120 cfm, etc.)

Also, could you elaborate a little on what exactly that code block is doing? I get the general idea, but I’m a little inexperienced with code blocks.

All good.
I am out of the office for a couple of days. I’ll get something on range input posted when I get back as I also have an idea on how to do this with OOTB nodes.

Unless there are any other ideas from the forum? Python gurus? :wink:

That code block holds a conditional statement (similar function as an if node), see here:

This conversation could also bring additional clues:

1 Like

Righto, I knew I had seen something like this before.

I’ve just typed this out on my phone but it should be able to be adapted for your purpose @robertsb2010


X=input list of values
a=family type 1 for values 0 to 100
b=family type 2 for values 101 to 200
c=family type 3 for values 201 to 300
d=family type 4 for values 3011 to 400

The code block contents:

x>=0&&x<=100 ?
x>=101&&x<=200 ?
x>=201&&x<=300 ?
x>=301&&x<=400 ?
"Out of range";

The inspiration:

I’ll still see if my OOTB node solution idea works on Monday. :slightly_smiling_face:


Here is an example of the Code Block in action as well as my OOTB Node workflow.
Please let me know if this solves your problem @robertsb2010 :grinning:

Multiple Inputs OOTB



Wow, that code block is nice! I got it to work after toying with the code block contents a little bit. I was definitely confused by the code block workflow at first.

Also, I had to convert my list to ft3/sec as Dynamo doesn’t actually read cfm the way that Revit does. That wasn’t hard to do at all, just another step. Thanks for everyone’s replies!