# Calculation of Pipe Quantities

**URL:** <https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631>\
**Category:** Revit\
**Created:** [February 15, 2017, 3:14pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631 "2017-02-15T15:14:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kvusal](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@kvusal](https://forum.dynamobim.com/u/kvusal)\
**Post date:** [February 15, 2017, 3:14pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/1 "2017-02-15T15:14:41Z")

</div>

Dear Dynamo team,  
i am planing to create program to calculate pipe quantities of project. Problem is there is 3 different types of pipes and each pipe type have 3 different sizes. So for example output should be like below (Output should be sorted also). Have you any suggestions? Should i use python for this or Dynamo is enough for this? (I don’t know python yet. 😞 )

Copper Pipe  
6.35 - 10 meter  
12.7 - 25 meter  
22 - 15 meter

Steel Pipe  
15 - 50 meter  
20 - 25 meter  
25 - 30 meter

PVC Pipe  
50 - 30 meter  
100 - 10 meter  
150 - 45 meter

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [February 15, 2017, 3:24pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/2 "2017-02-15T15:24:05Z")

</div>

Hi @kvusal

You can retrieve all the pipe types by using “Element.Type” node and then sort them by type name and at last use List.Count node with lacing to longest to get the quantities of each type. Hope it helps!

---

<div class="post-metadata">

**Author:** ![kvusal](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@kvusal](https://forum.dynamobim.com/u/kvusal)\
**Post date:** [February 15, 2017, 4:23pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/3 "2017-02-15T16:23:10Z")

</div>

Dear Kulkul, count will work? We need to make Dynamo to calculate total meter of pipes for specified size and type.

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [February 15, 2017, 4:33pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/4 "2017-02-15T16:33:50Z")

</div>

Hi @kvusal ,  
you could do something like this:

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/3/b3a8378a8958e53c1e50cfaa7c80edd85d36314f.png)

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [February 15, 2017, 4:35pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/5 "2017-02-15T16:35:59Z")

</div>

Sorry @kvusal I thought your trying to get count. @Mostafa_El_Ayoubi Solution should work for you.

---

<div class="post-metadata">

**Author:** ![kvusal](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@kvusal](https://forum.dynamobim.com/u/kvusal)\
**Post date:** [February 15, 2017, 4:37pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/6 "2017-02-15T16:37:06Z")

</div>

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![kvusal](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@kvusal](https://forum.dynamobim.com/u/kvusal)\
**Post date:** [February 15, 2017, 4:49pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/7 "2017-02-15T16:49:09Z")

</div>

Dear Mostafa,  
I tested script you send by photo. It did good on the result of material type pipe Length Calculation. However did not mentioned any sizes in the result. 😞 I mean:  
Your script result become like:  
Copper Pipe : 50 m  
Steel Pipe : 105 m  
PVC Pipe: 85 m

But what i wanted:  
Copper Pipe  
6.35 - 10 meter  
12.7 - 25 meter  
22 - 15 meter

Steel Pipe  
15 - 50 meter  
20 - 25 meter  
25 - 30 meter

PVC Pipe  
50 - 30 meter  
100 - 10 meter  
150 - 45 meter

---

<div class="post-metadata">

**Author:** ![Mostafa\_El\_Ayoubi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mostafa_el_ayoubi/32/7815_2.png) [@Mostafa\_El\_Ayoubi](https://forum.dynamobim.com/u/Mostafa_El_Ayoubi)\
**Post date:** [February 15, 2017, 4:55pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/8 "2017-02-15T16:55:43Z")

</div>

@kvusal,  
you can use the same logic and group by diameter value :

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

---

<div class="post-metadata">

**Author:** ![Jason\_Seck](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jason_seck/32/203743_2.png) [@Jason\_Seck](https://forum.dynamobim.com/u/Jason_Seck)\
**Post date:** [February 16, 2017, 4:16pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/9 "2017-02-16T16:16:44Z")

</div>

This can easily be done with a Revit schedule. I’m curious what advantage using Dynamo has over a schedule.

---

<div class="post-metadata">

**Author:** ![kvusal](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@kvusal](https://forum.dynamobim.com/u/kvusal)\
**Post date:** [February 16, 2017, 8:44pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/10 "2017-02-16T20:44:06Z")

</div>

Dear Jason,  
You are right. What i am doing to reduce time lost and making mistake during preparing BOQ. I mean i am tring to prepare BOQ directly from Dynamo. 🙂

---

<div class="post-metadata">

**Author:** ![dilipgowda21n](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@dilipgowda21n](https://forum.dynamobim.com/u/dilipgowda21n)\
**Post date:** [August 8, 2018, 4:32am UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/11 "2018-08-08T04:32:24Z")

</div>

Hello Mostafa.  
I am using the script you have given its works superbly well thanks for that i am a beginner in dynamo is there any node i can write this to excel i tries write to file but its not working please help me out , thanks in advance

---

<div class="post-metadata">

**Author:** ![s194951](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@s194951](https://forum.dynamobim.com/u/s194951)\
**Post date:** [May 10, 2021, 5:27pm UTC](https://forum.dynamobim.com/t/calculation-of-pipe-quantities/9631/12 "2021-05-10T17:27:47Z")

</div>

Hey Jason,  
I thought I could do it easy with a schedule, but it seem that I cant filter by type, only size and length. So I can olnly get the total length of all the pipes, and not the length of all the steel pipes, and all the flex pipes. So what am I doing wrong here?

-Brian
