Create Pipe by Line (dynamo) , how?

Hello,

so my script works without error

but it resulted in cero , whats way out?

the pipes first need to be connected, the should be place line by line…

or have i to filter out line which are too short.

KR

Andreas
PyDWGSetPipe.dyn (21.0 KB)

Hi Andreas …i guess you miss pipetypes…

@sovitek ,

it remains in cero

hmmm does it work if you feed in ootb nodes and probably lacing longest

1 Like

@sovitek ,

could the problem be also a units-convertion-issue ? becaus diameter results in an error… it is for civil :confused:
grafik

KR

Andreas

arhh ok…can you show what you select, and what happends if you feed in a diameter by codeblock

@sovitek

my input are dynamo lines i filter them

a pipe

KR

Andreas

1 Like

@sovitek ,

here is the code, but i think there is no issue, only thing that is suspect: in the transaction the brakets [i%ll].

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

@sovitek ,

i think i got it i was feeding it with MEP Systems instead of MEP System Types

Another way with Open MEP

See document : Class Pipe | Open MEP

4 Likes

@chuongmep ,

how to install? in the folder there are
grafik
KR
Andreas

Hi @Draxl_Andreas , you can follow tutorial here : How to install OpenMEP package | Open MEP . Install to use is more easier than develop it.

1 Like