Split Element at Lenght?

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.

Can you show where you found it?

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

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

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
2 Likes

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!

Good news and good job and good guys~~~
:blush::blush:

have you searched in MEPover package?

Graph for usage on a beam:

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

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

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


image
Not as slick as being able to do a Split command by point, but it works.

1 Like

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