Looking to Select Pipe Elements in Order of Connection

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?

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


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.

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

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.

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

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…

2 Likes

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.

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

Does that result in the centerline length value?

yes if you give a length node after arcby3point noden…

Hi,
for FabricationParts you can use the CenterlineLength property.

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)
4 Likes

Cyril…again amazing solution…damn you are a shark :stuck_out_tongue_closed_eyes:

2 Likes