# Splitting a PolyCurve by Corner

Hi All,
I am working on a graph that will be used to optimize mullion lengths in a curtain wall. The mullions are manufactured in 3 meter pieces, and I want to calculate how many to order. I have a curtain wall in revit, and I’m trying to get the length of each straight section. Because my curtain wall has vertical divisions, even straight sections are divided into several different curves.
What I have so far is a graph that gathers all relevant mullions, gets their curve geometry and joins them into a polycurve.
I’m looking for a way to “split” the curves at the corner, so I am left with only straight curves. I’ll attach a capture of my optimization graph just so you could have a look.
Thanks a lot for any help in advance!

Could you show watch node at GroupCurves node.

I think it’s the same as the location curves

Try Custom nodes from Rhythm package it will give the result you need.

This doesn’t quite do what I’m looking for. I’m afraid it only works on interior mullions (I need both interior and border ones). Also, it contains no data about the mullions themselves, meaning I cant use it for example to see how many pieces of “type x” to order.

Do you know of any splitting methods that take into account normals? Or maybe even a node that does that?

Thanks!

I have a thought on how to go about this with the added concerns you have. Hopefully you have some experience with lacing, levels, and nested lists as it will be a requirement to keep the number of tests down.

1. group the millions by the normalized vector of their curves.
2. for each group build a poly line by pulling the curves and proceeding as above.
3. get the million at the start of each group, then the second, third, fourth… this can be done by comparing the distance from start point of the millions curve to the start point of the poly line point - of its 0 then its first, 1 is second, 2 is third… basically you’ll be sorting by that distance value as a key.
4. Next you need to confirm that they are all the same type of million - get the family type name and convert to a string or element ID. List.Unique to filter out which values you need to search for.
5. Find all indicies of each value, and pull the millions for each.
6. Get the length of each million in the sub-sublists and total the distance. These are the million lengths for your bin packing into the 3m strips.

Not an “easy” graph by any means, but more for an intermediate to advanced skill set. I can see how it would have tons of value for a CW manufacturer or subcontractor. Could take a good bit to run as well with the multiple geometry conversions.

Also, don’t the either vertical or horizontal millions usually ‘rule’ so only they run continuous? If so you could filter out the horizontal or vertical millions early on by the vector as that will save significant computation time.

Hmm, probably need for fine tuning, but maybe this could suffice?

Using a polycurve node and then exploding if the curves aren’t built in a CW/CCW fashion.

Jacob: I am trying to do what you suggested, starting from trying to group the mullions by vector… I’m trying to use GroupByKey, but have not accomplished this yet.

Jostein: First of all, I really like your solution! I tried it out and it worked well, but a few real-world examples showed that it won’t work quite as easily as I thought. For starters, branching (a T intersection between walls) is not supported, and the polycurve fails when it occurs. Also, straight pieces of CW aren’t being calculated correctly. I’ve been trying to find solutions, but have so far hit a dead end.

Thanks again for your help, if you have any more ideas I would love to hear them!

Halleluja!

Just a few minutes after I posted my reply, I happened upon a node called GroupByHost… It totally simplified everything and I believe I have a solution.
What do you think?
Is there any place I can post a short write-up and my dynamo graph for other people to use?

Thanks!!!

Feel free to post it here, marking it as a solution. You can also create a new topic under the category “share”.