I tried to find a solution in the forum, but unfortunately n.
I’d like to reorder a bunch of closed curves, which normally comes in random order. To guide the new positions I used a curve to orient them along it. Then moving the curve to the opposite side, I can take their orientation with them. If I mirror it, I get the reverse.
Taking inspiration from Seghierkhaled sort method, I thought this could make a useful tool, so I made a quick Python script. Maybe it is useful to others too, so thought I would share.
I haven’t covered all basis, at the moment, but could add more. Right now I just have: X, Y, Z, X-y (where X is dominant, then Y), and Y-x (where Y is dominant, then X). I also have positive and negative values for the sort direction.
You dont need the additional curve to the right to sort with this method.
Great solution as well! Worked like a charm! and I’m sure this such of solution going to work for most people over here.
Besides my previous question about how to order curves position, I would also like each of them has its control points remapped, as shown in the figure below:
I’m trying to do this mainly because polylines comes in a mess order and most of them comes in flipped or drew in most variant forms ever. In order to my definition works fine I need the points were mapped correctely.
There are many was, depending on what you need. I’m not sure if the actual point order is important to you, or if you just want to unify the curve direction. Attached is an example of both. Sasquatch also has a Sort Points Polar component, if that might be usefull for you.
Sasquatch only works in Rhino 6, I’m still using Rhino 5.
The point order is important for me because part of my code is about labeling this closed curves, making use of aligned dimensions.
I do import my curves into GH from Rhino using a layer selector, so I can’t control the order which curves is going to be the first picked one, then ‘Flip Curve’ component selecting one of them as a “correct one” in terms of curve direction doens’t work for me, I tried it before.
The first closed curve is the correct one, because X and Y aligned dimensions are set on X in lower position (left to right/0 to 1) and Y right side (down to up/1 to 2). It’s because the point order is important por me.
Imagine a bunch of curves, all points not ordered, I have to flip or rotate manually on Rhino the “incorrect ones”, to get this type of reading.
I tried your definition but failied for me.
Thank you so much for your time, it’s helping me alot!