Skip to content

Commit 58f2bfc

Browse files
committed
Merge branch 'dev'
2 parents 0b38b5d + 39b7d58 commit 58f2bfc

File tree

18 files changed

+883
-223
lines changed

18 files changed

+883
-223
lines changed

.idea/.idea.OpenMEP/.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenMEP/ConnectorManager/Connector.cs

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ public static double Radius(Autodesk.Revit.DB.Connector connector)
126126
.ConnectorManager?
127127
.Connectors;
128128
}
129-
129+
if (e is FabricationPart)
130+
{
131+
return ((FabricationPart) e)?
132+
.ConnectorManager?
133+
.Connectors;
134+
}
130135
return null;
131136
}
132137

@@ -300,7 +305,7 @@ public static double Radius(Autodesk.Revit.DB.Connector connector)
300305
public static List<Autodesk.Revit.DB.Connector?> GetUsedConnectors(Revit.Elements.Element? element)
301306
{
302307
if (element == null) throw new ArgumentNullException(nameof(element));
303-
if (GetConnectors(element).Any()) return new List<Autodesk.Revit.DB.Connector?>();
308+
if (!GetConnectors(element).Any()) return new List<Autodesk.Revit.DB.Connector?>();
304309
return GetConnectors(element).Where(x => x!.IsConnected).ToList();
305310
}
306311

@@ -883,4 +888,60 @@ public static Autodesk.Revit.DB.Connector ConnectTo(Autodesk.Revit.DB.Connector
883888
CoordinateSystem coordinateSystem = Autodesk.DesignScript.Geometry.CoordinateSystem.ByOriginVectors(point, X, Y, Z);
884889
return OpenMEPSandbox.Geometry.CoordinateSystem.Display(coordinateSystem,length);
885890
}
891+
892+
/// <summary>
893+
/// Identifies if the connector is connected to the specified connector.
894+
/// </summary>
895+
/// <param name="connector">the connector to check</param>
896+
/// <param name="connectorOther">the second connector to identifies</param>
897+
/// <returns name="bool">true if connector is connected to other</returns>
898+
public static bool IsConnectedTo(Autodesk.Revit.DB.Connector connector,Autodesk.Revit.DB.Connector connectorOther)
899+
{
900+
return connector.IsConnectedTo(connectorOther);
901+
}
902+
903+
// /// <summary>Gets fabrication connectivity information.</summary>
904+
// /// <para name="connector">the connector</para>
905+
// /// <since>2016</since>
906+
// [MultiReturn("BodyConnectorId", "DoubleWallConnectorId", "FabricationIndex", "IsBodyConnectorLocked",
907+
// "IsDoubleWallConnectorLocked", "HasDoubleWallConnector", "IsValid")]
908+
// public static Dictionary<string, object?> GetFabricationConnectorInfo(Autodesk.Revit.DB.Connector connector)
909+
// {
910+
// if (connector == null) throw new ArgumentException(nameof(connector));
911+
// FabricationConnectorInfo fabricationConnectorInfo = connector.GetFabricationConnectorInfo();
912+
// if (fabricationConnectorInfo == null)
913+
// {
914+
// return new Dictionary<string, object?>
915+
// {
916+
// {"BodyConnectorId", null},
917+
// {"DoubleWallConnectorId", null},
918+
// {"FabricationIndex", null},
919+
// {"IsBodyConnectorLocked", null},
920+
// {"IsDoubleWallConnectorLocked", null},
921+
// {"HasDoubleWallConnector", null},
922+
// {"IsValid", null}
923+
// };
924+
// }
925+
// int? DoubleWallConnectorId = null;
926+
// bool? IsDoubleWallConnectorLocked = null;
927+
// try
928+
// {
929+
// DoubleWallConnectorId = fabricationConnectorInfo.DoubleWallConnectorId;
930+
// IsDoubleWallConnectorLocked = fabricationConnectorInfo.IsDoubleWallConnectorLocked;
931+
// }
932+
// catch (Exception e)
933+
// {
934+
// //TODO: no things
935+
// }
936+
// return new Dictionary<string, object?>
937+
// {
938+
// {"BodyConnectorId", fabricationConnectorInfo.BodyConnectorId},
939+
// {"DoubleWallConnectorId",DoubleWallConnectorId },
940+
// {"FabricationIndex", fabricationConnectorInfo.FabricationIndex},
941+
// {"IsBodyConnectorLocked", fabricationConnectorInfo.IsBodyConnectorLocked},
942+
// {"IsDoubleWallConnectorLocked",IsDoubleWallConnectorLocked },
943+
// {"HasDoubleWallConnector", fabricationConnectorInfo.HasDoubleWallConnector()},
944+
// {"IsValid", fabricationConnectorInfo.IsValid()},
945+
// };
946+
// }
886947
}

OpenMEP/ConnectorManager/ConnectorManager.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ private ConnectorManager()
1414
/// return connector manager of element
1515
/// </summary>
1616
/// <param name="element">element</param>
17-
/// <returns name="ConnectorManager">ConnectorManager</returns>
17+
/// <returns name="ConnectorManager">Autodesk.Revit.DB.ConnectorManager</returns>
1818
public static Autodesk.Revit.DB.ConnectorManager? GetConnectorManager( Revit.Elements.Element? element)
1919
{
2020
Autodesk.Revit.DB.Element? internalElement = element?.InternalElement;
@@ -32,6 +32,10 @@ private ConnectorManager()
3232
{
3333
return mepCurve.ConnectorManager;
3434
}
35+
if(internalElement is Autodesk.Revit.DB.FabricationPart fabricationPart)
36+
{
37+
return fabricationPart.ConnectorManager;
38+
}
3539

3640
return null;
3741
}
@@ -71,15 +75,14 @@ public static Revit.Elements.Element Owner( Autodesk.Revit.DB.ConnectorManager c
7175
/// </summary>
7276
/// <param name="connectorManager">connector manager</param>
7377
/// <returns name="connectors">a collections of connector manager</returns>
74-
public static List<Autodesk.Revit.DB.Connector> Connectors( Autodesk.Revit.DB.ConnectorManager? connectorManager)
78+
public static List<Autodesk.Revit.DB.Connector?> Connectors( Autodesk.Revit.DB.ConnectorManager? connectorManager)
7579
{
76-
List<Autodesk.Revit.DB.Connector> connectors = new List<Autodesk.Revit.DB.Connector>();
77-
ConnectorSet connectorSet = connectorManager.Connectors;
78-
foreach (Autodesk.Revit.DB.Connector connector in connectorSet)
80+
List<Autodesk.Revit.DB.Connector?> connectors = new List<Autodesk.Revit.DB.Connector?>();
81+
ConnectorSet? connectorSet = connectorManager?.Connectors;
82+
foreach (Autodesk.Revit.DB.Connector connector in connectorSet!)
7983
{
8084
connectors.Add(connector);
8185
}
82-
8386
return connectors;
8487
}
8588

OpenMEP/Element/Element.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Autodesk.Revit.DB;
33
using Dynamo.Graph.Nodes;
44
using OpenMEP.Helpers;
5+
using Revit.Elements;
56
using Revit.GeometryConversion;
67
using Point = Autodesk.DesignScript.Geometry.Point;
78

@@ -20,6 +21,7 @@ private Element()
2021
/// <returns></returns>
2122
public static Point? LocationCenter(Revit.Elements.Element? element)
2223
{
24+
2325
if(element == null)
2426
throw new ArgumentNullException(nameof(element));
2527
if (element.InternalElement.Location is LocationPoint)

OpenMEP/Element/FabricationPart.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace OpenMEP.Element;
2+
3+
public class FabricationPart
4+
{
5+
private FabricationPart()
6+
{
7+
8+
}
9+
10+
}

docs/OpenMEPPage/connectormanager/connector.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,4 +587,4 @@
587587
/// <returns name="ZXPlane">Plane(Blue-Red color)</returns>
588588
```
589589

590-
![](dyn/pic/Connector.Display.png)
590+
![](dyn/pic/Connector.Display.gif)

0 commit comments

Comments
 (0)