Swap families by instance parameter value

Hi guys,

I want to swap families based on the instance parameter value (if there is a value - change the family, if no value - no change) in the initial family. I tried some options and had zero luck. Could someone point me in the right direction. FYI I am new to dynamo and coding :slight_smile:

Can you please post a sample file of what you have tried? Screenshots?

Hi Konrad,

Please see the link below for the files:

So in dynamo now it updates all the families which have parameter name Non Conformity Report. I want it to update families which have a value in the non conformity report field. So when the parameter is empty, leave family as is. Once the value is typed in the parameter field - family should be replaced with other family.

Thanks for help :slight_smile:

i guess this should do the work:

1 Like

Hi Viktor,

It is exactly what I need :slight_smile: But I get an error: Warning: Internal error, please report: Dereferencing a non-pointer.

Figured it out :slight_smile: Works like a charm. Thanks a lot :slight_smile:

Can I have “contains” as a condition instead of equal?

I guess you want to use it as the revit schedules’ “Contains” to filter if certain parameter is present. If that’s the case you can use “String.Contains” :

Awesome :slight_smile: You saved my day :slight_smile:

Hate to ask these dumb questions, but how can tell to select from a range of numbers, lets say between 0 and 500. So no matter what number is typed in it would count as true and replace the family?

The Dynamo Primer has explanations for creating lists. Easiest way to do what you want to do I think is the following:

Create a list of numbers from 1 to 500 (by typing 1…500, automatically it will have the increment of 1),
feed this into the list of the List.ContainsItem node, and check to see if the value from the parameter is in that list. it will return a single True or False value.

You can also feed this list into the string.contains node, be sure to convert the list values to strings with the String From Object node.

Still gives me errors and does’t work. What am I doing wrong?

Hello @pa.pavel.antonov, Your List.ContainsItem node have same input for both, what exactly you want to do?

Can you pinned the output of your String.Contains and the List.Map node so that we can provide you more help.


I have multiple families in revit with parameter Non Conformity Report. This parameter value is different for each instance. So I want to tell revit via Dynamo to change family instance when the value is typed, no matter what the value is. I can do it if I type exact value, but I need to do it with whatever value is in (number). So I was hoping I can make a range of numbers lets say from 1 to 500 and tell dynamo once the value is between those numbers - change family.

You could achieve that by using the first definition I suggested. Just take the IN of the bool mask:

Thanks a lot mate :slight_smile: