Splitting selected sprinkler rows into different lists

Hi everyone,

I have the following scenario:


I want to select all 10 of these sprinklers and have them split up into sub lists according to their rows (5 spinklers in 1 list, 5 sprinklers in a separate list).
What would be the best way to go about doing this? What I have done so far is taken the total number of sprinklers selected, divided by 2 and minus one to get that index and split the list. This only works if I have two rows of sprinklers with even numbers. If I go to 4 rows of sprinklers this method wont work.
Any tips or basic overall strategies to accomplish this?
Thank you!

You can use each sprinkler’s X position to first sort the list then group them into sublists. This will be more accurate than splitting the list based on the number of items as there could be more than two rows. See the attached screenshot for my approach. The Point.X node is really precise so I used a Math.Round node to round down the values to something more reasonable.

1 Like

An idea to try for non-orthogonal work:

Use a Line.ByBestFitThroughPoints node to create a line down the middle of all the sprinkler points.
Get the point on the line closest to each sprinkler using a Geometry.ClosestPointTo node.
Get the vector from the point on the line to each sprinkler.
If that length is more than your ‘branch’ tolerance, convert that vector to a string and group the sprinkler points using that string as a key.
If the value is less than the branch tolerance, continue on.

The process could be repeated once for each ‘row’ until all points are within N units (the vector length) of the line, at which point you’re ready to draw the sprinkler lines and branches.

Might not keep corners squared off though, so some relaxation of the lines might be required.

2 Likes

Thanks Michael,
Funnily enough I immediately got off the forum and started doing this approach, I used the “Group by key” rather than sort, not sure what the difference here is… The problem with this approach is that if the sprinklers are running in the opposite direction, I then need to get the “Y” value instead of the X. I’m not sure how to automatically detect which way the sprinklers are going, I think this might be where line work and vectors come in.
But thank you for your answer though, I will continue to explore this method a bit.
Many thanks!

Hi Jacob,

Really interesting approach thank you. I suppose this would account for a number of situations and might be more flexible in the long run. I’m going to explore this option as well and see what I can come up with in the end.
I have a clearer direction of where to go thanks to yourself and @Michael_Kilkelly, I will post back when I have a solution.
Thanks again!

1 Like

Hi @JacobSmall and @Michael_Kilkelly, I used Michaels approach yesterday with some success but there is a little snag that I would like to share, hopefully you can tell me what I am missing.
When I select multiple rows of sprinklers and run the script, this is what I get in Dynamo:


This is exactly right and what I am looking for, but this is the equivalent result inside of Revit:

The red squares indicate fittings that have not been placed… So the two branch pipes are basically one long pipe each, they have not been split up into sections and the tee’s haven’t been placed to connect the horizontal pipes to the branch.
Here are the last steps of my graph, I’m hoping this shows enough to give you an idea of what is happening. Could you tell me if you see anything out of the ordinary? I think it is something to do with list management or levels.
PS. I have tried every combination of list levels I can think of for these “Pipe.ByLines” nodes as well as the fitting creation nodes, just cant figure out this last step.

i just glanced abit at the scripted, sometimes the END transaction node or similar helps organize the fitting connection process. it could be that one connection process halts the second one.

Hi Wuillian,

I did put in a lot of “Passthrough” nodes to arrange the order of operations… But that didn’t seem to work. Would the END transaction node work differently?

it really depends on how you layout your nodes for creating pipe and based on what point you are creating them to load to fittings. Try a successful single pipe attachment first and them use the same result for multiple. I had trouble connecting tees in mine because once the Tee is created for the first sprinkler a second pipe is created at the split. This new pipe is no longer listed since it would have a new instance id parameter. Sequence the connection from either ends on the pipe kinda Like a “zipper” this will keep the pipe instance id of the original branch or something like that i think.

also i tried this approach before “selecting sprinkler” to create armover piping. In the end i got better results by selecting the branch line first. In my workflow we layout branch lines based on structural or architectural elements and in coordination with other trades. Using the sprinkler to layout the branch locations ends up with an unrealistic placement of branchlines. :). this last process of sprinkler connection is the last part of the design once the proper coordantion with HVAC and plumbing trades is complete to avoid major clahses.

Thanks very much, that is exactly the issue that I am having.
The strange thing is, I can successfully apply all the connections and fittings for a single row of sprinklers, but as soon as I scale it up to multiple rows, it stops working. The order of operation stays the same though, so I just cant understand where the issue is.
But I will keep trying, thanks for your help!