Finding the view a Filled Region is in

Here’s what i’m doing right now?

I looked for all Detail Items that i filter by “Filled Region”. I then get the worksets from that items.

I look for all worksets in the project then filter them using the name (looking for “Floor Plans” right now). From that shorter list i retrieve the Name.

I then compare the 2 list to get the View.

It’s extremely slow (number of elements are huge), so i’m open to any other suggestions to make it faster :slight_smile:

I also just notice that Filled and Masking Region are the same when using Detail Items to select. Any ways to differentiate them?

Hi @Daniel_Hurtubise ,

here’s one way to get all filed regions (and no masking region) and the view they belong to :

import clr
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from Autodesk.Revit.DB import*
import System
doc = DocumentManager.Instance.CurrentDBDocument
collector = FilteredElementCollector(doc).OfClass(FilledRegion)

regions = [i for i in collector if i.IsValidFilledRegionTypeId(doc,i.GetTypeId())]
views = [doc.GetElement(r.OwnerViewId) for r in regions]
OUT = regions , views

Actually i found out that masking don’t have Family and Type so i can filter them using that… no python :wink:

Thanks guys

1 Like