Merge overlapped (colinear) curves to single one

Hi, Guys, if u have time, could u please help me with one issue. There r polygons that were offset and I need to merge all overlapping lines to a single line but I could not do it for several days… please, I need a hint. THANKS! these r files for understanding what I need exactly:

offset lines to single curves attempt.gh (8.6 KB)

[David R: I edited this post so the file was attached directly. I also internalised the referenced curves from Rhino so the 3dm file isn’t needed. Items 3 and 4 from this list.]

So in this case here, are you looking to get individual lines (A, B, C, …, H), or are B, C and F supposed to be a single line segment?

Hi, David, thanks for editing my post it is really great and Yes I need that (A, B, C…H) lines be individual lines cuz I need separate outer edge in future =)

You could use this line network cleanup tool:
(install the gha first)

cleanup_curves.gh (10.9 KB)
Topologizer.gha (19 KB)

Original post about this:

3 Likes

In addition to @DanielPiker’s solution, here’s one that only requires the Kangaroo Remove Duplicate Lines components (which is part of the standard GH in Rhino6 toolset): individual lines.gh (21.3 KB)

My idea was:

  1. Cleanup all offset curves, so there’s no polyline vertices in the middle of straight segments.
  2. Get all the corners from all offset curves.
  3. Remove the duplicates from these points.
  4. Project all the remaining corner points onto all the offset curves.
  5. Remove those projections that were further than x away from the base curve. You now have for each offset curve the parameters where all coincident points are.
  6. Shatter at the remaining parameters. You now have the individual line segments, although on the inside they will be duplicated.
  7. Use the Remove Duplicate Lines component to get rid of those.

There is a problem with your offset where a tiny bit of polyline loops back upon itself. This is messing with the logic somewhat.

5 Likes

I’ve made all these steps before and missed “discontunity” , because of these nothing worked… THANK U, DANIEL!!! =D =D =D

THANK U, DAVID!!! U R REALLY THE BEST FORUM =) near future I will falling in love with the Rhino, and one of the reason is u guys!!! thank u very much…

1 Like

It would appear that this tool is exactly what I have been looking for to clean up some messy IGES imports. Unfortunately Topologizer is failing curve to line. Any thoughts?
CurveToLineFail-01.3dm (120.2 KB)

This component only works with line inputs, and in Grasshopper you can have objects which are geometrically lines, but still of type curve, not line. To convert them you can create a line joining the end points:

Thanks David, that really solved the issue for me !

You can use this

offset lines sol.gh (7.9 KB)

1 Like

Thanks for ur reply! it works for this case, but unfortunatly this solution is not universal.(

There is another solution for another case when the curves intersect

if be honest I found the way which makes it work for me Universaly, but I am interested in your solution… =) maybe ur solution is shorter

Share an example to test it