BuildingCoder.CmdColumnRound.GetColumHeightFromLevels C# (CSharp) Method

GetColumHeightFromLevels() public method

Determine the height of a vertical column from its top and bottom level.
public GetColumHeightFromLevels ( Element e ) : Double
e Element
return Double
        public Double GetColumHeightFromLevels( 
            Element e)
        {
            if( !IsColumn( e ) )
              {
            throw new ArgumentException(
              "Expected a column argument." );
              }

              Document doc = e.Document;

              double height = 0;

              if( e != null )
              {
            // Get top level of the column

            Parameter topLevel = e.get_Parameter(
              BuiltInParameter.FAMILY_TOP_LEVEL_PARAM );

            ElementId ip = topLevel.AsElementId();
            Level top = doc.GetElement( ip ) as Level;
            double t_value = top.ProjectElevation;

            // Get base level of the column

            Parameter BotLevel = e.get_Parameter(
              BuiltInParameter.FAMILY_BASE_LEVEL_PARAM );

            ElementId bip = BotLevel.AsElementId();
            Level bot = doc.GetElement( bip ) as Level;
            double b_value = bot.ProjectElevation;

            // At this point, there are a number of
            // additional Z offsets that may also affect
            // the result.

            height = ( t_value - b_value );
              }
              return height;
        }