|
@@ -0,0 +1,141 @@
|
|
|
+/* ==============================================================================
|
|
|
+ * 功能描述:设备部件定位点和中心点对比检查
|
|
|
+ * 创 建 者:Garrett
|
|
|
+ * 创建日期:2018/10/23 15:08:55
|
|
|
+ * ==============================================================================*/
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using Autodesk.Revit.DB;
|
|
|
+using NPOI.SS.UserModel;
|
|
|
+using SAGA.DotNetUtils.Others;
|
|
|
+using SAGA.MBI.DataArrange;
|
|
|
+using SAGA.MBI.Tools;
|
|
|
+using SAGA.MBI.ToolsData.CheckBase;
|
|
|
+using SAGA.RevitUtils.Extends;
|
|
|
+
|
|
|
+namespace SAGA.MBI.ToolsData.ModeCheck
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// UnitCheck
|
|
|
+ /// </summary>
|
|
|
+ class EquipmentLocationCenterComparer : ModeCheckBase
|
|
|
+ {
|
|
|
+ public EquipmentLocationCenterComparer()
|
|
|
+ {
|
|
|
+ Name = "设备中心点检查";
|
|
|
+ }
|
|
|
+ [DataCheckProcessAspect]
|
|
|
+ public override bool Check()
|
|
|
+ {
|
|
|
+ if (!RBase.IsRight)
|
|
|
+ {
|
|
|
+ IsRight = RBase.IsRight;
|
|
|
+ return IsRight;
|
|
|
+ }
|
|
|
+ IsRight = GetCheckResult();
|
|
|
+ return IsRight;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public override void Correct()
|
|
|
+ {
|
|
|
+ throw new NotImplementedException();
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool GetCheckResult()
|
|
|
+ {
|
|
|
+ bool unitResult = true;
|
|
|
+ foreach (SagaSignCheckResult signResult in RBase.Results)
|
|
|
+ {
|
|
|
+ var document = signResult.RDocument;
|
|
|
+ var elements = document.GetFamilyInstances();
|
|
|
+ var equips = elements.Where(t => t.IsEquipmentPart()||t.IsEquipment());
|
|
|
+ foreach (FamilyInstance fi in equips)
|
|
|
+ {
|
|
|
+ var result = GetCheckResult(fi);
|
|
|
+ result.RBase = signResult;
|
|
|
+ Results.Add(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Results.All(t => t.IsRight);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取检测结果
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="fi"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
|
|
|
+ {
|
|
|
+ var result = new EquipmentPartRefEqCheckResult();
|
|
|
+ result.FamilyName = fi.GetFamily().Name;
|
|
|
+ result.Id = fi.Id.ToString();
|
|
|
+ XYZ location = fi.GetLocationPoint();
|
|
|
+ XYZ origin = fi.GetBoxCenter();
|
|
|
+ if (location.IsEqual2(origin))
|
|
|
+ {
|
|
|
+ result.IsRight = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result.IsRight = false;
|
|
|
+ result.RMessage = "定位点和中心点不重合,请检查";
|
|
|
+ }
|
|
|
+ result.LocationXYZ = location.ToString2();
|
|
|
+ result.CenterXYZ = origin.ToString();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ //[DataCheckProcessAspect]
|
|
|
+ public override void Export()
|
|
|
+ {
|
|
|
+ // Check();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ IWorkbook book = DCRExport.GetWorkbook();
|
|
|
+ //ISheet sheet = book.CreateSheet(Name);
|
|
|
+ ISheet sheet = book.GetSheet(Name);
|
|
|
+
|
|
|
+ #region 添加数据
|
|
|
+ int index = 3;
|
|
|
+ //IRow row4 = sheet.CreateRow(index);
|
|
|
+ //row4.HeightInPoints = 15;
|
|
|
+
|
|
|
+ //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
|
|
|
+ //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
|
|
|
+ //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
|
|
|
+ //row4.AddCell(3, "族名称", DataCheckNPOIStyle.Title);
|
|
|
+ //row4.AddCell(4, "ID", DataCheckNPOIStyle.Title);
|
|
|
+ //row4.AddCell(5, "通过", DataCheckNPOIStyle.Title);
|
|
|
+ //row4.AddCell(6, "备注(失败原因)", DataCheckNPOIStyle.Title);
|
|
|
+ foreach (EquipmentPartRefEqCheckResult result in Results)
|
|
|
+ {
|
|
|
+ SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
|
|
|
+ if (rbase == null)
|
|
|
+ continue;
|
|
|
+ index++;
|
|
|
+ IRow rowN = sheet.CreateRow(index);
|
|
|
+ DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
|
|
|
+
|
|
|
+ rowN.AddCell(0, rbase.RFloorName, style);
|
|
|
+ rowN.AddCell(1, rbase.RFileName, style);
|
|
|
+ rowN.AddCell(2, rbase.RPath, style);
|
|
|
+ rowN.AddCell(3, result.FamilyName, style);
|
|
|
+ rowN.AddCell(4, result.Id, style);
|
|
|
+ string rowN4 = result.IsRight ? "通过" : "不通过";
|
|
|
+ rowN.AddCell(5, rowN4, style);
|
|
|
+ rowN.AddCell(6, result.RMessage, style);
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ MessageShowBase.Show(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|