Relocate starting point in middle of the contour curve?

I do need to change the location of the starting point of my curves into the middle of the longest side on top or right side, depending on which side it is longer and I can’t find a reliable way to do this task.

I do have a lot of curves, one of them are longer in length direction (X) other ones are longer in the wide direction (Y). Right now my starting point (for this example) it is located on the “1” location and I do need to move-it into the location “2” or “3” depending on which side it is longer. Each curve have a different starting point and are different in shape and size.

What can be the best way to accomplish this task?


Project_point_on_curve.gh (4.1 KB)


Project_point_on_curve_2022Oct10a.gh (10.3 KB)

Oh! More complicated than I thought… :frowning:

This is one of the most ridiculous things I’ve ever done on this forum. :man_facepalming:


Project_point_on_curve_2022Oct10b.gh (23.7 KB) DEPRECATED, see below.

Oh yeah, I used flatten so this will fail if given a list of similar curves…

Major re-write, this one (below) accepts a (grafted) list of curves.


Project_point_on_curve_2022Oct10c.gh (22.0 KB)

1 Like

This problem looks complex, because I’ve also seen other sorting algorithm that I found in this forum and all of them are generating mixed results. Some of the lines have the result on the bottom or on the left. I do need to relocate on top or right because when I cut this pieces (I cut them in order from Bottom left to top right) and in that points they do have some residual support strength from the surrounding material. Otherwise this pieces will move because the vacuum suction it is not powerful enough to hold on the table the small pieces.
Mixed_result.3dm (115.3 KB)

Get a bounding box and use its 4 corners with closest points to properly divide your outline into “top/bottom/left/right”.

top-right-longest-segment-mid.gh (23.8 KB)

An update on this:
Previous solution is not perfect.

big picture, check original image and zoom in.



top-right-longest-segment-mid.gh (13.4 KB)

1 Like

Did you try the code I posted?

I do used the “Project_point_on_curve_2022Oct10c.gh” file that you posted.

Thank you for this solution. It is working as expected.

Does it work for you?

Unfortunately not as good.

I do get this result:

The solution from Deer it is working as expected.

Can you please post the geometry case where it fails?

Regarding to sorting the order of the geometries, I do find somewhere (I can’t remember from where) a definition that do what I need (not perfectly), but better than nothing, but unfortunately it is working only with square objects.

cg_V2.gh (10.0 KB)

As my shapes are more complicated, I do need to change this script but I dn’t know how to do-it.

I do attached in my previous post. Maybe you overlooked that.

Mixed_result.3dm

I did overlook that because I was on my phone. I see holes in some pieces that likely cause confusion. Too bad that wasn’t included in your first post in this thread. :frowning:

I also see cases where apparently straight lines are broken in pieces by Explode Curve which causes confusion. Both conditions easily found and fixed given adequate test geometry - too late. :roll_eyes:


Project_point_on_curve_2022Oct11a.gh (31.0 KB)

1 Like

This method works but now I need to relocate the starting point of the curves to use this new points.

This is a very old one of mine :rofl:. In this case you can probably use Area to get the centre of your curves, instead of PCen.

1 Like

I did not get your “but”
What is your new question?
I thought my file solved your problem.

2 Likes

Your definition it is good, however the last component “Curve Middle” it is only displaying the point where I do need the actual curve to start. I needed to connect the other components to get the actual curves with the modified starting point.


I think you can get this on your own.
Are you new to GH?
If so, this problem is way too difficult to you.
Try to practice on simple examples and get familiar to basic components.

2 Likes