# Split Element at Lenght?

**URL:** <https://forum.dynamobim.com/t/split-element-at-lenght/42676>\
**Category:** Revit\
**Tags:** revit, python, dynamo\
**Created:** [November 4, 2019, 2:48am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676 "2019-11-04T02:48:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![marguello49J42](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@marguello49J42](https://forum.dynamobim.com/u/marguello49J42)\
**Post date:** [November 4, 2019, 2:48am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/1 "2019-11-04T02:48:54Z")

</div>

Hello everyone! I’m trying to automatically split cable trays, or any element for that matter, at a certain lenght.

What I found out til now:  
-previously, the FamilyInstance.Split Method wasn’t avaible from the API, so people “shortened” the element and then made copies through a splitted curve. This, however, damages the connections between the trays and the fittings, and having so many of them, this is not an option for me.  
-Searching through the 2019.2 API, I found that this method now exists and can be used.

So:  
Is there already a node/package that uses this method? Or other way to do what im trying?

If not, how can i build my own python script to use that method? (I’m a Python beginner)  
I guess I should first get the element curve and split it, getting the points in which i would split the element  
Then i would feed the script:

```
element=IN[0]
points=IN[1]

```

which libraries should I import? how should i build the code? I guess it would be something simple, but as I said, I’m a beginner at Python.

Thank you very much in advanced.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [November 4, 2019, 3:23am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/2 "2019-11-04T03:23:33Z")

</div>

> [@marguello49J42](#):
>
> Searching through the 2019.2 API, I found that this method now exists and can be used.

Can you show where you found it?

---

<div class="post-metadata">

**Author:** ![marguello49J42](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@marguello49J42](https://forum.dynamobim.com/u/marguello49J42)\
**Post date:** [November 4, 2019, 3:40am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/3 "2019-11-04T03:40:12Z")

</div>

> [@jacob.small](#):
>
> Can you show where you found it?

 ![imagen](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/2/62133b84f0e8b79f7523521d1523929e2f5ab95c.png)

i know it says for columns and beams, but it works for me as well.

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [November 4, 2019, 4:02pm UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/4 "2019-11-04T16:02:03Z")

</div>

hi,

could you upload a sample file with those elements? (cable trays and connected fittings…)  
I am not very familiar with MEP parts of Revit, but can try smth with Python

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [November 5, 2019, 9:54pm UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/5 "2019-11-05T21:54:57Z")

</div>

ok…good news and bad news…  
the code to make it work is pretty easy, but it does not work with cable trays… (works with beams, columns though)…  
I think you might have some chances with making a script that would first do the copy and shorten trick and reconnect necessary elements…

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

clr.AddReference("RevitServices")
import RevitServices

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# The inputs to this node will be stored as a list in the IN variables.
elements = UnwrapElement(IN[0])
params = IN[1]

doc = DocumentManager.Instance.CurrentDBDocument

TransactionManager.Instance.EnsureInTransaction(doc)

for e,p in zip(elements,params):
	e.Split(p)

TransactionManager.Instance.TransactionTaskDone()

# Assign your output to the OUT variable.
OUT = 0
```

---

<div class="post-metadata">

**Author:** ![marguello49J42](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@marguello49J42](https://forum.dynamobim.com/u/marguello49J42)\
**Post date:** [November 5, 2019, 10:15pm UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/6 "2019-11-05T22:15:21Z")

</div>

Hi Maciek!  
Thank u very much for your work(sorry i didnt answered yesterday,i wasnt home when i saw your comment and then completely forgot)

I think i will have to re-model the fitting families before trying any reconnecting script, but i would save this for beams and columns.

Again, thanks!

---

<div class="post-metadata">

**Author:** ![zhao.zp](https://avatars.discourse-cdn.com/v4/letter/z/4af34b/32.png) [@zhao.zp](https://forum.dynamobim.com/u/zhao.zp)\
**Post date:** [November 6, 2019, 3:50am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/7 "2019-11-06T03:50:53Z")

</div>

Good news and good job and good guys~~~  
😊😊

---

<div class="post-metadata">

**Author:** ![Nissal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nissal/32/67016_2.png) [@Nissal](https://forum.dynamobim.com/u/Nissal)\
**Post date:** [November 6, 2019, 10:17am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/8 "2019-11-06T10:17:21Z")

</div>

have you searched in MEPover package?

---

<div class="post-metadata">

**Author:** ![truevis](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/truevis/32/8634_2.png) [@truevis](https://forum.dynamobim.com/u/truevis)\
**Post date:** [April 9, 2020, 5:48am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/9 "2020-04-09T05:48:56Z")

</div>

Graph for usage on a beam:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/e/ee8ca6a534c00b82ff02a4ca39e56f881c27fb7a.jpeg)

Conduit does not seem to split that way. Any suggestions?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/1/61ddc1cc549d1e1fb3924b0c79d9a02895f94823.png)

---

<div class="post-metadata">

**Author:** ![maciek.glowka](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/maciek.glowka/32/70695_2.png) [@maciek.glowka](https://forum.dynamobim.com/u/maciek.glowka)\
**Post date:** [April 9, 2020, 8:03am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/10 "2020-04-09T08:03:19Z")

</div>

according to api docs there is no ‘split’ method exposed by the conduit class…

so this method won’t work. What might work is making a copy of the element and adjusting their location curves (if conduts are curve based)

[https://www.revitapidocs.com/2020/160a9aff-f4c5-55b1-fdf8-6ec696d88053.htm](https://www.revitapidocs.com/2020/160a9aff-f4c5-55b1-fdf8-6ec696d88053.htm)

---

<div class="post-metadata">

**Author:** ![truevis](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/truevis/32/8634_2.png) [@truevis](https://forum.dynamobim.com/u/truevis)\
**Post date:** [April 9, 2020, 6:39pm UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/11 "2020-04-09T18:39:55Z")

</div>

Yes, it can be accomplished with MEPover package by @T_Pover:  
**Conduit.ByLines** , then doing **MEPFitting.ByMEPCurves** on each pair of Conduits

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/3/e34f634c3dbb31188ca08f5638a6c34ebfe6277f.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/0/30674479dd0a5bd52e7297f622cb3dbdb9e38045.png)  
Not as slick as being able to do a Split command by point, but it works.

---

<div class="post-metadata">

**Author:** ![nhlinh39](https://avatars.discourse-cdn.com/v4/letter/n/ecb155/32.png) [@nhlinh39](https://forum.dynamobim.com/u/nhlinh39)\
**Post date:** [March 18, 2022, 5:51am UTC](https://forum.dynamobim.com/t/split-element-at-lenght/42676/12 "2022-03-18T05:51:02Z")

</div>

Hi everyone, Is there any node to split cable tray, conduit?
