/* ==============================================================================
 * 功能描述：MepExtension  
 * 创 建 者：Garrett
 * 创建日期：2019/9/20 16:20:45
 * ==============================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.DB.Plumbing;
using SAGA.RevitUtils.Extends;

namespace ServiceRevitLib.Extend
{
    /// <summary>
    /// MepExtension
    /// </summary>
    public static class MepExtension
    {
        /// <summary>
        /// 获取系统名称
        /// </summary>
        /// <param name="mepCurve"></param>
        /// <returns></returns>
        public static string GetSystemTypeName(this MEPCurve mepCurve)
        {
            Parameter parameter = null;
            do
            {
                if (mepCurve is Pipe pipe)
                {
                    parameter = pipe.GetParameter(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM);
                    break;
                }
                if (mepCurve is Duct duct)
                {
                    parameter = duct.GetParameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM);
                }
            } while (false);

            return parameter?.AsValueString() ?? string.Empty;
        }
        
    }
}
