|
@@ -7,6 +7,8 @@ using System.Threading.Tasks;
|
|
|
using SAGA.RevitUtils.Extends;
|
|
|
using SAGA.RevitUtils.MEP;
|
|
|
using SAGA.RevitUtils;
|
|
|
+using SAGA.MBI.Tools;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace SAGA.GplotRelationComputerManage
|
|
|
{
|
|
@@ -17,12 +19,25 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
{
|
|
|
public SystemParseSetting(GplotOptions options)
|
|
|
{
|
|
|
- GplotOptions = options;
|
|
|
+ //GplotOptions = options;
|
|
|
}
|
|
|
+ public SystemParseSetting(RelationTypeShell relationShell)
|
|
|
+ {
|
|
|
+ RelationTypeShell = relationShell;
|
|
|
+ Domain = relationShell.IsPipeSystem() ? Domain.DomainPiping : Domain.DomainHvac;
|
|
|
+ }
|
|
|
+ ///// <summary>
|
|
|
+ ///// 图相关设置
|
|
|
+ ///// </summary>
|
|
|
+ //public GplotOptions GplotOptions { get; set; }
|
|
|
/// <summary>
|
|
|
- /// 图相关设置
|
|
|
+ /// 关系类型相关
|
|
|
/// </summary>
|
|
|
- public GplotOptions GplotOptions { get; set; }
|
|
|
+ public RelationTypeShell RelationTypeShell { get;private set; }
|
|
|
+ /// <summary>
|
|
|
+ /// 使用域枚举
|
|
|
+ /// </summary>
|
|
|
+ public Domain Domain { get;private set; }
|
|
|
#region 设置相关信息
|
|
|
/*
|
|
|
* 1、确定边界:
|
|
@@ -39,7 +54,7 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
/// <returns></returns>
|
|
|
public bool IsForkNode(Element element)
|
|
|
{
|
|
|
- Domain domain = GplotOptions.GplotType.GetDomain();
|
|
|
+ Domain domain = Domain;
|
|
|
var connectors = element.GetConnectors(domain);
|
|
|
return connectors.Count > 2;
|
|
|
}
|
|
@@ -47,7 +62,7 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
public List<JoinItem> GetJoinItems(Element element,List<int> usedIds)
|
|
|
{
|
|
|
List<JoinItem> joinItems = new List<JoinItem>();
|
|
|
- Domain domain = GplotOptions.GplotType.GetDomain();
|
|
|
+ Domain domain = Domain;
|
|
|
var connectors = element.GetConnectors(domain);
|
|
|
foreach (var connector in connectors)
|
|
|
{
|
|
@@ -92,20 +107,7 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
- List<BuiltInCategory> categories = new List<BuiltInCategory>();
|
|
|
- categories.Add(BuiltInCategory.OST_PipeAccessory);
|
|
|
- categories.Add(BuiltInCategory.OST_PipeFitting);
|
|
|
- categories.Add(BuiltInCategory.OST_DuctAccessory);
|
|
|
- categories.Add(BuiltInCategory.OST_DuctFitting);
|
|
|
- if (categories.Any(c => element.Category.Id.IntegerValue == (int)c))
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- string namePrefix = element.GetFamily()?.Name??string.Empty;
|
|
|
- var array = namePrefix.Split('-');
|
|
|
- bool checkName = array.Any() && array[0].Count() == 4 && array[0].All(c => char.IsLetter(c));
|
|
|
- return checkName;
|
|
|
+ return MBIInfoUtil.IsEquipment(element);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 无用边,节点可连通
|
|
@@ -139,12 +141,12 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
if (owner is MEPCurve mepCurve)
|
|
|
{
|
|
|
string typeName = mepCurve.GetSystemTypeName();
|
|
|
- result = !GplotOptions.MatchSystemType(typeName);
|
|
|
+ result = !RelationTypeShell.IsMatchSystem(typeName);
|
|
|
break;
|
|
|
}
|
|
|
- if (owner is FamilyInstance && (owner as FamilyInstance).GetFamily().Name == GplotOptions.ValveName)
|
|
|
+ if (SystemCalcUtil.IsStartValve(owner))
|
|
|
{
|
|
|
- result = connector.Description != GplotOptions.ValveConnectorDescription;
|
|
|
+ result = Regex.IsMatch(connector.Description, AppSetting.EndFlag);// connector.Description != GplotOptions.ValveConnectorDescription;
|
|
|
break;
|
|
|
}
|
|
|
#endregion
|
|
@@ -154,7 +156,7 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
if (mepCurves.Any())
|
|
|
{
|
|
|
string typeName = (mepCurves[0] as MEPCurve).GetSystemTypeName();
|
|
|
- result = !GplotOptions.MatchSystemType(typeName);
|
|
|
+ result = !RelationTypeShell.IsMatchSystem(typeName);// !GplotOptions.MatchSystemType(typeName);
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -170,8 +172,13 @@ namespace SAGA.GplotRelationComputerManage
|
|
|
/// <returns></returns>
|
|
|
public bool IsSpecialValve(Element element)
|
|
|
{
|
|
|
- return (element is FamilyInstance && (element as FamilyInstance).GetFamily().Name == GplotOptions.ValveName);
|
|
|
+ if(element is FamilyInstance fi)
|
|
|
+ {
|
|
|
+ var name = fi.GetFamily().Name;
|
|
|
|
|
|
+ return Regex.IsMatch(name, AppSetting.FamilyStartFlag);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
#endregion
|
|
|
}
|