using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Plumbing;
using Glodon.Revit.Utility;
using HStation.RevitDev.RevitDataExport.Common;
using HStation.RevitDev.RevitDataExport.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HStation.RevitDev.RevitDataExport.Parser
{
///
/// 喷淋
///
public class PenLinParser : BaseParser
{
public override List FilterCategories
{
get
{
return new List
{
BuiltInCategory.OST_Sprinklers,
BuiltInCategory.OST_PipeFitting,
BuiltInCategory.OST_PipeAccessory,
BuiltInCategory.OST_GenericModel
};
}
}
public override List FilterRegexes
{
get
{
return new List
{
"喷淋|喷头"
};
}
}
public override string GetParserName()
{
return "喷淋";
}
public override List> PropertyParse(Element elem)
{
var result = new List>();
var fi = elem as FamilyInstance;
if (fi == null) { return result; }
var connectInfos = MEPHelper.GetConnecters(fi);
result.AddRange(CommonPropertyParse(elem));
for (int i = 1; i <= 5; i++)
{
if (connectInfos.Count >= i)
{
result.Add(new Tuple($"连接点{i}", connectInfos[i - 1]?.ElementId.ToString()));
}
else
{
result.Add(new Tuple($"连接点{i}", string.Empty));
}
}
var length = ParameterOperator.GetParameterValueAsDouble(elem, "K 系数_x"); //(pipe.Location as LocationCurve).Curve.Length.FeetToMM();
var k = "161.4";
if (length.HasValue)
{
k = length.Value.ToString("f2");
}
result.Add(new Tuple($"K系数", k));
return result;
}
}
}