/* ==============================================================================
* 功能描述:SagaCheck
* 创 建 者:Garrett
* 创建日期:2019/6/11 16:09:09
* ==============================================================================*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;
using SAGA.DotNetUtils.Extend;
using ServiceRevitLib.Common;
using SAGA.RevitUtils.Extends;
using ServiceRevitLib.Extend;
namespace ServiceRevitLib.Mode
{
///
/// SagaCheck
///
class EquipInSpaceCheck : CheckBase
{
public override void Check()
{
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
}
///
/// 获取检测结果
///
///
///
private EquipInSpaceCheckResult GetCheckResult(Element fi, List 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;
}
}
}