EquipPartLocationCheck.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* ==============================================================================
  2. * 功能描述:SagaCheck
  3. * 创 建 者:Garrett
  4. * 创建日期:2019/6/11 16:09:09
  5. * ==============================================================================*/
  6. using System;
  7. using System.Linq;
  8. using System.Text.RegularExpressions;
  9. using Autodesk.Revit.DB;
  10. using SAGA.DotNetUtils.Extend;
  11. using ServiceRevitLib.Common;
  12. using SAGA.RevitUtils.Extends;
  13. using ServiceRevitLib.Extend;
  14. namespace ServiceRevitLib.Mode
  15. {
  16. /// <summary>
  17. /// SagaCheck
  18. /// </summary>
  19. class EquipPartLocationCheck : CheckBase
  20. {
  21. public override void Check()
  22. {
  23. base.Check();
  24. #region
  25. var document = m_Doc;
  26. var elements = document.GetEqEcElements();
  27. var parts = elements.Where(t => t.IsEquipmentPart());
  28. foreach (Element fi in parts)
  29. {
  30. var result = new EquipPartLocationCheckResult();
  31. result.PartFamilyName = fi.GetFamilyName();
  32. result.PartId = fi.Id.ToString();
  33. var partParent = fi.GetPartParent();
  34. if (partParent == null)
  35. {
  36. result.Result = ResultState.Failure;
  37. result.ResultMsg = "未与设备相交,请检查";
  38. }
  39. else
  40. {
  41. result.RefId = partParent.Id.ToString();
  42. result.Result = ResultState.Success;
  43. }
  44. Content.Add(result);
  45. }
  46. #endregion
  47. }
  48. }
  49. }