コード例 #1
0
ファイル: LevelsCommand.cs プロジェクト: kmorin/RevitLookup
        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);
        }
コード例 #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;
        }