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


C# FilteredElementCollector.OfCategoryId方法代码示例

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


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

示例1: ClsCategory

        public ClsCategory(Category cat, Document doc)
        {
            _Cat = cat;
            _Doc = doc;

            FilteredElementCollector col = new FilteredElementCollector(doc);
            col.OfCategoryId(cat.Id).WhereElementIsNotElementType();

            _InstanceElements = col.ToElements().ToList();
        }
开发者ID:dangwalsh,项目名称:CompareParams,代码行数:10,代码来源:ClsCategory.cs

示例2: GetTargetInstances

        /// <summary>
        /// Return all element instances for a given 
        /// category, identified either by a built-in 
        /// category or by a category name.
        /// </summary>
        public static FilteredElementCollector GetTargetInstances(
            Document doc,
            object targetCategory)
        {
            FilteredElementCollector collector
            = new FilteredElementCollector( doc );

              bool isName = targetCategory.GetType().Equals(
            typeof( string ) );

              if ( isName )
              {
            Category cat = doc.Settings.Categories
              .get_Item( targetCategory as string );

            collector.OfCategoryId( cat.Id );
              }
              else
              {
            collector.WhereElementIsNotElementType();

            collector.OfCategory( (BuiltInCategory) targetCategory );

            //var model_elements
            //  = from e in collector
            //    where ( null != e.Category && e.Category.HasMaterialQuantities )
            //    select e;

            //elements = model_elements.ToList<Element>();
              }
              return collector;
        }
开发者ID:jeremytammik,项目名称:FireRatingCloud,代码行数:37,代码来源:Util.cs

示例3: GetTargetInstances

        /// <summary>
        /// Helper to get all instances for a given category,
        /// identified either by a built-in category or by a category name.
        /// </summary>
        public static List<Element> GetTargetInstances(
            Document doc,
            object targetCategory)
        {
            List<Element> elements;

              bool isName = targetCategory.GetType().Equals( typeof( string ) );

              if( isName )
              {
            Category cat = doc.Settings.Categories.get_Item( targetCategory as string );
            FilteredElementCollector collector = new FilteredElementCollector( doc );
            collector.OfCategoryId( cat.Id );
            elements = new List<Element>( collector );
              }
              else
              {
            FilteredElementCollector collector
              = new FilteredElementCollector( doc )
            .WhereElementIsNotElementType();

            collector.OfCategory( (BuiltInCategory) targetCategory );

            // I removed this to test attaching a shared
            // parameter to Material elements:
            //
            //var model_elements = from e in collector
            //                     where ( null != e.Category && e.Category.HasMaterialQuantities )
            //                     select e;

            //elements = model_elements.ToList<Element>();

            elements = collector.ToList<Element>();
              }
              return elements;
        }
开发者ID:jeremytammik,项目名称:AdnRevitApiLabsXtra,代码行数:40,代码来源:LabUtils.cs


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