Message 1 of 1
Unknown source of Sites in project
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
What I'm trying to do
I'm iterating loaded links in my Revit model, and I'm trying to programmatically get a list of Sites names for each link, and write the list to an excel sheet.
The problem
For most links the list of Sites are being created successfully and matches the list of sites inside Revit when I access it via Revit UI. However for some links the list contains multiple Sites that all of them are called "Default Location" and do not exist inside Revit when I open the linked model via Revit.
Can anyone tell where is this coming from and why?
Excel - Sites From Code, unknown "Default Location"
Revit - Only Internal shows
Code
// Sites
IList<ProjectLocation> linkSites = new FilteredElementCollector(linkDoc)
.OfClass(typeof(ProjectLocation))
.Cast<ProjectLocation>()
.Where(s => s.Name != "Project") // ignore default Revit ProjectLocation 'Project'.
.ToList();
int totalSites = linkSites.Count;
string siteNamesList = CustomFunctions.GetNamesListAsString(linkSites.Select(site => site.Name).ToList());