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"