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


C# FilteredElementCollector.MoveNext方法代码示例

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


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

示例1: 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

示例2: 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

示例3: PrepareDoorFamilies

        /// <summary>
        /// get all the door families in the project. 
        /// And store them in two lists separately based on opening parameter.
        /// </summary>
        private void PrepareDoorFamilies()
        {
            // prepare DoorFamilies
              FilteredElementIterator familyIter = new FilteredElementCollector(m_app.ActiveUIDocument.Document).OfClass(typeof(Family)).GetElementIterator();

             while (familyIter.MoveNext())
             {
            Family doorFamily = familyIter.Current as Family;

            if (null == doorFamily.FamilyCategory) // some family.FamilyCategory is null
            {
               continue;
            }

            if (!doorFamily.FamilyCategory.Name.Equals("Doors"))
            {
               continue;
            }

            // create one instance of self class DoorFamily.
            DoorFamily tempDoorFamily = new DoorFamily(doorFamily, m_app);

            // store the created DoorFamily instance
            m_doorFamilies.Add(tempDoorFamily);
             }
        }
开发者ID:AMEE,项目名称:revit,代码行数:30,代码来源:DoorSwingData.cs

示例4: CheckFamilySymbol

        /// <summary>
        /// 1. Find all family symbols in current Revit document and store them
        /// 2. Find the index of default family symbol
        /// Point("Point-based"); Line("Line-based")
        /// </summary>
        public void CheckFamilySymbol(BasedType type)
        {
            m_defaultIndex = -1;
            m_familySymbolList.Clear();

            Autodesk.Revit.DB.FilteredElementIterator familySymbolItor =
                new FilteredElementCollector(m_revitDoc.Document).OfClass(typeof(FamilySymbol)).GetElementIterator();

            String defaultSymbolName = String.Empty;
            switch (type)
            {
                case BasedType.Point:
                    defaultSymbolName = "Point-based";
                    break;
                case BasedType.Line:
                    defaultSymbolName = "Line-based";
                    break;
                default:
                    break;
            }

            bool hasDefaultSymbol = false;
            int ii = 0;

            while (familySymbolItor.MoveNext())
            {
                FamilySymbol symbol = (FamilySymbol)familySymbolItor.Current;
                if(null == symbol)
                {
                    continue;
                }

                if (!hasDefaultSymbol && 0 == String.Compare(defaultSymbolName, symbol.Name))
                {
                    hasDefaultSymbol = true;
                    m_defaultIndex = ii;
                }

                // family symbol
                m_familySymbolList.Add(symbol);

                // family symbol name
                String familyCategoryname = String.Empty;
                if (null != symbol.Family.FamilyCategory)
                {
                    familyCategoryname = symbol.Family.FamilyCategory.Name + " : ";
                }
                m_familySymbolNameList.Add(String.Format("{0}{1} : {2}"
                    , familyCategoryname, symbol.Family.Name, symbol.Name));
                ii++;
            }

            if (!hasDefaultSymbol)
            {
                FamilySymbol loadedfamilySymbol = null;
                try
                {
                    m_revitDoc.Document.LoadFamilySymbol(String.Format(@"{0}.rfa", defaultSymbolName)
                        , defaultSymbolName
                        , out loadedfamilySymbol);
                }
                catch(Exception)
                {
                    MessageBox.Show("Can't load the prepared rfa.");
                }

                if (null == loadedfamilySymbol)
                {
                    return;
                }
                m_familySymbolList.Add(loadedfamilySymbol);

                String familyCategoryname = String.Empty;
                if (null != loadedfamilySymbol.Family.FamilyCategory)
                {
                    familyCategoryname = loadedfamilySymbol.Family.FamilyCategory.Name +": ";
                }
                m_familySymbolNameList.Add(String.Format("{0}{1}: {2}"
                    , familyCategoryname, loadedfamilySymbol.Family.Name, loadedfamilySymbol.Name));
                m_defaultIndex = m_familySymbolList.Count - 1;
            }

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

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