Sorting curves and points

Hi All,

I have this fairly simple shape below which was created in CAD, and I’d like to create vertical divisions as per the yellow line.
I have two problems with this - firstly the curves are not ordered by Z height (top to bottom, or bottom to top), and secondly, the start point of the curves are not aligned so when I join the points, the polylines are all over the place as you can see.

I could deconstruct the points, and manually sort them by height, and then sort them radially by projecting a ray from some centre point outwards and measuring the angle, but this feels really complicated, and not very ‘grasshoppery’…

Is there an easier way to do this?

GH file attached.
SortPoints.gh (27.1 KB)

Thanks

missing

This got more involved than I expected.


SortPoints_2024Oct9a.gh (DEPRECATED due to error)

P.S. I just realized this works only when the ‘Count’ slider (blue group) is an even integer.

This version ‘b’ works with odd and even ‘Count’ values. :sweat:


SortPoints_2024Oct9b.gh (44.7 KB)

1 Like

Thanks for that! I appreciate the effort. It will take me some time to digest what’s happening there…

I did version ‘c’ that was much faster using BBX (Brep | Brep) instead of Sec (Brep | Plane), then had an insight that I hoped would be simpler (it’s not) and certainly more accurate (it is :bangbang:).

Version ‘d’ rotates a plane evenly on an axis. Compare these top views

Version ‘b’:

Version ‘d’: (best!)


SortPoints_2024Oct9d.gh (52.6 KB)

There is a visible difference in where the colored lines are located. They are separated by the same angles in version ‘d’, whereas version ‘b’ divides two circles that are skewed from the axis. Version ‘d’ is the fastest too, which makes it more pleasant when changing the ‘Count’ slider.

P.S. Some of the code in version ‘d’ wasn’t necessary anymore since curve division was replaced by plane rotation - so I removed it. Simpler now and works the same way. :+1:


SortPoints_2024Oct9dd.gh (48.1 KB)

There is code in version ‘d’ at the bottom that uses Z values to decide if intersection lines should be flipped. It might be a good idea in general but my motivation was for Point List to number them in consistent locations at the bottom:

SortPoints_2024Oct9dd2

I decided that Z values are not the best way because they might fail if the brep were horizontal instead of vertical. So I used Crv CP instead to get distance of start points from the large edge curve at the “bottom”:

SortPoints_2024Oct10a
SortPoints_2024Oct10a.gh (50.1 KB)

Then I decided it would be easy to split the brep instead of getting intersection lines… :man_facepalming: But proceeded to squander a ridiculous amount of time and effort trying and failing to get SplitMul (Split Brep Multiple) to behave similar to BBX (used to get the intersections). What a fiasco that turned out to be :bangbang: I can’t document now all the ways it failed, maybe another time. :angry:

So instead I used the intersection lines (without flipping them) to SrfSplit the three original surfaces, sorted the fragments using a circle, and here you go:


SortPoints_2024Oct10c.gh (48.8 KB)

1 Like

Just wanted to reply to say I’ve made progress on this, but it’s deviated from the original approach somewhat - thanks to your suggestions.

My original post was intended to be step 1 of many, eventually, I wanted a criss-cross pattern on the shape with raised solid edges. I have almost completed this now.

In short - I created a solid with some thickness, twisted and arrayed (polar) it around the centre point, then solid offset the original surface, and did a solid intersect between the two geometries.

There are still a few nuances to sort out, I’ll post back when I have more time.

Side note: Try as I might, I can’t see the difference between your Version ‘b’ and ‘d’ images above…I even overlaid the two images and they appear to be identical… Could you highlight the differences?
I did notice that my original approach resulted in nonplanar vertical curves - but equal spacing around all horizontal curves… Meanwhile, the intersection curve approach results in planar vertical curves, but unequal spacing on the horizontal curves, so I guess it depends on your preference.

Thanks again for your effort on this, I’ve spent many hours on this, so I realise how much time you must have spent.

Click on Version ‘b’ image, then click ‘Next’ icon or use the right-arrow key to see the Version ‘d’ image. Or study this animated GIF; lines labeled 1, 3, 5 and 7 shift slightly between versions.

SortPoints_2024Oct9bd
full size

1 Like