I’m not with a computer at the moment so can’t try methods for this but you could try this:
- Generate a plane for each line (but vertical not horizontal - i.e. an infinite extension of your extruded planes)
- Group your lines by those which share identical planes (note this would be more refined than the previous method to group by same vector)
- Get both the start and end points of the lines in each group and organise them in ascending order along the plane
- If there are any lines where the start/end points touch, this should create a pair of points which are identical in the list. Extract those pairs from the list to leave only the points which don’t have a ‘twin’
- Chop the resulting list into pairs and create lines ‘by start-end point’
Edit: this post may be useful: Planes of lines are - #9 by Ewan_Opie