Beispiel #1
0
        /// <summary>
        /// Creates a new annotation symbol
        /// </summary>
        public void AnnoSymbol()
        {
            Revit.Document doc = m_revitApp.ActiveUIDocument.Document;

              FamilyItemFactory famFact = doc.FamilyCreate;

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

              AnnotationSymbolTypeSetIterator annoSymTypeSetIter = annoSymTypeSet.ForwardIterator();

              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 );
        }
Beispiel #2
0
        /// <summary>
        /// Creates hardwired foundation slabs
        /// </summary>
        public void 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 ) );

              FloorTypeSet floorTypeSet = new FilteredElementCollector( m_revitApp.ActiveUIDocument.Document ).OfClass( typeof( FloorType ) ).Cast<FloorType>() as FloorTypeSet;
              FloorTypeSetIterator floorTypeSetIter = floorTypeSet.ForwardIterator();
              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" );
        }