MEPover Pipe.byLines

Hi everyone,

I have tried to use the MEPover node Pipe.byLines.
I am working in Revit 2024 and the Python Code of the script is still in IronPython2. Obviousely I have updated the Code to CPython3 via the integrated code update in Dynamo, however, the node is not working.

I have used the script before in Revit 2023 and it was working fine. However now Dynamo starts loading and just never stops loading every single time i try to run it.

I first thought it was the list that is at fault, but i have tried to feed a single line… same thing.
Maybe somebody can help`?
PipesByLinesTest.dyn (25.0 KB)

This is the code of the block:
"import clr

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

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

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

if isinstance(IN[0], list):
lines = IN[0]
else:
lines = [IN[0]]
FirstPoint = [x.StartPoint for x in lines]
SecondPoint = [x.EndPoint for x in lines]
if isinstance(IN[1], list):
pipetype = UnwrapElement(IN[1])
else:
pipetype = [UnwrapElement(IN[1])]
ptl = len(pipetype)

if isinstance(IN[2], list):
systemtype = UnwrapElement(IN[2])
else:
systemtype = [UnwrapElement(IN[2])]
stl = len(systemtype)
if isinstance(IN[3], list):
level = UnwrapElement(IN[3])
else:
level = [UnwrapElement(IN[3])]
ll = len(level)
if isinstance(IN[4], list):
diameter = IN[4]
else:
diameter = [IN[4]]
dl = len(diameter)

elements =

TransactionManager.Instance.EnsureInTransaction(doc)
for i,x in enumerate(FirstPoint):
try:
levelid = level[i%ll].Id
systypeid = systemtype[i%stl].Id
pipetypeid = pipetype[i%ptl].Id
diam = diameter[i%dl]

            pipe = Autodesk.Revit.DB.Plumbing.Pipe.Create(doc,systypeid,pipetypeid,levelid,x.ToXyz(),SecondPoint[i].ToXyz())
            
            param = pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM)
            param.SetValueString(diam.ToString())
    
            elements.append(pipe.ToDSType(False))   
    except:
            elements.append(None)

TransactionManager.Instance.TransactionTaskDone()

OUT = elements"

@hannah.salzgeber_stu

import clr

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('System')
from System.Collections.Generic import List

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

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

# Access the Revit application and document
app = DocumentManager.Instance.CurrentUIApplication
doc = DocumentManager.Instance.CurrentDBDocument

if isinstance(IN[0], list):
	lines = IN[0]
else:
	lines = [IN[0]]
	FirstPoint = [x.StartPoint for x in lines]
	SecondPoint = [x.EndPoint for x in lines]
	if isinstance(IN[1], list):
		pipetype = UnwrapElement(IN[1])
	else:
		pipetype = [UnwrapElement(IN[1])]
		ptl = len(pipetype)

if isinstance(IN[2], list):
systemtype = UnwrapElement(IN[2])
else:
systemtype = [UnwrapElement(IN[2])]
stl = len(systemtype)
if isinstance(IN[3], list):
level = UnwrapElement(IN[3])
else:
level = [UnwrapElement(IN[3])]
ll = len(level)
if isinstance(IN[4], list):
diameter = IN[4]
else:
diameter = [IN[4]]
dl = len(diameter)

elements = []

TransactionManager.Instance.EnsureInTransaction(doc)

for i,x in enumerate(FirstPoint):
	try:
		levelid = level[i%ll].Id
		systypeid = systemtype[i%stl].Id
		pipetypeid = pipetype[i%ptl].Id
		diam = diameter[i%dl]

		pipe = Autodesk.Revit.DB.Plumbing.Pipe.Create(doc,systypeid,pipetypeid,levelid,x.ToXyz(),SecondPoint[i].ToXyz())
		param = pipe.get_Parameter(BuiltInParameter.RBS_PIPE_DIAMETER_PARAM)
		param.SetValueString(diam.ToString())

		elements.append(pipe.ToDSType(False))   
	except:
		elements.append(None)

TransactionManager.Instance.TransactionTaskDone()

OUT = elements

just cleaned up as good as possible

1 Like

Hi @hannah.salzgeber_stu , you can use OpenMEP package with stable version: Class Pipe | Open MEP

hi,i am using R2024 version.i did not found your package on dynamo.how to find?

can I know the dynamo version you are using ?

thanks for reply.DYNAMO v.2.18.1

hi,
i am try to make tee fitting and elbow for pipe,but it is not working in this dynamo file. i trying to figure out what is the problem,but at the end no clue.kindly help me.i attach file pls find.
WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free,
TFS line to pipe.dyn (181.4 KB)
revit link.dwg (32.9 KB)

hi @thsa2501 try something here and see if could work for you…

Revit_kQXgzLJBAL

2 Likes

hi sovitek,
sorry for the late reply.i can’t able see your script that video so fast.i describe different size of pipe but you did same size. isn’t it?can you share script here?
best regards
thajmul hussain

Hi @thsa2501 dont have it anymoore it was just an example and yes its same size but could easy be other sizes as well…try if you can follow the gif and just come back here if you go stuck, and we can help

1 Like

here is what i basically do…it could be a start…

I use Sparrow for shatter but ampersand have a shatter as well or use ootb split by point/parameter…pipe by line is Mepover but you could use Openmep as well…and for fitting it is Openmep

hi sovitek,
thank you so much your concern for me to create this.god bless you.
hussain

hi sovitek,
i could not able to find out Openmep package in dyanamo.any clue?

Hi again yeps that package need to be downloaded here from github…

1 Like

hi,
thanks a lot

1 Like

pipe to cad.dyn (65.4 KB)
kindly review i did not get it correctly.kindly tell me where i did mistake.

almost there just need some crossproduct and some other small things
…try as here…PS be sure you have dynamoironpythonpackage installed as well…hope it works :wink:

pipe to cad.dyn (58.0 KB)

1 Like

hi
thanks a lot now works.i want to know why u did cross product(lacing) for geometry does intersect.shall i know.

Hi in that case we search all possible intersections…take a look here

https://primer.dynamobim.org/06_Designing-with-Lists/6-1_whats-a-list.html

hi,
thanks a lot

1 Like