Math.Sum length of the filtered Items


I want to select my pipes and filter on System Name.
My system name is equal with the same set ive select.
In my sets is see the Section, every section is changing when the size of my pipes are changing.

So i’ve filter the kw (cold water [system name]) and filtering the uniqueitems.
I want to do the same with the parameter “Section” and calculate the length


System Name = hw1
section 1 = 3000mmm
section 2 = 1500mm
section 3 = 2500mm

System Name = kw1
section 1 = 1000mm
section 2 = 500mm

After this i want to tag this so i make a parameter of this void.

Is there someone who can help me out?


Jan Willem


Hello Jan Willem,

So if I understand corectly: you want to get the total length of all the pipes per system?


Thank you for your reply.
I want to use the tool for prefabrication.

As you can see we use different diameters. Right now we use the tool Measeure Along an Element (revit tool) but we can’t make a tag.

So i found out that my pipe type make a System Name, the system name change by a new set.
My first set is for example cw1 (cold water) and second set is hw1 (hot water).

In my properties is see that each System Name make his own Section, when the diameter change the section is changing also.

I want to make a tool that sum the length of a set filtered by the System and after that i want to filter it in Section.

So you want to first filter your elements by system name and after that by section number? You could try the node ‘Group By Key’ for this. It will group the elements based on their parameter values like this:

1 Like

as i understand you need something like that


Thank you!

Yes, this is what i need! Thank’s alot!

I have a last question:

I want to make a parameter after calculate and it is working.
But as you can see are the shared parameters of my bend different, I can’t change this because we take the familys from a server.

How can I use by Element.GetParameterValueByName a double parameterName?
I need “Length and lengte”

I like to hear youre response

if i understand it correctly you want to get the System “Length” parameter value and then set it to your shared parameter “Section Lengthe”

1 Like

Thank you again, this topic is solved! :slight_smile:

1 Like

Hello everybody,

The script is working but I have one problem.
My parameter Section is visible in my pipes but not in my pipe fittings.
But when I take a “Pipe Pressure Loss Report” I see section’s by my pipe fittings (see below)

I think the Section parameter is a Revit parameter, how can I make this visible in my properties?

@T_Pover Right now is the script almost done but I can’t take my section of the pipe fittings.
Here is my script:

20-06-19 water tag.dyn (11.2 KB)

Yesterday I started with MEPover, do you know a way to get the connected element of the same sections?

See below the missing values

Here is my revit file: