# Create Pipe by Line (dynamo) , how?

**URL:** <https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786>\
**Category:** Developers\
**Created:** [November 23, 2023, 12:49pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786 "2023-11-23T12:49:06Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [November 23, 2023, 12:49pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/1 "2023-11-23T12:49:06Z")

</div>

Hello,

so my script works without error

- i have my lines
- pipes
- a system  
a.s.o.  
 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/4/6436a1b7293b8f03b7fb255ce34f0a1d87e42ad2.png)

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](https://forum.dynamobim.com/uploads/short-url/8PF7awYU2lYIZDisiqLFs9dfEfC.dyn) (21.0 KB)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [November 23, 2023, 12:51pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/2 "2023-11-23T12:51:36Z")

</div>

Hi Andreas …i guess you miss pipetypes…

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [November 23, 2023, 12:54pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/3 "2023-11-23T12:54:20Z")

</div>

@sovitek ,

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/2/52b6283954607237d5df57d03e2f4e31c0e57595.png)

it remains in cero

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [November 23, 2023, 1:14pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/4 "2023-11-23T13:14:25Z")

</div>

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

 ![Skærmbillede 2023-11-23 141237](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/4/746599b469f522f691d0627f5c52429efc228d89.png)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [November 23, 2023, 1:42pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/5 "2023-11-23T13:42:52Z")

</div>

@sovitek ,

could the problem be also a units-convertion-issue ? becaus diameter results in an error… it is for civil 😕  
 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/0/a0543485865226394acf2985963e9619932eea03.png)

KR

Andreas

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [November 23, 2023, 1:53pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/6 "2023-11-23T13:53:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [November 23, 2023, 1:54pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/7 "2023-11-23T13:54:25Z")

</div>

@sovitek

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/4/24edc671f0a29b945e6c3639d69656a3388a5263.png)

my input are dynamo lines i filter them

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/9/79b0f79a59729ff421b46047e34827a3e47fb027.png)

a pipe

KR

Andreas

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [November 23, 2023, 2:08pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/8 "2023-11-23T14:08:04Z")

</div>

@sovitek ,

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

```auto
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

```

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [November 23, 2023, 2:55pm UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/9 "2023-11-23T14:55:13Z")

</div>

@sovitek ,

 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/0/9058373b6f108a0178b6f50cf68427dad6b3947c.png)

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

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [November 24, 2023, 5:52am UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/10 "2023-11-24T05:52:27Z")

</div>

Another way with Open MEP

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/9/e90f6ea6ecf28bf5c1bb6daf70e229b03bb3c07e.png)

See document : [Class Pipe | Open MEP](https://chuongmep.github.io/OpenMEP/api/OpenMEPRevit.Element.Pipe.html#OpenMEPRevit_Element_Pipe_CreateByLine_Revit_Elements_Element_Revit_Elements_Element_Revit_Elements_Element_Autodesk_DesignScript_Geometry_Line_)

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [November 24, 2023, 11:12am UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/11 "2023-11-24T11:12:58Z")

</div>

@chuongmep ,

how to install? in the folder there are  
 ![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/7/17b9a6b9903fb4213b3718c5bcbbe36f0e8e2639.png)  
KR  
Andreas

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [November 24, 2023, 11:31am UTC](https://forum.dynamobim.com/t/create-pipe-by-line-dynamo-how/95786/12 "2023-11-24T11:31:03Z")

</div>

Hi @Draxl_Andreas , you can follow tutorial here : [How to install OpenMEP package | Open MEP](https://chuongmep.github.io/OpenMEP/articles/installation.html) . Install to use is more easier than develop it.
