using Autodesk.Revit.DB;
|
using Autodesk.Revit.DB.Plumbing;
|
using Glodon.Revit.Utility;
|
using HStation.RevitDev.RevitDataExport.Common;
|
using HStation.RevitDev.RevitDataExport.Utility;
|
using HStation.RevitDev.RevitDataExport.Utils;
|
using System;
|
using System.Collections.Generic;
|
|
namespace HStation.RevitDev.RevitDataExport.Parser
|
{
|
/// <summary>
|
/// 管道
|
/// </summary>
|
public class PipeParser : BaseParser
|
{
|
public override List<BuiltInCategory> FilterCategories
|
{
|
get
|
{
|
return new List<BuiltInCategory>
|
{
|
BuiltInCategory.OST_PipeCurves
|
};
|
}
|
}
|
public override List<string> FilterRegexes
|
{
|
get
|
{
|
return new List<string>
|
{
|
""
|
};
|
}
|
}
|
|
public override string GetParserName()
|
{
|
return "管道";
|
}
|
|
public override List<Tuple<string, string>> PropertyParse(Element elem)
|
{
|
var result = new List<Tuple<string, string>>();
|
var pipe = elem as Pipe;
|
if (pipe == null) { return result; }
|
var connectInfos = MEPHelper.GetConnecters(pipe);
|
result.AddRange(CommonPropertyParse(elem));
|
for (int i = 1; i <= 2; i++)
|
{
|
if (connectInfos.Count >= i)
|
{
|
result.Add(new Tuple<string, string>($"连接点{i}", connectInfos[i - 1]?.ElementId.ToString()));
|
}
|
else
|
{
|
result.Add(new Tuple<string, string>($"连接点{i}", string.Empty));
|
}
|
}
|
|
//端点
|
var location = pipe.Location as LocationCurve;
|
if (location != null)
|
{
|
var start = location.Curve.GetEndPoint(0);
|
var end = location.Curve.GetEndPoint(1);
|
var standardStart = new XYZ(start.X * 304.8, start.Y * 304.8, start.Z * 304.8);
|
var standardEnd = new XYZ(end.X * 304.8, end.Y * 304.8, end.Z * 304.8);
|
result.Add(new Tuple<string, string>("端点", JsonHelper.ToJson(new { standardStart, standardEnd })));
|
}
|
|
// 直径
|
result.Add(new Tuple<string, string>($"直径", pipe.Diameter.FeetToMM().ToString()));
|
|
// 长度
|
var length = ParameterOperator.GetParameterValueAsString(pipe, "长度"); //(pipe.Location as LocationCurve).Curve.Length.FeetToMM();
|
result.Add(new Tuple<string, string>($"长度", (decimal.Parse(length.ToString()) / 1000).ToString()));
|
|
// 流量
|
var flow = ParameterOperator.GetParameterValueAsDouble(pipe, "流量");
|
result.Add(new Tuple<string, string>($"流量", flow.ToString()));
|
|
// 流速
|
var flowSpeed = ParameterOperator.GetParameterValueAsDouble(pipe, "流速");
|
result.Add(new Tuple<string, string>($"流速", flowSpeed.ToString()));
|
|
// 压力损失
|
var pressureLoss = ParameterOperator.GetParameterValueAsDouble(pipe, "压力损失");
|
result.Add(new Tuple<string, string>($"压力损失", pressureLoss.ToString()));
|
|
// 比摩阻
|
var specificFriction = ParameterOperator.GetParameterValueAsDouble(pipe, "比摩阻");
|
result.Add(new Tuple<string, string>($"比摩阻", specificFriction.ToString()));
|
return result;
|
}
|
}
|
}
|