Merge two line in one line

How to merge two broken or split line in one line?

IF you know they are lines, and you know they are ‘in line’ with each other, you can use a Curve.pointatparameter node to collect 2 points per line, and then a Line.bystartbestfitthroughpoints node.

That is a big proceeding if.

draw lines between the points (start and end) of each line, then take the greatest distance
of course if your lines are in sublists

  1. Sort Lines to Planes
  2. Spring Package “Group by Distance” solve the problem if they aren´t exactly at same plane
  3. Filter Lines by Index => get Lines on same Plane

Not in Dynamo-Skript
4) Group if more than 2 Lines are on the same Plane (Maybe drop if only 1 line is on plane)
5) If more than 2 Lines are on the same Plane you have to group them by the shortes Distance
6) Get start and endpoint from two lines (get 4 Points) and find the max. distance between them
7) Create Line by two Points

Hi All,
All Options are working well. Thanks for Help.

Instead of sorting by plane it is likely more efficient to convert the line’s direction to Y+ quadrants (Vector.Reverse), and group by common vectors after converting to string. You could then use a does Intersect method for index1 vs all other indexes to come up with common groupings, sort the resulting lists and remove duplicate lists, and finally use the line by best fit method I described above.

Idea is to simplify the data set as quickly as possible to reduce the common intersections, while working with the most simplistic data types possible. :slight_smile: