# Looking to Select Pipe Elements in Order of Connection

**URL:** <https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721>\
**Category:** Revit\
**Tags:** revit, mep, dynamo, mepover\
**Created:** [August 31, 2021, 12:28pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721 "2021-08-31T12:28:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.large](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t.large/32/89412_2.png) [@t.large](https://forum.dynamobim.com/u/t.large)\
**Post date:** [August 31, 2021, 12:28pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/1 "2021-08-31T12:28:58Z")

</div>

I am looking to create a graph that will calculate the (at least approximate) Centerline Length for a series of connected MEP Fabrication pipes/tubing.

My plan was to use the MEPover Connector Info + to get the connection points, then calculate a curve from said points, thus a speedbump arises.

The selected elements do not come into Dynamo in the order of connection. Is there a node/command that would organize FabricationElements in order of connection?

---

<div class="post-metadata">

**Author:** ![bvs1982](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bvs1982](https://forum.dynamobim.com/u/bvs1982)\
**Post date:** [August 31, 2021, 1:26pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/2 "2021-08-31T13:26:36Z")

</div>

Why does the **order** of connection matter? You said you wanted only the Length of the Centerline 🤨.

---

<div class="post-metadata">

**Author:** ![t.large](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t.large/32/89412_2.png) [@t.large](https://forum.dynamobim.com/u/t.large)\
**Post date:** [August 31, 2021, 1:52pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/3 "2021-08-31T13:52:25Z")

</div>

![2021-08-31_9-49-09](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/3/13d8663ff58c4d8284470f21e29bfbffc68c93a1.jpeg)  
Here is the content I am using for testing.

I was trying to use Nurbscurve to result in one single curve that follows the curvature of the bends that my company uses, and intersects at the connection points of each element. Then all I would need is to get the length of that curve.

I’m sure there are otherways, no doubt, but this is the one I happen to be exploring at the moment.

---

<div class="post-metadata">

**Author:** ![bvs1982](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bvs1982](https://forum.dynamobim.com/u/bvs1982)\
**Post date:** [August 31, 2021, 1:55pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/4 "2021-08-31T13:55:35Z")

</div>

I am not a MEP engineer, but doesn’t have the Pipe a build in Parameter wich returns the Length?

---

<div class="post-metadata">

**Author:** ![t.large](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t.large/32/89412_2.png) [@t.large](https://forum.dynamobim.com/u/t.large)\
**Post date:** [August 31, 2021, 1:58pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/5 "2021-08-31T13:58:28Z")

</div>

Correct, the straight pipe does have this Length parameter. Unfortunately, with the database available to us, any fittings/bends/elbows do not have this centerline-length parameter. It is possible that they will add such a parameter in the future, and I will be trying to communicate the importance of that parameter when applicable.

So yes, I am trying to replicate a “Centerline Length” parameter in a script.

---

<div class="post-metadata">

**Author:** ![bvs1982](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bvs1982](https://forum.dynamobim.com/u/bvs1982)\
**Post date:** [August 31, 2021, 2:01pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/6 "2021-08-31T14:01:30Z")

</div>

What about solving it with some math? Volume / Area (of the Section of the Pipe)? Assuming you can get / have those.

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 31, 2021, 2:09pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/7 "2021-08-31T14:09:32Z")

</div>

Hi here is a way for get fittings centerline, know here is a duct fitting but should be almost the same for conduit and cabletrays…

 ![Screenshot 2021-08-27 180726](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/a/ca15e9d98693edf3a120489711083b1524b73527.png)

---

<div class="post-metadata">

**Author:** ![t.large](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t.large/32/89412_2.png) [@t.large](https://forum.dynamobim.com/u/t.large)\
**Post date:** [August 31, 2021, 2:38pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/8 "2021-08-31T14:38:33Z")

</div>

![2021-08-31_10-19-02](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/1/71e24a3a29e9a74d5749b61a98c11271ef451423.jpeg)

It appears that these elements’ geometry consists of Mesh.

The MEPover Connector Info+ will spit out Points that are located at the connection point for each part, as well as the elements that are connected to each connection point.

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 31, 2021, 3:37pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/9 "2021-08-31T15:37:51Z")

</div>

aha its a fabrication part…dont know what its the best way here, but here i have tried it with intersect a plane…

 ![Screenshot 2021-08-27 180726](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/0/90d7a687d901bae4238e3856c37e645f68fc5cf5.jpeg)

---

<div class="post-metadata">

**Author:** ![t.large](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t.large/32/89412_2.png) [@t.large](https://forum.dynamobim.com/u/t.large)\
**Post date:** [August 31, 2021, 3:54pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/10 "2021-08-31T15:54:30Z")

</div>

Does that result in the centerline length value?

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 31, 2021, 3:56pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/11 "2021-08-31T15:56:00Z")

</div>

yes if you give a length node after arcby3point noden…

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [September 2, 2021, 8:00pm UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/12 "2021-09-02T20:00:39Z")

</div>

Hi,  
for FabricationParts you can use the [CenterlineLength](https://www.revitapidocs.com/2020.1/ef7e4df9-2b73-929d-622d-6c6fad172e36.htm) property.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/9/f993b4022fd3ca97678bacddc8fddaca3792a726.png)

```auto
import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

def convertL(value):
    global nameUnit
    if sdkNumber < 2021:
        UIunit = doc.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits
        nameUnit = LabelUtils.GetLabelFor(UIunit)
    else:
        UIunit = doc.GetUnits().GetFormatOptions(SpecTypeId.Length).GetUnitTypeId()
        nameUnit = LabelUtils.GetLabelForUnit(UIunit)
    convertfrom = UnitUtils.ConvertFromInternalUnits(value, UIunit)
    return convertfrom 
    
  
toList = lambda x : x if hasattr(x, ' __iter__') else [x]
lstpart = toList(UnwrapElement(IN[0]))
nameUnit = None
total = round(sum([convertL(p.CenterlineLength) for p in lstpart]), 3)
OUT = "Total = {} {}".format(total, nameUnit)

```

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [September 3, 2021, 11:27am UTC](https://forum.dynamobim.com/t/looking-to-select-pipe-elements-in-order-of-connection/67721/13 "2021-09-03T11:27:42Z")

</div>

Cyril…again amazing solution…damn you are a shark 😝
