Level, Find Associated ViewPlans

I am working with python

I have a single selected level and I want to find all the associated ViewPlans to this single level.

Do I take this already singled out level and find all the associated views?
or
Do I collect all ViewPlans, iterate and list out all views associated to this level?

As I already know the level, it seems less work to list all associated views, but ‘FindAssociatedPlanViewId’ only returns the first available associated floor or structural plan. Is there a ‘next’ option to move to the next available associated ViewPlan?

Thanks

I think the only way is to collect all viewplans and then filter those by their level. You can get the level of a viewplan by using the GenLevel property.

Thanks Taco

selectedLevel = UnwrapElement(IN[0])
collectedViewPlans = FilteredElementCollector(doc).OfClass(ViewPlan).ToElements()
viewsAssocLevel = [i.GenLevel.Name for i in collectedViewPlans if not i.IsTemplate]		
thisLevel = [i for i in viewsAssocLevel if i == selectedLevel.Name]
1 Like