Onion - new package

Hi @maciek.glowka I still have some issues with the node for spit on multiple points, I will send you an example, maybe you can look this post with recursive function for modify your node on python…thanks, cheers

1 Like

Maybe can I create a new topic for split pipes and ducts at multiple points with python lambda function?
Cheers

Hi!

can you send a sample RVT that is causing problems?
The node should split pipes in multiple points - it adds split fragments back to the list. I have did some tests and it seemed working, but probably not in all cases then…

Hi @maciek.glowka sure, here we go

Can you send me your e-mail for the file? I can’t upload it

Maybe @c.poupin can help us with python?

hi, i have tried by using c# node so far and it seems to be working on those pipes…I will do some more testing and check the Python as well.
But…I have had some weird splitpoints on the diagonal pipes…did you have also problem with that? I think I also have to check that now :slight_smile:

Hi @maciek.glowka, yes you are right, I have same issues…thanks for yours effort. Cheers

Hi @maciek.glowka,
Do you have any news of the python for split pipes and duct with lambda function method like the post below?


Thank you very much for your efforts
Cheers

Hi @paris,

I am sorry but I didn’t have time recently to either look into c# or python code.
I will publish some info here if I manage (hopefully not too far in the future)

Hi @maciek.glowka,
Ok, thanks for your efforts.
I’ll create a new topic in the future for split pipes and ducts at multiple points with python lambda function
Cheers

1 Like

hi @paris!

I have managed finally to take a look at this, sorry it took that long. I have fixed the wrong intersection points for the diagonal pipes.
The new package version is pushed to the package manager.
If you want to take look at the code:

Do you still need the Python code as well?

  1. Another fixed thing - I have added tolerance parameter to AutoJoin, as I had some comments that it is not always working for touching elements (I guess it is precission issue).

Hi @maciek.glowka

Great, it’ a very good news !!! I’ll try, the new version of your package is available from the package manager ?
Yes, I still need the python, it’s very hard to made a custom node in python for splitting multiple pipes and ducts at multiple points …
Thank you very much.
Cheers

yes @paris it is available in the package manager.

I have tried to translate the splitting node into python and it seems to be working - it uses breakCurve method so it works now for pipes and ducts only.
It can split multiple elements at multiple points. The input is two lists one for elements and one for points. Always in pairs. So if you have three points for the same element you have to input the element three times (indexes for point/elment pair have to match)

import clr

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

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

doc = DocumentManager.Instance.CurrentDBDocument


elements = UnwrapElement(IN[0])
points = UnwrapElement(IN[1])


output = []
children = {}

TransactionManager.Instance.EnsureInTransaction(doc)

for e, p in zip(elements,points):
	to_check = [e]
	if e.Id in children:
		to_check.extend(children[e.Id])
		
	for ec in to_check:
		splitId = None
		if isinstance(ec,Autodesk.Revit.DB.Plumbing.Pipe):
			try:
				splitId = Autodesk.Revit.DB.Plumbing.PlumbingUtils.BreakCurve(doc, ec.Id, p.ToXyz())
			except:
				pass				
		elif isinstance(ec,Autodesk.Revit.DB.Mechanical.Duct):
			try:
				splitId = Autodesk.Revit.DB.Mechanical.MechanicalUtils.BreakCurve(doc, ec.Id, p.ToXyz())
			except:
				pass
			
		if splitId:
			split = doc.GetElement(splitId)
			if e.Id in children:
				children[e.Id].append(split)
			else:
				children[e.Id] = [split]
			output.append([ec,split])
		else:
			output.append(None)
			

TransactionManager.Instance.TransactionTaskDone()
			

OUT = output

Hi @maciek.glowka
Great! thank you very much for your effort, I’ll test it and I’ll give you a feedback.
Cheers

1 Like

Hi @maciek.glowka
I tried your python script, it’s work very well, splits all elements correctly , but for some reasons some segments becomes Unassigned (color Black without system applied), maybe it’s depend some null value from the out of the python node?..any thought?
Thank you for your effort

Cheers

Hi @maciek.glowka
I tested also “Elements.Linear Split” node Its works well, keeps the system type but after splitting, some tees and caps becomes unconnected.
Thank you for your effort
Cheers

hi @paris

as for the null values - I am sorry but there was a mistake in the output part of the script.
This is the corrected version, that should not produce null values (unless there is a reason for that)
However I think the unassigned system problem is still there - judging by the pipe colours.
As I probably said before, I have never used much MEP part of Revit and do not have much knowledge on it specifics. I do not have any ideas now about those unconnected caps and tees (don’t really know how they work in Revit). Sorry about that, If anything comes to my mind I will let you know. Although I am afraid that it might be a problem with BreakCurve method maybe and should be fixed separately ?

import clr

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

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

doc = DocumentManager.Instance.CurrentDBDocument


elements = UnwrapElement(IN[0])
points = UnwrapElement(IN[1])


output = []
children = {}

TransactionManager.Instance.EnsureInTransaction(doc)

for e, p in zip(elements,points):
	to_check = [e]
	if e.Id in children:
		to_check.extend(children[e.Id])
		
	splitId = None
	for ec in to_check:

		if isinstance(ec,Autodesk.Revit.DB.Plumbing.Pipe):
			try:
				splitId = Autodesk.Revit.DB.Plumbing.PlumbingUtils.BreakCurve(doc, ec.Id, p.ToXyz())
				break
			except:
				pass				
		elif isinstance(ec,Autodesk.Revit.DB.Mechanical.Duct):
			try:
				splitId = Autodesk.Revit.DB.Mechanical.MechanicalUtils.BreakCurve(doc, ec.Id, p.ToXyz())
				break
			except:
				pass
			
	if splitId:
		split = doc.GetElement(splitId)
		if e.Id in children:
			children[e.Id].append(split)
		else:
			children[e.Id] = [split]
		output.append([ec,split])
	else:
		output.append(None)
			

TransactionManager.Instance.TransactionTaskDone()
			

OUT = output
1 Like

Hi @maciek.glowka
thanks for your answer, yes you are right I have to fix the problem separately, your python node it’s great thank you very much for your effort.
Cheers

1 Like

Hi Maciek,

I have made a script that split my pipes.
When I run this script for the first time he does what he has to do.

Sometime we need to run this script more times. (Used the dynamo player)

When I try to run the next time the nodes does not what he has to do.
He has a input of 4 pipes and 4 points, so I expect a ElementA list with 4 elements and a ElementB list with 4 elements.

Do I something wrong?