Creating a filter for instances of revit link

Having some trouble filtering instances of the same revit link within Revit’s own filter based parameters, so I thought I’d try dynamo.

Basically I have the same link of a unit type copied multiple times within my tower. I have renamed all the unit instances to refer to their unit number (i.e. 101 for level 1 room 1, 610 for level 6 room 10, and so on).

I can go an un-check the units that i don’t require in each view, but that is very time consuming and somewhat annoying. Since I have already named the individual units via the RVT Links identity data ‘name’ parameter, is there a way to filter these unit instances so I can only see the units that begin with the first number of its identity data name (for example, if I have a view open for level 2 I then only see all the rvt link instances that identity data names begin with 2?).

I don’t think this is possible to do with revit’s integrated filter options. I have tried a number of methods, but I can’t get the result I am after referring to the identity data name.

Any help or advice is appreciated.

If you’re on level 2 then you shouldn’t be seeing anything on level 6 anyway (or level 3+).

I’m not sure link instances can have view filters applied, but you might be able to set the visibility for a given instance by testing the link’s name against the level or view name and hiding all elements which don’t pass the name test. You could also test the instance location or transform origin for containment inside the view’s extents, then hiding the elements which fail. You might want to use the link’s bounding boxes to check if you have cropped plans.

Neither of these would work with updates the way a filter would, but it will save you some headaches around manually checking boxes.

The other units are showing up because we have the display settings by linked views. We can change this, however it will cause other issues down the track