Ejemplo n.º 1
0
        /// <summary>
        /// Get the levels and wall types from revit and insert into the lists
        /// </summary>
        private void InitializeListData()
        {
            // Assert the lists have been constructed
            if (null == m_wallTypeList || null == m_levelList)
            {
                throw new Exception("necessary data members don't initialize.");
            }

            // Get all wall types from revit
            Document document = m_commandData.Application.ActiveUIDocument.Document;
            FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document);

            filteredElementCollector.OfClass(typeof(WallType));
            m_wallTypeList = filteredElementCollector.Cast <WallType>().ToList <WallType>();

            // Sort the wall type list by the name property
            WallTypeComparer comparer = new WallTypeComparer();

            m_wallTypeList.Sort(comparer);

            // Get all levels from revit
            FilteredElementIterator iter = (new FilteredElementCollector(document)).OfClass(typeof(Level)).GetElementIterator();

            iter.Reset();
            while (iter.MoveNext())
            {
                Level level = iter.Current as Level;
                if (null == level)
                {
                    continue;
                }
                m_levelList.Add(level);
            }
        }
Ejemplo n.º 2
0
        private void InitializeListData()
        {
            if (null == m_wallTypeList || null == m_levelList)
            {
                throw new Exception("necessary data members don't initialize.");
            }

            RevitDB.Document document = m_commandData.Application.ActiveUIDocument.Document;
            RevitDB.FilteredElementCollector filteredElementCollector = new RevitDB.FilteredElementCollector(document);
            filteredElementCollector.OfClass(typeof(RevitDB.WallType));
            m_wallTypeList = filteredElementCollector.Cast <RevitDB.WallType>().ToList <RevitDB.WallType>();

            WallTypeComparer comparer = new WallTypeComparer();

            m_wallTypeList.Sort(comparer);

            RevitDB.FilteredElementIterator iter = (new RevitDB.FilteredElementCollector(document)).OfClass(typeof(RevitDB.Level)).GetElementIterator();
            iter.Reset();
            while (iter.MoveNext())
            {
                RevitDB.Level level = iter.Current as RevitDB.Level;
                if (null == level)
                {
                    continue;
                }
                m_levelList.Add(level);
            }
        }