diff --git a/.idea/.idea.OpenMEP/.idea/.name b/.idea/.idea.OpenMEP/.idea/.name
deleted file mode 100644
index 794249ec..00000000
--- a/.idea/.idea.OpenMEP/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-OpenMEP
\ No newline at end of file
diff --git a/OpenMEP/ConnectorManager/Connector.cs b/OpenMEP/ConnectorManager/Connector.cs
index d3e268e0..5c3cf4cd 100644
--- a/OpenMEP/ConnectorManager/Connector.cs
+++ b/OpenMEP/ConnectorManager/Connector.cs
@@ -188,7 +188,7 @@ public static double Radius(Autodesk.Revit.DB.Connector connector)
///
/// origin connector
/// an collection connector to check
- ///
+ /// connector
public static Autodesk.Revit.DB.Connector? GetConnectorFarthest(Autodesk.Revit.DB.Connector? c,
List connectors)
{
@@ -208,7 +208,7 @@ public static double Radius(Autodesk.Revit.DB.Connector connector)
}
///
- /// Return Farthest Connector between element1 from element2
+ /// Return Farthest Connector between element1 with element2
///
/// first element
/// second element
@@ -216,12 +216,7 @@ public static double Radius(Autodesk.Revit.DB.Connector connector)
public static Autodesk.Revit.DB.Connector? GetConnectorFarthest(Revit.Elements.Element? element1,
Revit.Elements.Element? element2)
{
- ConnectorSet? connectorSet = GetConnectorSet(element1);
- if (connectorSet == null)
- {
- return null;
- }
-
+ List connectorSet = GetConnectors(element1);
Autodesk.Revit.DB.Connector? connector = GetConnectorFarthest(element2, connectorSet);
return connector;
}
@@ -230,15 +225,15 @@ public static double Radius(Autodesk.Revit.DB.Connector connector)
/// Get Farthest Connector With Element
///
/// element to check
- /// an collection connectors
+ /// an collection connectors
/// farthest connector
internal static Autodesk.Revit.DB.Connector? GetConnectorFarthest(Revit.Elements.Element? element,
- ConnectorSet? connectorSet)
+ List connectors)
{
Autodesk.Revit.DB.Connector? farthest = null;
Point? locationCenter = global::OpenMEP.Element.Element.LocationCenter(element);
- double distance = Double.MaxValue;
- foreach (Autodesk.Revit.DB.Connector? connector in connectorSet!)
+ double distance = Double.MinValue;
+ foreach (Autodesk.Revit.DB.Connector? connector in connectors!)
{
if (locationCenter != null)
{
@@ -605,11 +600,14 @@ public static double AssignedKCoefficient(Autodesk.Revit.DB.Connector connector)
/// element has connected with connector
public static Revit.Elements.Element? GetElementConnectedWith(Autodesk.Revit.DB.Connector connector)
{
+ if (connector == null) throw new ArgumentNullException(nameof(connector));
if (connector.IsConnected)
{
- return connector.AllRefs.Cast().First().Owner.ToDynamoType();
+ return connector.AllRefs.Cast()
+ .Where(x=>x.Owner.Id!=connector.Owner.Id)
+ .Where(x => x.ConnectorType != ConnectorType.Logical)
+ .Select(x => x.Owner.ToDynamoType()).FirstOrDefault();
}
-
return null;
}
diff --git a/docs/OpenMEPPage/connectormanager/dyn/Connector.GetConnectorFarthest.dyn b/docs/OpenMEPPage/connectormanager/dyn/Connector.GetConnectorFarthest.dyn
index 9990156c..86168276 100644
--- a/docs/OpenMEPPage/connectormanager/dyn/Connector.GetConnectorFarthest.dyn
+++ b/docs/OpenMEPPage/connectormanager/dyn/Connector.GetConnectorFarthest.dyn
@@ -13,7 +13,7 @@
"ConcreteType": "Dynamo.Nodes.DSModelElementSelection, DSRevitNodesUI",
"NodeType": "ExtensionNode",
"InstanceId": [
- "4aded12f-bb3e-43d3-a764-654a0a8454e4-00098720"
+ "be616ece-f29c-41ea-90be-1913ce942448-00094146"
],
"Id": "933da09ce5494d8e8ff9a9e935c8266f",
"Inputs": [],
@@ -30,14 +30,35 @@
],
"Replication": "Disabled"
},
+ {
+ "ConcreteType": "Dynamo.Nodes.DSModelElementSelection, DSRevitNodesUI",
+ "NodeType": "ExtensionNode",
+ "InstanceId": [
+ "be616ece-f29c-41ea-90be-1913ce942448-00094147"
+ ],
+ "Id": "84ddd8ae072b487086eb86ae672934f8",
+ "Inputs": [],
+ "Outputs": [
+ {
+ "Id": "ed7bd73c577f4418b7c363d4618415ee",
+ "Name": "Element",
+ "Description": "The selected elements.",
+ "UsingDefaultValue": false,
+ "Level": 2,
+ "UseLevels": false,
+ "KeepListStructure": false
+ }
+ ],
+ "Replication": "Disabled"
+ },
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
- "FunctionSignature": "Exyte.Revit.MEPModel.Connector.GetConnectorFarthest@Revit.Elements.Element,Revit.Elements.Element",
- "Id": "96d641ab37ba4402a3aba521f0d2b346",
+ "FunctionSignature": "OpenMEP.ConnectorManager.Connector.GetConnectorFarthest@Revit.Elements.Element,Revit.Elements.Element",
+ "Id": "78c050b27eaa41378389c5c648afc655",
"Inputs": [
{
- "Id": "0e6d7e7e296b4233965a5aa6e3d5447f",
+ "Id": "4a15f03771a849e483ac4c03f7eee768",
"Name": "element1",
"Description": "first element\n\nElement",
"UsingDefaultValue": false,
@@ -46,7 +67,7 @@
"KeepListStructure": false
},
{
- "Id": "37610db8d29b4b45975dc04494a573d5",
+ "Id": "cd86016fd4ec4571b10d81dcd4effe64",
"Name": "element2",
"Description": "second element\n\nElement",
"UsingDefaultValue": false,
@@ -57,9 +78,9 @@
],
"Outputs": [
{
- "Id": "590ccf9c9ed64e3bab0a9567facd809e",
+ "Id": "faadcc2fca994cb58e6c19009fbe0f87",
"Name": "connector",
- "Description": "farthest connector of fist element with second element",
+ "Description": "Farthest connector of element1",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
@@ -67,52 +88,31 @@
}
],
"Replication": "Auto",
- "Description": "return farthest connector between two element\n\nConnector.GetConnectorFarthest (element1: Element, element2: Element): var"
- },
- {
- "ConcreteType": "Dynamo.Nodes.DSModelElementSelection, DSRevitNodesUI",
- "NodeType": "ExtensionNode",
- "InstanceId": [
- "4aded12f-bb3e-43d3-a764-654a0a8454e4-00098720"
- ],
- "Id": "84ddd8ae072b487086eb86ae672934f8",
- "Inputs": [],
- "Outputs": [
- {
- "Id": "ed7bd73c577f4418b7c363d4618415ee",
- "Name": "Element",
- "Description": "The selected elements.",
- "UsingDefaultValue": false,
- "Level": 2,
- "UseLevels": false,
- "KeepListStructure": false
- }
- ],
- "Replication": "Disabled"
+ "Description": "Return Farthest Connector between element1 from element2\n\nConnector.GetConnectorFarthest (element1: Element, element2: Element): var"
}
],
"Connectors": [
{
"Start": "bc3d8a2f13064925b0f7243b7ab8d156",
- "End": "0e6d7e7e296b4233965a5aa6e3d5447f",
- "Id": "82efc67048b3400c9b503fe9502d88ea",
+ "End": "4a15f03771a849e483ac4c03f7eee768",
+ "Id": "8906af616a614bd49724919464fd7d29",
"IsHidden": "False"
},
{
"Start": "ed7bd73c577f4418b7c363d4618415ee",
- "End": "37610db8d29b4b45975dc04494a573d5",
- "Id": "2409036a85a44637b9c70887ed88cc72",
+ "End": "cd86016fd4ec4571b10d81dcd4effe64",
+ "Id": "7ddfe56c6d874ad5aa464a25ea2d0275",
"IsHidden": "False"
}
],
"Dependencies": [],
"NodeLibraryDependencies": [
{
- "Name": "Exyte",
- "Version": "1.0.1",
+ "Name": "OpenMEP",
+ "Version": "1.0.0",
"ReferenceType": "Package",
"Nodes": [
- "96d641ab37ba4402a3aba521f0d2b346"
+ "78c050b27eaa41378389c5c648afc655"
]
}
],
@@ -174,29 +174,29 @@
"Y": 47.66857901662172
},
{
- "Name": "Connector.GetConnectorFarthest",
+ "Name": "Select Model Element",
"ShowGeometry": true,
- "Id": "96d641ab37ba4402a3aba521f0d2b346",
+ "Id": "84ddd8ae072b487086eb86ae672934f8",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
- "X": 691.0304802560803,
- "Y": 85.214248708368117
+ "X": 322.287764461925,
+ "Y": 214.87863420638075
},
{
- "Name": "Select Model Element",
+ "Name": "Connector.GetConnectorFarthest",
"ShowGeometry": true,
- "Id": "84ddd8ae072b487086eb86ae672934f8",
+ "Id": "78c050b27eaa41378389c5c648afc655",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
- "X": 318.29575711222788,
- "Y": 197.1997445148649
+ "X": 629.09107257563983,
+ "Y": 113.98429002584527
}
],
"Annotations": [],
- "X": -185.68967427309019,
- "Y": 114.91770839408963,
- "Zoom": 1.1917937712929563
+ "X": -468.52478404786416,
+ "Y": 56.538597228254616,
+ "Zoom": 1.2928910957911353
}
}
\ No newline at end of file
diff --git a/docs/OpenMEPPage/connectormanager/dyn/Connector.GetElementConnectedWith.dyn b/docs/OpenMEPPage/connectormanager/dyn/Connector.GetElementConnectedWith.dyn
index 6c9894c8..8dd81a4e 100644
--- a/docs/OpenMEPPage/connectormanager/dyn/Connector.GetElementConnectedWith.dyn
+++ b/docs/OpenMEPPage/connectormanager/dyn/Connector.GetElementConnectedWith.dyn
@@ -12,7 +12,9 @@
{
"ConcreteType": "Dynamo.Nodes.DSModelElementSelection, DSRevitNodesUI",
"NodeType": "ExtensionNode",
- "InstanceId": [],
+ "InstanceId": [
+ "be616ece-f29c-41ea-90be-1913ce942448-00094147"
+ ],
"Id": "36d61c2272d340e291bc2edf7169cf86",
"Inputs": [],
"Outputs": [
@@ -31,13 +33,13 @@
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
- "FunctionSignature": "OpenMEP.ConnectorManager.Connector.GetUnusedConnectors@Revit.Elements.Element",
- "Id": "3b10532ba5a044639cc08ed29aa358c2",
+ "FunctionSignature": "OpenMEP.ConnectorManager.Connector.GetElementConnectedWith@var",
+ "Id": "c8bb9ca5d0a54f77995264542d61c3b3",
"Inputs": [
{
- "Id": "42748721931745008b942edf275fd8d6",
- "Name": "element",
- "Description": "element\n\nElement",
+ "Id": "7ac3d75809e0402288f9b4af07ce3441",
+ "Name": "connector",
+ "Description": "connector\n\nvar",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
@@ -46,9 +48,9 @@
],
"Outputs": [
{
- "Id": "b90bfc30d5774f8caf5e60beefd29441",
- "Name": "connectors",
- "Description": "connectors",
+ "Id": "64fb8672c1a14ed69b00fc2a909d84d1",
+ "Name": "element",
+ "Description": "element has connected with connector",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
@@ -56,18 +58,18 @@
}
],
"Replication": "Auto",
- "Description": "return list connector from element\n\nConnector.GetUnusedConnectors (element: Element): var[]"
+ "Description": "return element connected with connector\n\nConnector.GetElementConnectedWith (connector: var): Element"
},
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
- "FunctionSignature": "OpenMEP.ConnectorManager.Connector.GetElementConnectedWith@var",
- "Id": "c8bb9ca5d0a54f77995264542d61c3b3",
+ "FunctionSignature": "OpenMEP.ConnectorManager.Connector.GetConnectors@Revit.Elements.Element",
+ "Id": "8ba510b7776744cc8dc068f9865fda35",
"Inputs": [
{
- "Id": "7ac3d75809e0402288f9b4af07ce3441",
- "Name": "connector",
- "Description": "connector\n\nvar",
+ "Id": "e0435ecdffed4f05afdbda9d8b5a912a",
+ "Name": "element",
+ "Description": "element\n\nElement",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
@@ -76,9 +78,9 @@
],
"Outputs": [
{
- "Id": "64fb8672c1a14ed69b00fc2a909d84d1",
- "Name": "element",
- "Description": "element has connected with connecter",
+ "Id": "91ed37fd92ca4e41b35766ffe39fedbd",
+ "Name": "connectors",
+ "Description": "connectors",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
@@ -86,20 +88,20 @@
}
],
"Replication": "Auto",
- "Description": "return element connected with connector\n\nConnector.GetElementConnectedWith (connector: var): Element"
+ "Description": "return list connector from element\n\nConnector.GetConnectors (element: Element): var[]"
}
],
"Connectors": [
{
"Start": "9df9e54412cc4d38a3d755c16db4f048",
- "End": "42748721931745008b942edf275fd8d6",
- "Id": "34ffcfd13f1d4c9daba8cce89445ea25",
+ "End": "e0435ecdffed4f05afdbda9d8b5a912a",
+ "Id": "29d2a69b822b408c8c9adc895b832878",
"IsHidden": "False"
},
{
- "Start": "b90bfc30d5774f8caf5e60beefd29441",
+ "Start": "91ed37fd92ca4e41b35766ffe39fedbd",
"End": "7ac3d75809e0402288f9b4af07ce3441",
- "Id": "d3d19793d8bd4f109735985666381454",
+ "Id": "5c44e4dbc851401e8a4ec82eb27659a4",
"IsHidden": "False"
}
],
@@ -110,8 +112,8 @@
"Version": "1.0.0",
"ReferenceType": "Package",
"Nodes": [
- "3b10532ba5a044639cc08ed29aa358c2",
- "c8bb9ca5d0a54f77995264542d61c3b3"
+ "c8bb9ca5d0a54f77995264542d61c3b3",
+ "8ba510b7776744cc8dc068f9865fda35"
]
}
],
@@ -142,7 +144,7 @@
"View": {
"Dynamo": {
"ScaleFactor": 1.0,
- "HasRunWithoutCrash": false,
+ "HasRunWithoutCrash": true,
"IsVisibleInDynamoLibrary": true,
"Version": "2.16.1.2727",
"RunType": "Manual",
@@ -173,29 +175,29 @@
"Y": 306.40000000000003
},
{
- "Name": "Connector.GetUnusedConnectors",
+ "Name": "Connector.GetElementConnectedWith",
"ShowGeometry": true,
- "Id": "3b10532ba5a044639cc08ed29aa358c2",
+ "Id": "c8bb9ca5d0a54f77995264542d61c3b3",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
- "X": 532.400000000001,
- "Y": 306.39999999999975
+ "X": 902.52199007090621,
+ "Y": 279.55674131204228
},
{
- "Name": "Connector.GetElementConnectedWith",
+ "Name": "Connector.GetConnectors",
"ShowGeometry": true,
- "Id": "c8bb9ca5d0a54f77995264542d61c3b3",
+ "Id": "8ba510b7776744cc8dc068f9865fda35",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
- "X": 926.80000000000086,
- "Y": 300.79999999999995
+ "X": 554.96681592669552,
+ "Y": 279.38900464800827
}
],
"Annotations": [],
- "X": -73.600000000000534,
- "Y": 14.400000000000091,
- "Zoom": 1.0
+ "X": -112.03928018173525,
+ "Y": 0.38286191330155361,
+ "Zoom": 0.98854889960476833
}
}
\ No newline at end of file
diff --git a/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetConnectorFarthest.jpg b/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetConnectorFarthest.jpg
index 87097575..61e6efa0 100644
Binary files a/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetConnectorFarthest.jpg and b/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetConnectorFarthest.jpg differ
diff --git a/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetElementConnectedWith.jpg b/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetElementConnectedWith.jpg
index eab85054..d70b5d93 100644
Binary files a/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetElementConnectedWith.jpg and b/docs/OpenMEPPage/connectormanager/dyn/pic/Connector.GetElementConnectedWith.jpg differ