Linked walls filterd by level

I’m trying to gather the walls of the linked models from the level of the active view.

Filtering by the level doesn’t seem to work, so I tried it by elevation, but without success:

Can someone help me in the right direction?

@Wouter

Since the level in the active view has it’s own Id, the walls do not belong to that Level but to the level in the link.
Try to get the level in the link.

Marcel

I want the script to work for multiple projects, without having to look up the correct level in the link. I hope that it is posible by filtering the elements by the elevation somehow.