# Conduit fitting length

**URL:** <https://forum.dynamobim.com/t/conduit-fitting-length/80750>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [September 7, 2022, 7:08am UTC](https://forum.dynamobim.com/t/conduit-fitting-length/80750 "2022-09-07T07:08:03Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![vlad.aleksandrovs](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vlad.aleksandrovs/32/146055_2.png) [@vlad.aleksandrovs](https://forum.dynamobim.com/u/vlad.aleksandrovs)\
**Post date:** [September 7, 2022, 10:28am UTC](https://forum.dynamobim.com/t/conduit-fitting-length/80750/21 "2022-09-07T10:28:04Z")

</div>

Overall, this is a great solution. On paper there is …\<10% difference in conduit length, but compared to real life situation this doesn’t affect anything.

---

<div class="post-metadata">

**Author:** ![stewart.skyler](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@stewart.skyler](https://forum.dynamobim.com/u/stewart.skyler)\
**Post date:** [September 9, 2022, 9:18pm UTC](https://forum.dynamobim.com/t/conduit-fitting-length/80750/22 "2022-09-09T21:18:58Z")

</div>

```auto
# Enable Python support and load DesignScript library
import clr

# Import RevitAPI - This gives general access to Revit tools.
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import * 

# Import DocumentManager & TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument 
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument 

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

#Start Code

sel = uidoc.Selection.GetElementIds()
sel = [doc.GetElement(x) for x in sel]

op = Options()
l = 0

for item in sel:
    try:
	    l += item.Location.Curve.Length
    except:
        c = [x for x in item.GetOriginalGeometry(op) 
            if isinstance(x, Arc) or isinstance(x, Line)]
        l += sum([x.Length for x in c])

#Assign output
OUT = l

```

This is the python code I use to find the combined length of a selection in Revit. It adds the length parameter of the conduit, along with the length of any lines and arcs in your conduit fitting.  
Which, for the fittings I use is just the centerline, so the calculation comes out correct.

---

<div class="post-metadata">

**Author:** ![paris](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paris/32/144289_2.png) [@paris](https://forum.dynamobim.com/u/paris)\
**Post date:** [September 10, 2022, 1:02pm UTC](https://forum.dynamobim.com/t/conduit-fitting-length/80750/23 "2022-09-10T13:02:11Z")

</div>

Hi @vlad.aleksandrovs for get the Arc Length of Fittings maybe try this:  
Element.Geometry + Extract only Geometry Arc (with “isinstance”) + Curve.Length + Math.Round  
Cheers

---

<div class="post-metadata">

**Author:** ![r\_alzeyoudi](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@r\_alzeyoudi](https://forum.dynamobim.com/u/r_alzeyoudi)\
**Post date:** [October 25, 2024, 12:20pm UTC](https://forum.dynamobim.com/t/conduit-fitting-length/80750/24 "2024-10-25T12:20:35Z")

</div>

I have different type of cable trays fittings, how can I calculate each one’s length ?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/6/86d132d6b757e29b522b72a2c246069aa683d046.png)

[Previous page](https://forum.dynamobim.com/t/conduit-fitting-length/80750.md?page=1)
