Filtered Element Collector

Filtered Element Collector

W0044793
Explorer Explorer
660 Views
3 Replies
Message 1 of 4

Filtered Element Collector

W0044793
Explorer
Explorer

Hi

I have created a plugin that uses a filtered element collector to capture Electrical Equipment in a model. It works perfectly on a model that is based on our network however does not find the elements when a Bim 360 model is opened.

 

My code

 

UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
Document doc = uidoc.Document;

//Retrieve elements from database
FilteredElementCollector col1
= new FilteredElementCollector(doc)
.WhereElementIsNotElementType() .OfCategory(BuiltInCategory.OST_ElectricalEquipment);

 

Thanks for your help.

Michael

0 Likes
661 Views
3 Replies
Replies (3)
Message 2 of 4

jshial
Advocate
Advocate

Is there any chance that the electrical equipment are linked in the model living in BIM360?

0 Likes
Message 3 of 4

W0044793
Explorer
Explorer

No there is and architectural model linked though...when I create a new electrical equipment element the collector can't find it either so seems the code can't connect to the data base somehow?

0 Likes
Message 4 of 4

Sean_Page
Collaborator
Collaborator

If you are trying to use the FEC on a linked model, you will need to get the LinkInstance to retrieve the Document of the link, then run the FEC on the link and not on the local doc.

 

FilteredElementCollector col1 = new FilteredElementCollector(linkDoc)
.WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_ElectricalEquipment);
Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect