/* ============================================================================== * 功能描述:SagaCheck * 创 建 者:Garrett * 创建日期:2019/6/11 16:09:09 * ==============================================================================*/ using System; using System.Linq; using Autodesk.Revit.DB; using ServiceRevitLib.Extend; using ServiceRevitLib.Mode; namespace ServiceRevitLib.DataCheck.Mode { /// /// SagaCheck /// class EquipPartLocationCheck : CheckBase { public override void Check() { try { base.Check(); #region var document = m_Doc; var elements = document.GetEqEcElements(); var parts = elements.Where(t => t.IsEquipmentPart()); foreach (Element fi in parts) { var result = new EquipPartLocationCheckResult(); result.PartFamilyName = fi.GetFamilyName(); result.PartId = fi.Id.ToString(); var partParent = fi.GetPartParent(); if (partParent == null) { result.Result = ResultState.Failure; result.ResultMsg = "未与设备相交,请检查"; } else { result.Result = ResultState.Success; result.ResultMsg = $"关联设备的id为{partParent.Id}"; } Content.Add(result); } #endregion } catch (Exception e) { Result = ResultState.Failure; ResultMsg = $"{e.Message}\r\n{e.StackTrace}"; } } } }