1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- /* ==============================================================================
- * 功能描述:SagaCheck
- * 创 建 者:Garrett
- * 创建日期:2019/6/11 16:09:09
- * ==============================================================================*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Autodesk.Revit.DB;
- using Autodesk.Revit.DB.Mechanical;
- using SAGA.RevitUtils.Extends;
- using ServiceRevitLib.Extend;
- using ServiceRevitLib.Mode;
- namespace ServiceRevitLib.DataCheck.Mode
- {
- /// <summary>
- /// SagaCheck
- /// </summary>
- class EquipInSpaceCheck : CheckBase
- {
- public override void Check()
- {
- try
- {
- base.Check();
- #region
- var document = m_Doc;
- var elements = document.GetEqEcElements();
- var rspaces = document.GetSpaces().Where(t => t.IsValidObject).ToList();
- foreach (Element fi in elements)
- {
- var result = GetCheckResult(fi, rspaces);
- Content.Add(result);
- }
- #endregion
- }
- catch (Exception e)
- {
- Result = ResultState.Failure;
- ResultMsg = $"{e.Message}\r\n{e.StackTrace}";
- }
- }
- /// <summary>
- /// 获取检测结果
- /// </summary>
- /// <param name="fi"></param>
- /// <returns></returns>
- private EquipInSpaceCheckResult GetCheckResult(Element fi, List<Space> spaces)
- {
- var result = new EquipInSpaceCheckResult();
- result.FamilyName = fi.GetFamilyName();
- result.Id = fi.Id.ToString();
- var space = fi.GetReferenceSpace(spaces);
- if (space != null)
- {
- result.SpaceId = space.Id.ToString();
- result.Result = ResultState.Success;
- }
- else
- {
- result.Result = ResultState.Failure;
- result.ResultMsg = "请检查设备是否在空间中";
- }
- return result;
- }
- }
- }
|