|
@@ -18,7 +18,9 @@ using JBIM.Definition;
|
|
|
using RevitExport;
|
|
|
using RevitExport.Export;
|
|
|
using RevitToJBim.Common;
|
|
|
-using Connector = JBIM.Component.Connector;
|
|
|
+using RevitToJBim.ParseData;
|
|
|
+using SAGA.RevitUtils.Extends;
|
|
|
+using JConnector = JBIM.Component.Connector;
|
|
|
|
|
|
namespace RevitToJBim.ComponentParse
|
|
|
{
|
|
@@ -63,9 +65,9 @@ namespace RevitToJBim.ComponentParse
|
|
|
bimObj.SourceId = wrapper.SourceId;
|
|
|
bimObj.Name = wrapper.RefElement?.Name;
|
|
|
}
|
|
|
- public static Connector CreateConnector(Autodesk.Revit.DB.Connector connector)
|
|
|
+ public static JConnector CreateConnector(Autodesk.Revit.DB.Connector connector)
|
|
|
{
|
|
|
- var result= new Connector();
|
|
|
+ var result= new JConnector();
|
|
|
result.SourceId = RevitIdGenerator.GetConnectorId(connector);
|
|
|
switch (connector.Domain)
|
|
|
{
|
|
@@ -95,5 +97,49 @@ namespace RevitToJBim.ComponentParse
|
|
|
ElementWrapper wrapper = new ElementWrapper(connector, RevitIdGenerator.GetConnectorId(connector));
|
|
|
return wrapper;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取元素关联的connector关联信息,若connector数量为0,则返回null
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="element"></param>
|
|
|
+ /// <param name="connectors"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static ElementOneToManyRel GetConnectorRels(Element element,List<Autodesk.Revit.DB.Connector> connectors)
|
|
|
+ {
|
|
|
+ ElementOneToManyRel relMany = new ElementOneToManyRel(element.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())
|
|
|
+ {
|
|
|
+ return relMany;
|
|
|
+ }
|
|
|
+ return null;//创建关系无效
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 解析定位信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="location"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static GeometryLocation GetLocation(Location location)
|
|
|
+ {
|
|
|
+ if (location == null)
|
|
|
+ return null;
|
|
|
+ if (location is LocationPoint point)
|
|
|
+ {
|
|
|
+ var usePoint = point.Point;
|
|
|
+ return GeometryLocation.CreatePointLocation(BimConvert.ConvertToXYZ(usePoint));
|
|
|
+ }
|
|
|
+ else if (location is LocationCurve curve)
|
|
|
+ {
|
|
|
+ var useCurve = curve.Curve.GetPoints();
|
|
|
+ return GeometryLocation.CreateLineLocation(useCurve.Select(xyz=>BimConvert.ConvertToXYZ(xyz)).ToList());
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|