1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /*-------------------------------------------------------------------------
- * 功能描述:ParsePipe
- * 作者:xulisong
- * 创建时间: 2019/6/13 16:54:19
- * 版本号:v1.0
- * -------------------------------------------------------------------------*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB.Plumbing;
- using JBIM;
- using JBIM.Relationship;
- using RevitExport;
- using RevitToJBim.Common;
- using SAGA.RevitUtils.Extends;
- using JPipe=JBIM.Component.Pipe;
- namespace RevitToJBim.ComponentParse
- {
- [UsableParseAttribute]
- public class ParsePipe : ParseBase
- {
- public override List<string> FastIndex()
- {
- return new List<string>() { typeof(Pipe).FullName };
- }
- public override bool Match(ElementWrapper wrapper)
- {
- return wrapper.RefElement is Pipe;
- }
- protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
- {
- /*
- * 解析思路:1、解析当前对象具体信息。
- * 2、维护一些构件的关联管理关系,可以放在这个方法中,也可以放在ArrangeRefElements中
- *
- */
- if (!(wrapper.RefElement is Pipe pipe))
- {
- return null;
- }
- JPipe jPipe = new JPipe();
- ParseCore.AttachObject(jPipe, wrapper);
- jPipe.Diameter = BimConvert.Round(pipe.Diameter.FromApi());
- jPipe.Location.Add(BimConvert.ConvertToXYZ(pipe.GetCurve().StartPoint()));
- jPipe.Location.Add(BimConvert.ConvertToXYZ(pipe.GetCurve().EndPoint()));
- Polygon outLine = new Polygon(jPipe.Location);
- jPipe.OutLine.Add(outLine);
- context.AddBimObject(jPipe);
- #region 关联数据处理相关
- #region 系统关系
- var pipeId = pipe.Id.ToString();
- var systemId = pipe.MEPSystem.Id.ToString();
- OneToOneRel rel = new OneToOneRel(pipeId, systemId);
- rel.SetElementType(TypeDefinition.MepSystem);
- context.RelationShips.Add(rel);
- #endregion
- #region Connector连接关系
-
- #endregion
- #endregion
- return new List<BimId>(){ jPipe.Id };
- }
- public override List<ElementWrapper> ArrangeRefElements(ElementWrapper wrapper, JBimParseContext context)
- {
- if (!(wrapper.RefElement is Pipe pipe))
- {
- return null;
- }
- //创建MepSystem
- var mepSystemElementWrapper = new ElementWrapper(pipe.MEPSystem);
- return new List<ElementWrapper>() {mepSystemElementWrapper};
- }
- }
- }
|