|
@@ -0,0 +1,79 @@
|
|
|
+
|
|
|
+ * 功能描述:ParseFamilyJoinObject
|
|
|
+ * 作者:xulisong
|
|
|
+ * 创建时间: 2019/6/24 9:29:00
|
|
|
+ * 版本号:v1.0
|
|
|
+ * -------------------------------------------------------------------------*/
|
|
|
+
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using Autodesk.Revit.DB;
|
|
|
+using JBIM;
|
|
|
+using JBIM.Component;
|
|
|
+using JBIM.Definition;
|
|
|
+using RevitExport.Export;
|
|
|
+using RevitToJBim.Common;
|
|
|
+using JFamilyType=RevitToJBim.Common.FamilyType;
|
|
|
+using RevitToJBim.ParseData;
|
|
|
+using SAGA.RevitUtils.MEP;
|
|
|
+
|
|
|
+namespace RevitToJBim.ComponentParse
|
|
|
+{
|
|
|
+ [UsableParse]
|
|
|
+ public class ParseFamilyJoinObject : ParseBase
|
|
|
+ {
|
|
|
+ public override List<string> FastIndex()
|
|
|
+ {
|
|
|
+ return new List<string>() { CategoryGenerator .BuildingCategory(JFamilyType.Other)};
|
|
|
+ }
|
|
|
+ public override bool Match(ElementWrapper wrapper)
|
|
|
+ {
|
|
|
+ return wrapper.Category == CategoryGenerator.BuildingCategory(JFamilyType.Other);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
|
|
|
+ {
|
|
|
+ if (!(wrapper.RefElement is FamilyInstance familyInstance))
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ OtherJoinObject jObject = new OtherJoinObject();
|
|
|
+ ParseCore.AttachObject(jObject, wrapper);
|
|
|
+ context.AddBimObject(jObject);
|
|
|
+ #region Connector连接关系
|
|
|
+ var connectors = familyInstance.GetAllConnectors();
|
|
|
+ ElementOneToManyRel relMany = new ElementOneToManyRel(familyInstance.Id.ToString()) { RelatedObjects = new List<string>() };
|
|
|
+ relMany.SetElementType(TypeDefinition.Property_ConnectedIds);
|
|
|
+ foreach (var refConnector in connectors)
|
|
|
+ {
|
|
|
+ relMany.RelatedObjects.Add(RevitIdGenerator.GetConnectorId(refConnector));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (relMany.RelatedObjects.Any())
|
|
|
+ {
|
|
|
+ context.RelationShips.Add(relMany);
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+ return new List<BimId>() { jObject.Id };
|
|
|
+ }
|
|
|
+
|
|
|
+ public override List<ElementWrapper> ArrangeRefElements(ElementWrapper wrapper, JBimParseContext context)
|
|
|
+ {
|
|
|
+ if (!(wrapper.RefElement is FamilyInstance fi))
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ var wrappers = new List<ElementWrapper>() { };
|
|
|
+ var connectors = fi.GetAllConnectors();
|
|
|
+ foreach (var connector in connectors)
|
|
|
+ {
|
|
|
+ wrappers.Add(ParseCore.GetConnectorWrapper(connector));
|
|
|
+ }
|
|
|
+ return wrappers;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|