|
@@ -12,6 +12,7 @@ using Autodesk.Revit.DB;
|
|
|
using Autodesk.Revit.DB.Mechanical;
|
|
|
using Autodesk.Revit.DB.Plumbing;
|
|
|
using SAGA.DotNetUtils.Data;
|
|
|
+using SAGA.DotNetUtils.Extend;
|
|
|
using SAGA.GplotRelationComputerManage.ColdRoom;
|
|
|
using SAGA.Models;
|
|
|
using SAGA.Models.GplotElement;
|
|
@@ -259,7 +260,7 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
drawRecord.SystemName = startNode.Flag;
|
|
|
drawRecords.Add(drawRecord);
|
|
|
|
|
|
- var relationRecord = BuildFloorRelationRecord(relationSetting, useNode);
|
|
|
+ var relationRecord = BuildFloorRelationRecord(relationSetting, useNode,context);
|
|
|
relationRecords.Add(relationRecord);
|
|
|
}
|
|
|
|
|
@@ -316,7 +317,7 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
drawRecord.SystemName = systemTypeName;
|
|
|
drawRecords.Add(drawRecord);
|
|
|
|
|
|
- var relationRecord = BuildFloorRelationRecord(relationSetting, startNode);
|
|
|
+ var relationRecord = BuildFloorRelationRecord(relationSetting, startNode,context);
|
|
|
relationRecords.Add(relationRecord);
|
|
|
|
|
|
#endregion
|
|
@@ -417,12 +418,32 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
return floorDraw;
|
|
|
}
|
|
|
|
|
|
- private FloorRelationRecord BuildFloorRelationRecord(RelationTypeShell relationShell, ElementTreeNode node)
|
|
|
+ private FloorRelationRecord BuildFloorRelationRecord(RelationTypeShell relationShell, ElementTreeNode node, SystemComputerContext context)
|
|
|
{
|
|
|
var floorRelation = new FloorRelationRecord();
|
|
|
floorRelation.SetFloorLevel(UseLevel);
|
|
|
floorRelation.RelationType = relationShell.RelationItem.Type;
|
|
|
- floorRelation.RelationItems = SystemParseManager.CreateRelation(node) ?? new List<BinaryRelationItem>();
|
|
|
+ var records= SystemParseManager.CreateRelation(node) ?? new List<BinaryRelationItem>();
|
|
|
+ floorRelation.RelationItems = records;
|
|
|
+ var mathSystem=relationShell.GetFirstMatchSystem(node.PipeSystemTypeName);
|
|
|
+ var edgeType = mathSystem.ContainEdgeTypes.FirstOrDefault();
|
|
|
+ if(string.IsNullOrWhiteSpace(edgeType))
|
|
|
+ {
|
|
|
+ edgeType = "1";
|
|
|
+ }
|
|
|
+
|
|
|
+ //增加关联对象名称
|
|
|
+ records.ForEach(e => {
|
|
|
+ var nodes = new List<EquipmentNode>() { e.From, e.To };
|
|
|
+ nodes.ForEach(n => n.MbiId = context.EquipmentItems.GetItem(n.BimId)?.Id);
|
|
|
+ e.RelationType = edgeType;
|
|
|
+ if(mathSystem!=null&&mathSystem.FlowType==FlowType.Out)
|
|
|
+ {
|
|
|
+ //根据流向反转关系
|
|
|
+ e.Reverse();
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
return floorRelation;
|
|
|
}
|
|
|
|
|
@@ -520,7 +541,9 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
List<Element> useStartElements = new List<Element>(startElements);
|
|
|
var arrays = parse.Execute(useStartElements);
|
|
|
arrays.RemoveAll(c => c.GetAvailableVertexes(null).All(v => !v.IsRealEquipment()));
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#region 生成图形数据
|
|
|
ColdRoomManager manager = new ColdRoomManager();
|
|
|
var doc = manager.CreateDocument(new List<ElementEdgesArray>(arrays));
|
|
@@ -538,8 +561,8 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
foreach (var item in relations)
|
|
|
{
|
|
|
var node = new BinaryRelationItem();
|
|
|
- node.From = new EquipmentNode() { RevitId = item.EquipmentItem1.Id };
|
|
|
- node.To = new EquipmentNode() { RevitId = item.EquipmentItem2.Id };
|
|
|
+ node.From = ConverEquipmentNode(item.EquipmentItem1, context);
|
|
|
+ node.To = ConverEquipmentNode(item.EquipmentItem2, context);
|
|
|
node.RelationType = item.LinkType;
|
|
|
relationRecord.RelationItems.Add(node);
|
|
|
|
|
@@ -555,6 +578,24 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
return useEquipments;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private EquipmentNode ConverEquipmentNode(EquipmentItem item, SystemComputerContext context)
|
|
|
+ {
|
|
|
+ EquipmentNode result = new EquipmentNode();
|
|
|
+ result.RevitId = item.Id;
|
|
|
+ result.BimId = CreateBimId(result.RevitId);
|
|
|
+ result.MbiId = context.EquipmentItems.GetItem(result.BimId)?.Id ?? string.Empty;
|
|
|
+ return result;
|
|
|
+ }
|
|
|
#endregion 解析机房数据
|
|
|
+ /// <summary>
|
|
|
+ /// 根据revitId获取bimId
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="revitId"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private string CreateBimId(string revitId)
|
|
|
+ {
|
|
|
+ return string.Format($"{Document.PathName.GetFileName()}:{revitId}");
|
|
|
+ }
|
|
|
}
|
|
|
}
|