Tag all pipes based on diameter range

Hi Everyone,

Dynamo noob here. I have been waiting for a use case which will require Dynamo, and here I am!

I’m working with sprinkler piping and I want to achieve the following:
Tag all pipes with an outside diameter greater than 26.7mm but less than 168.3mm

Abovementioned will be ideal, but I will be more than happy if it’s only a selection based on the diameter range. I will then use Tag All (Selection) to complete the task.

Any advice will be appreciated. Thanks in advance!


You can get parameters from pipes using the node GetParameterByName, use the string Outside Diameter and then an if command to find if it is >26.7 and <168.3. This will get you a list of true or falses which you can filter using FilterByBoolMask node. Give it a try and let us know how it goes. If you get stuck, come back with a specific problem and we can help.

If you are really new to Dynamo, I would suggest going through the Primer first and watch some of the tutorial videos on this website.

Thanks, kennyb6! I will give it a try.

Hi Kenny,

This is what I have so far :confused:

I decided to rather use the “size” parameter and I can successfully get the list to display the sizes, but I’m not sure how to proceed from here with the “If” and List.FilterByBoolMask. I basically want to select all pipes >20ø & <150ø

I looked through other example scripts and found a Python script which initiates the selection of the elements, in case you’re wondering what it is.

Thanks in advance for any advice!


Hows this:

I have shown 2 ways to do it. Let me know if you need explanation
Note that if you use the “Number” node instead of Code Block to input the high and low values, you can adjust the high and lows in dynamo player.


Thanks for this!

Please explain if possible. I will try to recreate this in the meanwhile.


This is my attempt:

I can see that my “filtering” of the pipes are working, but it’s still tagging everything. Is it because of the “All elements of category” node?

No problem. I suggest having a read of dynamo primer, and especially on code blocks (very useful)

For the top Script

  1. The code block:
    a > x
    a < x

This creates 2 outputs, which show whether or not this equation is true or false for each of the inputs from the list of pipe sizes.

  1. Because you are looking for more than one IF condition, you need to find when both are True. Therefore using a Code block with an AND Logic (using && here. note: OR would be: a || b )
    This then outputs TRUE only if both inputs are TRUE. I’ve added a "Watch node after this code block to explain it a little better:

The reason your script still tags all the elements, is because that’s what you have told it to do… The output of the IF node is true or false, and therefore, if true it will run the element tag node (Which you have put all pipe elements of the whole model)

Apologies, I may have lead you the wrong way a little. You need to filter the pipes that you want to tag, so you need to filter the “elements” list, not the list of diameters.

Try the below. Essentially the major change is that I have connected the output from “Elements” as the list input to the filter by boolean. Hope it helps.

Note: that this is filtering all the pipes in the whole model, but the tag element node is tagging only pipes in the specific view. This may cause an error, but i’m not sure. Or you might be able to Tag all pipes on all views if you create a list of views… Good luck!

Hi @danielU3R39

First off, thank you so much for your help thus far.

I tried your latest suggestion, and it looks like it’s filtering, but the tags aren’t showing up. The only difference I noticed between your example & my script, is that ‘‘a’’ isn’t displayed in blue (&& operator). I had a look at the Dynamo Dictionary but it doesn’t look the same (I guess it still performs the same function?)

My apologies in advance if I missed something obvious.

It’s working!!! :smiley:

I found the issue. You also have to add information to Tag.ByElement

This is just what I needed to get me going with Dynamo! My next task will be to to take this script further by only tagging pipes with a length greater than 100mm and to somehow tweak the offset to have the tag sit above the pipe.

Thanks @danielU3R39 & @kennyb6!

Your more than welcome. Building an “automatic tagging” script is also on my list, so let me know how you get along!

1 Like