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


C# FilteredElementCollector.GetEnumerator方法代码示例

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


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

示例1: FoundationSlabHardWired

    FoundationSlabHardWired()
    {
      CurveArray curveArray = m_revitApp.Application.Create.NewCurveArray();

      XYZ location1 = GeomUtils.kOrigin;
      XYZ location2 = new XYZ( 0.0, 20.0, 0.0 );
      XYZ location3 = new XYZ( 20.0, 20.0, 0.0 );
      XYZ location4 = new XYZ( 20.0, 0.0, 0.0 );

      curveArray.Append( Line.CreateBound( location1, location2 ) );
      curveArray.Append( Line.CreateBound( location2, location3 ) );
      curveArray.Append( Line.CreateBound( location3, location4 ) );
      curveArray.Append( Line.CreateBound( location4, location1 ) );

      List<FloorType> floorTypeSet = new FilteredElementCollector(m_revitApp.ActiveUIDocument.Document).OfClass(typeof(FloorType)).Cast<FloorType>() as List<FloorType>;
      IEnumerator<FloorType> floorTypeSetIter = floorTypeSet.GetEnumerator();
      FloorType floorType = null;

      while( floorTypeSetIter.MoveNext() )
      {
        FloorType floorTypeTemp = floorTypeSetIter.Current as FloorType;
        if( floorTypeTemp.Name == "6\" Foundation Slab" )
        {
          floorType = floorTypeTemp;
          break;
        }

      }

      Level level = m_revitApp.ActiveUIDocument.Document.ActiveView.GenLevel;
      XYZ normal = GeomUtils.kZAxis;

      /// create a slab
      m_revitApp.ActiveUIDocument.Document.Create.NewFoundationSlab( curveArray, floorType, level, false, normal );

      /// floor slab is below all levels and is not visible in floor plan view!
      if( m_revitApp.ActiveUIDocument.Document.ActiveView.ViewType != ViewType.ThreeD
          && m_revitApp.ActiveUIDocument.Document.ActiveView.ViewType != ViewType.Elevation )
        MessageBox.Show( "Foundation slab created. Go to 3D or Elevation views to view" );
    }
开发者ID:15921050052,项目名称:RevitLookup,代码行数:40,代码来源:TestElements.cs

示例2: AnnoSymbol

    AnnoSymbol()
    {
      Revit.Document doc = m_revitApp.ActiveUIDocument.Document;

      FamilyItemFactory famFact = doc.FamilyCreate;

      List<AnnotationSymbolType> annoSymTypeSet = new FilteredElementCollector(doc).OfClass(typeof(AnnotationSymbol)).Cast<AnnotationSymbol>() as List<AnnotationSymbolType>;
      // TBD: why is the size only 2
      Int32 size = annoSymTypeSet.Count;

      IEnumerator<AnnotationSymbolType> annoSymTypeSetIter = annoSymTypeSet.GetEnumerator();

      AnnotationSymbolType annoSymType = null;

      while( annoSymTypeSetIter.MoveNext() )
      {
        AnnotationSymbolType tempAnnoSymType = annoSymTypeSetIter.Current as AnnotationSymbolType;

        if( null != tempAnnoSymType )
        {
          if( tempAnnoSymType.Name == "North Arrow 2" )
          {
            annoSymType = tempAnnoSymType;
          }
        }
      }

      if( annoSymType == null )
        return;

      XYZ location = GeomUtils.kOrigin;
      Autodesk.Revit.DB.View view = m_revitApp.ActiveUIDocument.Document.ActiveView;

      doc.Create.NewFamilyInstance( location, annoSymType, view );
    }
开发者ID:15921050052,项目名称:RevitLookup,代码行数:35,代码来源:TestElements.cs


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