Yes, I did. but we get the names of the levels from the linked file , which may not coincide with the names of the levels of the active file. need to control names of the levels. I would like to filter out of the room by this method:
@til.shviger If you could, please copy and paste your Python code as preformatted text. See below post
is a gif showing how you can post it as preformatted text.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
import System
from System.Collections.Generic import*
linkdoc=IN[0]
category=IN[1]
if isinstance(IN[2],list):
views=IN[2]
else:
views=[IN[2]]
els=[]
fec=ElementCategoryFilter(System.Enum.ToObject(BuiltInCategory, category.Id))
ids=[v.Id for v in views]
idlist=[ElementId(i) for i in ids] [0]
#for i in idlist:
# els.append(FilteredElementCollector(linkdoc,idlist).WherePasses(fec).WhereElementIsNotElementType().ToElements())
OUT= FilteredElementCollector(linkdoc,idlist).WherePasses(fec).WhereElementIsNotElementType().ToElements()
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import*
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc=DocumentManager.Instance.CurrentDBDocument
collector=FilteredElementCollector(doc)
link_inst=collector.OfCategory(BuiltInCategory.OST_RvtLinks).WhereElementIsNotElementType().ToElements()
OUT=[[i.Name, i, i.GetLinkDocument()] for i in link_inst]
for example when I use all your code without any changes I get this:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
import System
from System.Collections.Generic import*
linkdoc=IN[0]
category=IN[1]
if isinstance(IN[2],list):
views=IN[2]
else:
views=[IN[2]]
els=[]
fec=ElementCategoryFilter(System.Enum.ToObject(BuiltInCategory, category.Id))
ids=[v.Id for v in views]
idlist=[ElementId(i) for i in ids]
for i in idlist:
els.append(FilteredElementCollector(linkdoc,idlist).WherePasses(fec).WhereElementIsNotElementType().ToElements())
OUT= els
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import*
import System
from System.Collections.Generic import*
linkdoc=IN[0]
category=IN[1]
if isinstance(IN[2],list):
views=IN[2]
else:
views=[IN[2]]
els=[]
fec=ElementCategoryFilter(System.Enum.ToObject(BuiltInCategory, category.Id))
ids=[v.Id for v in views]
idlist=[ElementId(i) for i in ids]
for i in idlist:
els.append(FilteredElementCollector(linkdoc,i).WherePasses(fec).WhereElementIsNotElementType().ToElements())
OUT= els
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import*
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc=DocumentManager.Instance.CurrentDBDocument
link_doc = IN[0]
link_collector=FilteredElementCollector(link_doc)
rooms=link_collector.OfCategory(BuiltInCategory.OST_Rooms).ToElements()
view_name=doc.ActiveView.get_Parameter(BuiltInParameter.PLAN_VIEW_LEVEL).AsString()
els_view=[i for i in rooms if UnwrapElement(i).get_Parameter(BuiltInParameter.LEVEL_NAME).AsString()==view_name ]
OUT=els_view