MepExtension.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* ==============================================================================
  2. * 功能描述:MepExtension
  3. * 创 建 者:Garrett
  4. * 创建日期:2019/9/20 16:20:45
  5. * ==============================================================================*/
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using Autodesk.Revit.DB;
  12. using Autodesk.Revit.DB.Mechanical;
  13. using Autodesk.Revit.DB.Plumbing;
  14. using SAGA.RevitUtils.Extends;
  15. namespace ServiceRevitLib.Extend
  16. {
  17. /// <summary>
  18. /// MepExtension
  19. /// </summary>
  20. public static class MepExtension
  21. {
  22. /// <summary>
  23. /// 获取系统名称
  24. /// </summary>
  25. /// <param name="mepCurve"></param>
  26. /// <returns></returns>
  27. public static string GetSystemTypeName(this MEPCurve mepCurve)
  28. {
  29. Parameter parameter = null;
  30. do
  31. {
  32. if (mepCurve is Pipe pipe)
  33. {
  34. parameter = pipe.GetParameter(BuiltInParameter.RBS_PIPING_SYSTEM_TYPE_PARAM);
  35. break;
  36. }
  37. if (mepCurve is Duct duct)
  38. {
  39. parameter = duct.GetParameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM);
  40. }
  41. } while (false);
  42. return parameter?.AsValueString() ?? string.Empty;
  43. }
  44. }
  45. }