/*------------------------------------------------------------------------- * 功能描述:ParseMepSystem * 作者:xulisong * 创建时间: 2019/6/18 9:16:15 * 版本号:v1.0 * -------------------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Mechanical; using Autodesk.Revit.DB.Plumbing; using JBIM; using RevitExport; using RevitExport.Export; using JMepSystem = JBIM.Component.MepSystem; using JMepSystemType = JBIM.Component.MepSystemType; namespace RevitToJBim.ComponentParse { //[UsableParse] public class ParseMepSystem : ParseBase { public override List FastIndex() { return new List(){typeof(PipingSystem).FullName, typeof(MechanicalSystem).FullName }; } public override bool Match(ElementWrapper wrapper) { return wrapper.RefElement is MEPSystem; } protected override List ParseInner(ElementWrapper wrapper, JBimParseContext context) { JMepSystem jBimObject = new JMepSystem(); ParseCore.AttachObject(jBimObject, wrapper); var document = wrapper.RefElement.Document; #region 直接自己获取解析信息,不通过架构获取 var mepSystemType = document.GetElement(wrapper.RefElement.GetTypeId()) as MEPSystemType; if (mepSystemType != null) { ElementWrapper systemTypeWrapper = new ElementWrapper(mepSystemType); jBimObject.TypeId = context.Parser.ParseElement(systemTypeWrapper)?.FirstOrDefault(); } #endregion context.AddBimObject(jBimObject); return new List() { jBimObject.Id }; } } //[UsableParse] public class ParseMepSystemType : ParseBase { public override List FastIndex() { return new List() { typeof(PipingSystemType).FullName, typeof(MechanicalSystemType).FullName }; } public override bool Match(ElementWrapper wrapper) { return wrapper.RefElement is MEPSystemType; } protected override List ParseInner(ElementWrapper wrapper, JBimParseContext context) { JMepSystemType jBimObject = new JMepSystemType(); ParseCore.AttachObject(jBimObject, wrapper); context.AddBimObject(jBimObject); return new List() { jBimObject.Id }; } } }