Inconsistency by filtering

Hi,

sorry if the title doesn’t exactly correspond to the following problem, I had to fill it out somehow.

Imagine the following scenario:

First of all I define in revit two identity data parameters for architechtural walls called : “Wallgroup” and “ParameterX”

In Revit I have three wall goups as following:

Now I would like to set the ParameterX of all the walls in wall group 0 to 100, to set the ParameterX of all the walls in wall group 1 to 101 and to set the ParameterX of all the walls in wall group 2 to 102.

Fetching all elements by “Select Model Elements” and sorting them I achieve this by the following Dynamo Code:

So far so good.

Please note that I always want the ParameterX of all walls in group 0 to be 101, those of all walls in group 1 to be 102 and those of all walls in group 2 to be 103. The point here is that all of the walls in group 2 e. g. do always have to have their ParameterX to be 103, no matter if the list of e. g. wall group 1 is empty or not.

But deleting all of the walls in the group 1, I get the following problem:

The number of the items in the list {101,102,103}; doesn’t correspond to the number of available wall groups anymore. What I think would be the solution is to insert something e. g. in the group list of the wall in the group 1 as a place holder, even if walls of group 1 is empty.

But I don’t have any idea how to do it. I would be very grateful for any help.

You could try to use a Springs.Dictionary.ByKeysValues from spring nodes to associate values to all related group names before querying them

2 Likes

Hi @babysatch ,
I was working on it but @Yna_Db said it first! :slight_smile: I think it would be the best approach :

2 Likes

…thank you guys. I will try it out and give you my feedback asap.

It works very nice. Thank you again.

1 Like

Hi @babysatch

Option 2

4 Likes

…I will give it a try. Thank you.

…it works also :wink: thanks.