Filter list with condition

revit
dynamo

#1

Hi Dynamo experts,

I’m writing a script to filter a list of parameter based on a condition to find all the parameters including the word “Plate”.


Unfortunately, the run never completes. I have tried it so many times and I tried the script on smaller Revit file and it works, but it doesn’t work on the main file which is a big file.
Is there recommendation how to speed up the process or change the scrip? I would appreciate your help.
I need to pick some items from the list with specific name in order to locate and find the length for the lines.


#2

Hi,

It happened to me before when I wanted to run graphs that required a lot of computation. One way I found to avoid that problem is to run the graph step by step, letting the first node compute and freezing the others, then unfreeze the second node and freezing the one after, etc., until you computed all your nodes.

If the List.Filter node still doesn’t compute, you can try dividing it into a List.FilterByBoolMask node and a String.Contains node, runnning them one by one.

Good luck !

PS: if some of you find a better solution, I would be 100% intrested !


#3

Thanks @mellouze for your reply. I tried freezing but unfortunately when I freeze the first part, the next get frozen too. It doesn’t work for me.


#4

You are talking about the moment when you want to compute the second part ? In that case, you don’t need to freeze the first part, as Dynamo already evaluated the first node and will not try to compute it again (unless you change the input).

If you are talking about the graph you showed in your first post, I said earlier that you can decompose your two last nodes to make them independant, freezing the second and running just the test.

Hope this helps.


#5

@NaSha You could try using a design script solution and see if that freezes?
This uses the logic @mellouze stated in the post above. :+1:


#6

@Ewan_Opie Nice! I wonder why it’s not working for me :roll_eyes:


#7

Can you break it out and see which side of the road the error occurs on?

image

Could be a conflicting package. Try specifying Revit?
image


#8

@Ewan_Opie :roll_eyes:


#9

I know, it old topic, but did you find a solution?
If you didn’t I have idea :slight_smile:

Try by node: List.FilterByBoolMask.
Below part of my script, which filter elements by word “BMV”

I hope it will be helpful.