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


C# FilteredElementCollector.Excluding方法代码示例

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


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

示例1: GetUnusedTextNoteTypesExcluding

        /// <summary>
        /// Return all unused text note types by first
        /// determining all text note types in use and
        /// then collecting all the others using an
        /// exclusion filter.
        /// </summary>
        ICollection<ElementId> GetUnusedTextNoteTypesExcluding(
            Document doc)
        {
            ICollection<ElementId> usedTextNotesTypeIds
            = new Collection<ElementId>();

              FilteredElementCollector textNotes
            = new FilteredElementCollector( doc )
              .OfClass( typeof( TextNote ) );

              foreach( TextNote textNote in textNotes )
              {
            usedTextNotesTypeIds.Add(
              textNote.TextNoteType.Id );
              }

              FilteredElementCollector unusedTypeCollector
            = new FilteredElementCollector( doc )
              .OfClass( typeof( TextNoteType ) );

              if( 0 < usedTextNotesTypeIds.Count )
              {
            unusedTypeCollector.Excluding(
              usedTextNotesTypeIds );
              }

              ICollection<ElementId> unusedTypes
            = unusedTypeCollector.ToElementIds();

              return unusedTypes;
        }
开发者ID:JesseMom,项目名称:the_building_coder_samples,代码行数:37,代码来源:CmdPurgeTextNoteTypes.cs

示例2: findBlockingElements

        /// <summary>
        /// Find elements blocking egress
        /// </summary>
        /// <param name="egresses">The egresses to be detected</param>
        /// <returns>The detection result</returns>
        public XElement findBlockingElements(ICollection<Element> egresses)
        {
            // create a node that place all egresses.
             XElement egressesNode = new XElement("Egresses", new XAttribute("Name", "Egresses"));

             try
             {
            // find the elements blocking egress
            foreach (Element egressElement in egresses)
            {
               XElement egressNode = new XElement("Egress",
                  new XAttribute("Name", egressElement.Name));

               int count = 1;
               foreach (GeometryObject egressGObj in
                  (egressElement.get_Geometry(new Autodesk.Revit.DB.Options()).Objects.get_Item(0) as GeometryInstance).GetInstanceGeometry().Objects)
               {
                  if (egressGObj is Solid)
                  {
                     Solid egressVolume = egressGObj as Solid; //calculated from shape and location of a given door

                     XElement solidNode = new XElement("ElementSolid" + count.ToString());
                     // Iterate to find all instance types
                     FilteredElementCollector blockingcollector = new FilteredElementCollector(m_doc);
                     blockingcollector.WhereElementIsNotElementType();

                     // Apply geometric filter
                     ElementIntersectsSolidFilter testElementIntersectsSolidFilter =
                        new ElementIntersectsSolidFilter(egressVolume);
                     blockingcollector.WherePasses(testElementIntersectsSolidFilter);

                     IEnumerable<Element> blockingElement = blockingcollector;

                     // Exclude the door itself
                     List<ElementId> exclusions = new List<ElementId>();
                     exclusions.Add(egressElement.Id);
                     blockingcollector.Excluding(exclusions);

                     XElement blockingegressNode = new XElement("blocking_egress_elements",
                        new XAttribute("Count", blockingElement.Count().ToString()));

                     foreach (Element blockingelement in blockingElement)
                     {
                        blockingegressNode.Add(new XElement("blocking_egress_element",
                           new XAttribute("Name", blockingelement.Name)));
                     }

                     solidNode.Add(blockingegressNode);
                     egressNode.Add(solidNode);

                     count++;
                  }
               }
               egressesNode.Add(egressNode);
            }
             }
             catch (Exception ex)
             {
            egressesNode.Add(new XElement("Error", new XAttribute("Exception", ex.ToString())));
             }

             // return the whole Egresses Node
             return egressesNode;
        }
开发者ID:AMEE,项目名称:revit,代码行数:69,代码来源:ProximityDetection.cs


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