Reordering curves and creating sub-groups

Hi All,

I’m new to the forum, although I’ve been using it a lot to learn how to use grasshopper, I’m hoping I’ve posted in the right section.
This time unfortunately I couldn’t find an answer to the problem I’m trying to solve, hopefully someone can help me.

I have a series of “main” curves defined by several segments (curves).
These are not drawn in a specific order.
I’m trying to:

  • reorder the curves so that these follow the main curves, starting from the bottom to the top (ordering based on the Z direction could also work but not ideal)
  • group the curves into sub-groups, so that I could select say 30-40-50…100% of each curve starting from the bottom.

I’m attaching some screenshots which hopefully help understanding what I’m trying to achieve.

I’ve tried to join the curves together and shatter them but with no luck.

I’m not sure if there’s a grasshopper component that does this.

Any help would be much appreciated!

test

groups

export rhino.3dm (158.1 KB)

Much space for improvement, but first thing which came into my mind.

Every branch has the lines for the complete curve. Sorted from bot to top. The branches are also sorted around a circle.

sortcurves.gh (25.0 KB)

1 Like

Hi Tim, thanks a lot for helping out!
I’m trying to understand how you did it, it would have taken me ages to do that!

I’m struggling to understand how you managed to rearrange the order of the lines forming the curves.
I get to the part where you projected the lines and points on XY but I get lost shortly after the tree stats.

Any chance you could explain what the main “steps” are?
Thanks again!

The problem was, I grouped the curves by their vector. But because the curves leaned back in te beginning, they had a different direction. I dispatched the curves, (they just had 25 elements in the branch) and flipped the vector direction. After this step I could compare the vector again and got them into the right branch. I joined them, which worked now correctly, and exploded them to get the segments back.

That’s great thanks Tim!

Is there a way to extract the segments in each group, based on the parameters used in the gradient editor?

My understanding is that by adjusting the gradient I can edit how many segments end up in each subgroup, based on the total length of each curve and the % I select.
In the example below, segments forming 14% of each curve (starting from the bottom) will go into the first group.
Segments from 14% to, say, 40% will be assigned to the second group and so on.

I would like to extract these elements into separate lists so that I could select the segments forming the bottom 14% of all curve.

Is there a way to select those elements part of the domain, and use the gradient parameters to do it?
Strictly speaking, I don’t need the gradient, but that’s great to visualise the sub-group division.

The graph mapper is just for the color. The curves are ordered from bot to top. If you partion the list you will have your group. If I remember correct every curve has 22 segments. For example you can list item 0-10 to get the first 50% or 11-21 for the last 50%. You can use whatever list component you want. For example partion list with a size of 11 to group the first and last 50%

Sorry Tim, my previous post wasn’t very clear.

I was wondering if there’s any way to use the parameters in the graph mapper to partition the list, or viceversa, to colour the segments.

Hi Tim/All,

I’m using Tim’s method to rearrange the order of the curves in my rhino file.

Unfortunately I need to use this on multiple geometries/curves.
These are generally similar, however I am struggling to make the routine work with curves that are inclined.

I believe it’s because of the way the vectors are created, as these are not on the same line once projected on the plane.

Any idea on a way around this?

Otherwise, I was thinking I could use the Z coordinate of the midpoint of each segment to reorder them, but I’m not sure how to do it with Grasshopper.

180717.gh (27.6 KB)
export rhino.3dm (159.5 KB)

Hi.
In this case, Join Curves almost works except the curves sit on the polygon corners.

180717_re.gh (72.4 KB)

2 Likes

Hi HS_Kim, that’s great thanks a lot!
That works perfectly for this application.

I’m struggling to understand how you did it and how Sift works.
Can you please shed some light on it?

I’m now wondering if there’s a way to group elements based on their position in the space (e.g.: distance from XY plane).
It might be best if I post this on a separate topic.

You can learn a lot by looking at HS_Kim’s definitions.

You will notice after joining that the 5 corner curves are going a different direction. He tested to see if the start point had a Point in Curve, then sifted the results via a True/False pattern to Flip just those curves.

.

1 Like