123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /*-------------------------------------------------------------------------
- * 功能描述: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 JMepSystem = JBIM.Component.MepSystem;
- using JMepSystemType = JBIM.Component.MepSystemType;
- namespace RevitToJBim.ComponentParse
- {
- //[UsableParse]
- public class ParseMepSystem : ParseBase
- {
- public override List<string> FastIndex()
- {
- return new List<string>(){typeof(PipingSystem).FullName, typeof(MechanicalSystem).FullName };
- }
- public override bool Match(ElementWrapper wrapper)
- {
- return wrapper.RefElement is MEPSystem;
- }
- protected override List<BimId> 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<BimId>() { jBimObject.Id };
- }
- }
- //[UsableParse]
- public class ParseMepSystemType : ParseBase
- {
- public override List<string> FastIndex()
- {
- return new List<string>() { typeof(PipingSystemType).FullName, typeof(MechanicalSystemType).FullName };
- }
- public override bool Match(ElementWrapper wrapper)
- {
- return wrapper.RefElement is MEPSystemType;
- }
- protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
- {
- JMepSystemType jBimObject = new JMepSystemType();
- ParseCore.AttachObject(jBimObject, wrapper);
- context.AddBimObject(jBimObject);
- return new List<BimId>() { jBimObject.Id };
- }
- }
- }
|