# Creating new Piping/Duct system

**URL:** <https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322>\
**Category:** Developers\
**Tags:** revit, excel, dynamo\
**Created:** [July 31, 2018, 12:55pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322 "2018-07-31T12:55:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [July 31, 2018, 12:55pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/1 "2018-07-31T12:55:32Z")

</div>

Hi everyone.

Tying to create a new piping system with Dynamo from excel.  
I have list of piping system and i want to create new piping system from each item in the list and set “system abbreviation” and set a materiel".

any idea? any help? any API ?  
no google solution was found ☹

Amir

---

<div class="post-metadata">

**Author:** ![jalshu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jalshu/32/51344_2.png) [@jalshu](https://forum.dynamobim.com/u/jalshu)\
**Post date:** [July 31, 2018, 2:16pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/2 "2018-07-31T14:16:08Z")

</div>

I think you can create system once you have elements in your model.  
I couldn’t fully understand what you are trying to achieve?  
Piping/Mechanical system will be assigned to Elements. Without elements you can’t create a system (As far as I know)

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [July 31, 2018, 2:56pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/3 "2018-07-31T14:56:20Z")

</div>

@jalshu thnak you for replay

i will try to make it clear .  
i have a very big list of systems and i want to create for all of thoes items new “Piping system” and then when i will model a new pipe I will chose one of thoes systems.  
i dont want to do it one by one by clicking duplicate-\> rename the piping system etc.

 ![2018-07-31%2017_51_36-](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/d/3dd29f29d5a2ee9638936db9db4f1b4a1b011594.png)

hope now its more clear.  
Amir

---

<div class="post-metadata">

**Author:** ![yamanyildirim](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yamanyildirim/32/52682_2.png) [@yamanyildirim](https://forum.dynamobim.com/u/yamanyildirim)\
**Post date:** [July 31, 2018, 3:42pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/4 "2018-07-31T15:42:19Z")

</div>

I think this will help.  
But first you need to create pipe for each “System Classification”

Element.SystemType is from MEPover package  
FamilyType.Duplicate is from Clockwork package

 ![Create%20System%20Type](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/a/1a17cc190180d07e8e031ec0821bea0818795cc4.JPG)  
 ![Create%20System%20Type-Family%20Tree](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/1/a164299fb1d903be4f9cfc1c94a4f23f574cbaf5.JPG)

---

<div class="post-metadata">

**Author:** ![jalshu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jalshu/32/51344_2.png) [@jalshu](https://forum.dynamobim.com/u/jalshu)\
**Post date:** [July 31, 2018, 3:55pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/5 "2018-07-31T15:55:03Z")

</div>

Ah… you meant systemtype. sorry I misunderstood that.

I assume that you can bring excel data to dynamo by your own and I wrote a short script to create pipe system and assign abbreviation.

```
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
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

pipe=Plumbing.PipingSystemType.Create(doc,MEPSystemClassification.OtherPipe,"My Test Pipe")
Abr=pipe.LookupParameter("Abbreviation")
Abr.Set("Jalshu")
Mtr=pipe.LookupParameter("Material")
Mtr.Set("steel")

        

TransactionManager.Instance.TransactionTaskDone()
OUT= pipe

```

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/4/f44caa1ba6b58d2d03f2bed01beebdde12cade9a.png)

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [July 31, 2018, 5:10pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/6 "2018-07-31T17:10:35Z")

</div>

@jalshu @yamanyildirim thank you so much for both of you!

ill start with @jalshu becasue its seems to be much easy.  
do you have any idea why the material doesnt change to “steel” ? maybe steel is not on your material list?

---

<div class="post-metadata">

**Author:** ![jalshu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jalshu/32/51344_2.png) [@jalshu](https://forum.dynamobim.com/u/jalshu)\
**Post date:** [July 31, 2018, 5:27pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/7 "2018-07-31T17:27:05Z")

</div>

```
Mtr=pipe.Parameters
for i in Mtr:
   if i.Definition.Name== "Material":
       
        i.Definition == "Steel"

```

replace material code with this and try.

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [August 1, 2018, 9:22am UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/8 "2018-08-01T09:22:38Z")

</div>

@jalshu

unfortunatly the material issue doesnt work.  
do you have any other idea?

---

<div class="post-metadata">

**Author:** ![jalshu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jalshu/32/51344_2.png) [@jalshu](https://forum.dynamobim.com/u/jalshu)\
**Post date:** [August 1, 2018, 12:44pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/9 "2018-08-01T12:44:05Z")

</div>

It worked perfectly for me. Can you share a snip of your system type property? and is the material you are trying to set is already in your material library?

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [August 1, 2018, 1:06pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/10 "2018-08-01T13:06:42Z")

</div>

@jalshu

yea

 ![3%20-%20%5BFloor%20Plan_%201%20-%20Mech%20-%20TIDHAR-MEP%5D](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/2/42ca6853b27935a3235231a0f9bf67bfd92c928c.png)

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [August 1, 2018, 1:07pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/11 "2018-08-01T13:07:21Z")

</div>

![3%20-%20%5BFloor%20Plan_%201%20-%20Mech%20-%20TIDHAR-MEP%5D](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/b/bb23ec895ab82d0166de094af6e4e6d0eb239d6c.png)

---

<div class="post-metadata">

**Author:** ![Tom\_James](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tom_james/32/22277_2.png) [@Tom\_James](https://forum.dynamobim.com/u/Tom_James)\
**Post date:** [August 2, 2018, 12:49pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/12 "2018-08-02T12:49:47Z")

</div>

change:  
i.Definition == “Poche”  
to:  
i.Definition **=** “Poche”

the first one is testing if it equals poche, so if you printed that it would return False.

.set(“Poche”) should work

you may have to get the elementId of the material, then use that to set it

I would also stay away from lookupparameter and use the BuiltInParameter instead

---

<div class="post-metadata">

**Author:** ![jalshu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jalshu/32/51344_2.png) [@jalshu](https://forum.dynamobim.com/u/jalshu)\
**Post date:** [August 2, 2018, 6:31pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/13 "2018-08-02T18:31:33Z")

</div>

@Tom_James Thanks for the tip Tom,I haven’t done set material via API before. I thought it would similar to setting other parameters. but it seems like it takes only MaterialId as a input not a material name as a string. To set material by its name we need to search for materialId first and then assign it here. Right?

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [August 5, 2018, 5:07am UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/14 "2018-08-05T05:07:35Z")

</div>

Hi @Tom_James and @jalshu i try your segestion but unfortunatly its doesnt work

> Mtr=pipe.Parameters  
> for i in Mtr:  
> if i.Definition.Name== “Material”:  
> i.Definition **= 26**

and the other one

> Mtr=pipe.LookupParameter(“Material”)  
> Mtr.Set(26)

i cheack it and 26 is one of the material id in my project

 ![2018-08-05%2008_06_01-Dynamo](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/c/9cf85f4191fd4e112d836683023170e4728ae1f8.png)

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [August 6, 2018, 12:24pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/15 "2018-08-06T12:24:47Z")

</div>

Hi @jalshu and @Tom_James , do you have any idea?

---

<div class="post-metadata">

**Author:** ![Tom\_James](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tom_james/32/22277_2.png) [@Tom\_James](https://forum.dynamobim.com/u/Tom_James)\
**Post date:** [August 6, 2018, 12:26pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/16 "2018-08-06T12:26:17Z")

</div>

Hi Amir & Jal, sorry to leave you hanging, i’ll get back to you later today i’m swamped.

---

<div class="post-metadata">

**Author:** ![jalshu](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jalshu/32/51344_2.png) [@jalshu](https://forum.dynamobim.com/u/jalshu)\
**Post date:** [August 6, 2018, 12:43pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/17 "2018-08-06T12:43:33Z")

</div>

As per my understanding, It has to be Element not Integer, when you get “Element.Id” you get Integer value not element. That’s why my next suggestion would be, Search material name by string and get matching material by Boolean mask and then assign it to your pipe system.

---

<div class="post-metadata">

**Author:** ![Tom\_James](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tom_james/32/22277_2.png) [@Tom\_James](https://forum.dynamobim.com/u/Tom_James)\
**Post date:** [August 6, 2018, 3:04pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/18 "2018-08-06T15:04:12Z")

</div>

@amir.aroesti  
@jalshu

Hi both, sorry for the late reply.

The easiest way to find the parameter storage type / what parameter to set would be to use the Revit Lookup addin:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/8/d8c499324c14e79d1a2f09d725dffef376f265cc.png)

We can see that the material of a system type has a built in parameter name of MATERIAL\_ID\_PARAM, and the storage type is ElementId.

We can get this by, modifying what Jal has done above:

```
BIP = BuiltInParameter.MATERIAL_ID_PARAM
Mtr=pipe.get_Parameter(BIP)

```

All we need to do then is get the material, filtered element collector would be the easiest way programmatically, get the Id of the material, then set the parameter using:

```
pipeMat = the id of the material you want to set
Mtr.Set(pipeMat)
```

---

<div class="post-metadata">

**Author:** ![amir.aroesti](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amir.aroesti/32/130247_2.png) [@amir.aroesti](https://forum.dynamobim.com/u/amir.aroesti)\
**Post date:** [August 7, 2018, 1:10pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/19 "2018-08-07T13:10:33Z")

</div>

@Tom_James  
Thank you very much for your help and sorry about to the delay its due to different time zone and to much out of the ofice meeting 😔

first : i got the Lookup app and its amazing, it going to help us a lot!

 ![3%20-%20%5BFloor%20Plan_%201%20-%20Mech%20-%20TIDHAR-MEP%5D](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/3/e32b518eb43c733c4835d6e5c261517ebc09be9f.png)

As you can see, me screen shows diiferent value and Im confuse .  
when I chose one of my "pipe system " i got a different paramter of material and im not relly shure what code line i have to change.

Lets say that until the material lines everything works fine

> # Enable Python support and load DesignScript library
> 
> import clr  
> clr.AddReference(‘ProtoGeometry’)  
> from Autodesk.DesignScript.Geometry import \*
> 
> # The inputs to this node will be stored as a list in the IN variables.
> 
> dataEnteringNode = IN
> 
> # Place your code below this line
> 
> # Assign your output to the OUT variable.
> 
> 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  
> doc = DocumentManager.Instance.CurrentDBDocument  
> TransactionManager.Instance.EnsureInTransaction(doc)
> 
> pipe=Plumbing.PipingSystemType.Create(doc,MEPSystemClassification.OtherPipe,"My Test Pipe")  
> Abr=pipe.LookupParameter("Abbreviation")  
> Abr.Set("Jalshu")  
> Mtr=pipe.LookupParameter("Material")  
> Mtr.Set(Material Tid - Test 914840)  
> OUT= 0

---

<div class="post-metadata">

**Author:** ![Tom\_James](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tom_james/32/22277_2.png) [@Tom\_James](https://forum.dynamobim.com/u/Tom_James)\
**Post date:** [August 7, 2018, 2:20pm UTC](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322/20 "2018-08-07T14:20:51Z")

</div>

Read my post above, you need to replace LookupParameter with get\_Parameter(BIP).  
Also, the elementid is 914840 in your case, the left image is showing a description and the Id, don’t use this. I think you need to do some background reading, have a look at the dynamo primer.

```
import clr
clr.AddReference(&quot;RevitAPI&quot;)
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference(&quot;RevitServices&quot;)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)

pipe = Plumbing.PipingSystemType.Create(doc,MEPSystemClassification.OtherPipe,"My Test Pipe")

BIP = BuiltInParameter.MATERIAL_ID_PARAM
Mtr = pipe.get_Parameter(BIP)

matFilter = FilteredElementCollector(doc).OfClass(Material).ToElements()
pipeMat = [m.Id for m in matFilter if m.Name == "Copper"][0]

Mtr.Set(pipeMat)

TransactionManager.Instance.TransactionTaskDone()

OUT= pipe
```

[Next page](https://forum.dynamobim.com/t/creating-new-piping-duct-system/24322.md?page=2)
