Message 1 of 4

Not applicable
05-25-2017
06:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working on a utility to quickly jump up or down a level in a project. I have run into an issue where I have collected and sorted by elevation all the levels in a project
private List<Level> GetAllLevels() { FilteredElementCollector levelCollector = new FilteredElementCollector(m_doc); List<Level> levelCollection = levelCollector.OfClass(typeof(Level)).OfType<Level>().OrderBy(l => l.Elevation).ToList(); return levelCollection; }
I then am comparing the levels to the active views level. (I am ensuring first that the active view is a plan view)
Level currentLevel = doc.ActiveView.GenLevel;
A match is never found for the levels.
The attached image is from the Locals window of VS. projectLevel is the level in the loop, and currentLevel is the level of the active view. They appear to be the same, but are not a match. Why?
I could try to match elevation of the levels, or the AssociatedPlanViewId of the level, but I thought that they should be the same object.
Solved! Go to Solution.