Skip to content

Commit

Permalink
changed connector distance check
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-pekacki authored and pawelbaran committed Oct 11, 2022
1 parent be9d97d commit b9a44dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Revit_Core_Engine/Create/FamilyInstance/FamilyInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,17 @@ private static FamilyInstance FamilyInstance_OneLevelBased(Document document, Fa
ConnectorSet newElConnSet = newElementMEPCurve.ConnectorManager.Connectors;
Connector conn1 = null;
Connector conn2 = null;
double minDistance = double.MaxValue;
foreach (Connector hostConn in hostConnSet)
{
foreach (Connector newElConn in newElConnSet)
{
if (hostConn.Origin.IsAlmostEqualTo(newElConn.Origin))
double dist = hostConn.Origin.DistanceTo(newElConn.Origin);
if (dist < minDistance)
{
conn1 = hostConn;
conn2 = newElConn;
break;
minDistance = dist;
}
}
}
Expand Down

0 comments on commit b9a44dd

Please sign in to comment.