Exemplo n.º 1
0
        Execute()
        {
            //Get every level by iterating through all elements
            systemLevelsData = new List <LevelsDataSource>();

            FilteredElementCollector fec = new FilteredElementCollector(m_app.ActiveUIDocument.Document);
            ElementClassFilter       elementsAreWanted = new ElementClassFilter(typeof(Level));

            fec.WherePasses(elementsAreWanted);
            List <Element> elements = fec.ToElements() as List <Element>;

            foreach (Element element in elements)
            {
                Level systemLevel = element as Level;
                if (systemLevel != null)
                {
                    LevelsDataSource levelsDataSourceRow = new LevelsDataSource();

                    levelsDataSourceRow.LevelIDValue = systemLevel.Id.IntegerValue;
                    levelsDataSourceRow.Name         = systemLevel.Name;

                    levelsDataSourceRow.Elevation = systemLevel.Elevation;

                    systemLevelsData.Add(levelsDataSourceRow);
                }
            }

            LevelsForm displayForm = new LevelsForm(this);

            displayForm.ShowDialog();

            return(true);
        }
Exemplo n.º 2
0
        Execute ()
        {
            //Get every level by iterating through all elements
            systemLevelsData = new List<LevelsDataSource>();

            FilteredElementCollector fec = new FilteredElementCollector(m_app.ActiveUIDocument.Document);
            ElementClassFilter elementsAreWanted = new ElementClassFilter(typeof(Level));
            fec.WherePasses(elementsAreWanted);
            List<Element> elements = fec.ToElements() as List<Element>;

            foreach (Element element in elements)
            {
               Level systemLevel = element as Level;
               if (systemLevel != null)
               {
                  LevelsDataSource levelsDataSourceRow = new LevelsDataSource();

                  levelsDataSourceRow.LevelIDValue = systemLevel.Id.IntegerValue;
                  levelsDataSourceRow.Name = systemLevel.Name;

                  levelsDataSourceRow.Elevation = systemLevel.Elevation;

                  systemLevelsData.Add(levelsDataSourceRow);
               }
            }

            LevelsForm displayForm = new LevelsForm(this);
            displayForm.ShowDialog();

            return true;
        }