Filtering only items in schedule out of list of all instances

I recently started making a script that will take a door schedule (Bumblebee package) and add a few additional parameters to the output before exporting to excel (Element ID, GUID, Ironmongery etc).

I’ve tested this in isolation with 3 door families and it worked as expected, however, when testing on a project I ran into a issue. I have a few different door families from different sources and my initial way of filtering only applied to our in-house doors, not the other family types downloaded/created etc.

I’ve been trying to find away to use the Revit schedule (door mark) to filter the list of doors in the project. I’ve tried a few ways and searched a bit but none of the obvious suggestions worked and I can’t figure out why.

I’d like to take the longer list of all door instances and compare it against the shorter one from the Revit schedule, then remove those doors which do not appear in the door schedule. The remaining doors I will match up the Mark numbers of the schedule with those in the project and use this to add additional parameters (I have this part working separately). In the example I have to get the 400oo down to 25. What I’ve noticed in excel is that the blank rows in the schedule are being populated with random (shared nested) doors from the project.

swapped image

Have you tried the “SetIntersection” node?

That will reduce the list down to 21 items. Where do I go from there to filter the list of 400 down to those 21?

I tried with a boolmask but that fails

Try something like this, see what you get. (I’m kinda just throwing this together, so I don’t know if will work for certain on your specific task)

You may not need the “String From Object” if your lists are already strings, my test was using integers so I had to convert them to strings to use the String.Contains node.

Sorry, the string.contains node there is blocking the node going into the item input of the list.contains. It’s hiding a code block with a true input.

I’m not sure whats going on but I think there might be something missing? The list.contains has 400+ lists (for each door) of each item checked against the schedule list.

Door Schedule Filtering.dyn (28.4 KB)

It looks like its working to me. That output list is now a list of all the doors in the job filtered by the list of doors in the schedule filtered by whatever index 2 is in the schedule (mark?). You filtered the 430 doors down to a list of 141 doors that match that mark of doors in the schedule.

Did I misinterpret your intentions?

Actually, I don’t think its working. Because the sting.contains node is giving you more true values than you need. For example, one of your schedule values is D0.01.1, if you check any value that contains that string it will report back true. So if you have a door that is D0.01.10 it will report true because even though it is a different number, the first 8 characters are the same so it technically “contains” the first number. We need a better way to filter.

New test, try this. use a list contains instead of a string contains.

I’m trying to the total number of doors in the project (which could be any number due to shared nested door families) down to only those which appear in the schedule using Schedule.GetData list at index 2 (25 doors incl a few blank lines).

I think it’s almost there, I was trying to use a node to give the door list an index, this returned “-1” for those not listed, I’m not sure how to proceed from there or if it’s a good way to go?

Did the above work? Show a snip of what you have now.

Oh, one thing I forgot to mention, set the lacing for the first list.contains to cross product manually.

Almost! I’m getting a list of all the doors I was expecting to see but there are 4-5 that snuck in there that shouldn’t be (out of 200 in a project.

I was just trying to figure out how to get it into me final graph, I think I got it but it’s still giving me values’ where I should see blanks.

I’ve attached the bones of my final script, it’s a combination of my previous thread and the filtering from here.

Export Door Schedule_v3.dyn (85.5 KB)

If you want to remove the blank values coming out of the schedule you can use a List.filter to look for blank strings ( “” ) or try a list.clean. List.clean can preserve the indices if you want.

I just closed out of Revit/Dynamo, will give it a go tomorrow, hopefully it works, thanks for helping with this!