当前位置: 首页>>代码示例>>C#>>正文


C# FilteredElementCollector.Reset方法代码示例

本文整理汇总了C#中FilteredElementCollector.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# FilteredElementCollector.Reset方法的具体用法?C# FilteredElementCollector.Reset怎么用?C# FilteredElementCollector.Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FilteredElementCollector的用法示例。


在下文中一共展示了FilteredElementCollector.Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetAllLabelsOfGrids

        /// <summary>
        /// Get all grid labels in current document
        /// </summary>
        /// <param name="document">Revit's document</param>
        /// <returns>ArrayList contains all grid labels in current document</returns>
        private static ArrayList GetAllLabelsOfGrids(Document document)
        {
            ArrayList labels = new ArrayList();
            FilteredElementIterator itor = new FilteredElementCollector(document).OfClass(typeof(Grid)).GetElementIterator();
            itor.Reset();
            for (; itor.MoveNext(); )
            {
                Grid grid = itor.Current as Grid;
                if (null != grid)
                {
                    labels.Add(grid.Name);
                }
            }

            return labels;
        }
开发者ID:AMEE,项目名称:revit,代码行数:21,代码来源:Command.cs

示例2: Initialize

        /// <summary>
        /// iterate all the symbols of levels, columns, beams and braces
        /// </summary>
        /// <returns>A value that signifies if the initialization was successful for true or failed for false</returns>
        private bool Initialize()
        {
            try
            {

                FilteredElementIterator i = new FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(Level)).GetElementIterator();
                i.Reset();
                while (i.MoveNext())
                {
                    //add level to list
                    Level level = i.Current as Level;
                    if (null != level)
                    {
                        levels.Add(level.Elevation, level);

                    }
                }

                i = new FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(Family)).GetElementIterator();
                while (i.MoveNext())
                {
                    Family f = i.Current as Family;
                    if (f != null)
                    {
                        foreach (object symbol in f.Symbols)
                        {
                            FamilySymbol familyType = symbol as FamilySymbol;
                            if (null == familyType)
                            {
                                continue;
                            }
                            if (null == familyType.Category)
                            {
                                continue;
                            }

                            //add symbols of beams and braces to lists
                            string categoryName = familyType.Category.Name;
                            if ("Structural Framing" == categoryName)
                            {
                                m_beamMaps.Add(new SymbolMap(familyType));
                                m_braceMaps.Add(new SymbolMap(familyType));
                            }
                            else if ("Structural Columns" == categoryName)
                            {
                                m_columnMaps.Add(new SymbolMap(familyType));
                            }
                        }
                    }
                }

            }
            catch
            {
                return false;
            }
            return true;
        }
开发者ID:AMEE,项目名称:revit,代码行数:62,代码来源:CreateBeamsColumnsBraces.cs

示例3: PrepareData

        /// <summary>
        /// initialize members using data from current Revit project
        /// </summary>
        private void PrepareData()
        {
            UIDocument doc = m_commandData.Application.ActiveUIDocument;
            m_beamTypes.Clear();

            // iterate all selected beams
            foreach (object obj in doc.Selection.Elements)
            {
                FamilyInstance beam = obj as FamilyInstance;
                if (null == beam)
                {
                    continue;
                }

                // add beam to lists according to category name
                string categoryName = beam.Category.Name;
                if ("Structural Framing" == categoryName
                    && beam.StructuralType == StructuralType.Beam)
                {
                    m_beams.Add(beam);
                }
            }

            //iterate all beam types
            FilteredElementIterator itor = new FilteredElementCollector(doc.Document).OfClass(typeof(Family)).GetElementIterator();
            itor.Reset();
            while (itor.MoveNext())
            {
                // get Family to get FamilySymbols
                Family aFamily = itor.Current as Family;
                if (null == aFamily)
                {
                    continue;
                }

                foreach (FamilySymbol symbol in aFamily.Symbols)
                {
                    if (null == symbol.Category)
                    {
                        continue;
                    }

                    // add symbols to lists according to category name
                    string categoryName = symbol.Category.Name;
                    if ("Structural Framing" == categoryName)
                    {
                        m_beamTypes.Add(symbol.Family.Name + ":" + symbol.Name, symbol);
                    }
                }
            }

            if (m_beams.Count == 0)
            {
                throw new ErrorMessageException("Please select beams.");
            }

            if (m_beamTypes.Count == 0)
            {
                throw new ErrorMessageException("There is no Beam families loaded in current project.");
            }
        }
开发者ID:AMEE,项目名称:revit,代码行数:64,代码来源:BeamSystemData.cs


注:本文中的FilteredElementCollector.Reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。