RevitLookup.Test.TestElements.SimpleFloor C# (CSharp) Method

SimpleFloor() public method

Used by the SimpleShed to create its floors and the fake roof
public SimpleFloor ( CurveArray profile, Level level ) : Autodesk.Revit.DB.ElementId
profile CurveArray
level Level
return Autodesk.Revit.DB.ElementId
        public Revit.ElementId SimpleFloor( CurveArray profile, Level level )
        {
            Autodesk.Revit.Creation.Document doc = m_revitApp.ActiveUIDocument.Document.Create;
              Autodesk.Revit.Creation.Application applic = m_revitApp.Application.Create;

              // Obtain the required floor type
              FloorType floorType = null;

              try
              {
            FilteredElementCollector fec = new FilteredElementCollector( m_revitApp.ActiveUIDocument.Document );
            ElementClassFilter elementsAreWanted = new ElementClassFilter( typeof( FloorType ) );
            fec.WherePasses( elementsAreWanted );
            List<Element> elements = fec.ToElements() as List<Element>;

            foreach( Element element in elements )
            {
              FloorType fType = element as FloorType;

              if( fType == null )
              {
            continue;
              }

              if( fType.Name == "Generic - 12\"" )
              {
            floorType = fType;
              }
            }
              }
              catch( Exception e )
              {
            throw e;
              }

              // Set the stuctural value
              bool structural = true;

              Revit.ElementId elemId = new ElementId( 0 );

              // Create the floor instance
              try
              {
            if( level.Name == "Level 2" )
            {
              level.Elevation = 10.0;

              Floor f = doc.NewFloor( profile, floorType, level, structural );

              Revit.ElementId fId = f.Id;
              m_shedElements.Add( fId );

              // This param need to be set for any level above Level 1 for the floor to move to the correct level
              Revit.Parameter midFloorparam = f.get_Parameter( BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM );
              midFloorparam.Set( 0.0 );

              return f.LevelId;
            }

            if( level.Name == "Level 1" )
            {

              Floor f = doc.NewFloor( profile, floorType, level, structural );

              Revit.ElementId fId = f.Id;
              m_shedElements.Add( fId );

              return f.LevelId;
            }

            // if none of the types match
            return elemId;
              }
              catch( Exception e )
              {
            throw e;
              }
        }

Same methods

TestElements::SimpleFloor ( ) : void