Filtered curves

I need to filter the lines … first I need to be able to select all the ones that are parallel, then calculate the distance between them and keep the ones that meet a distance criterion between them and finally eliminate the longest between those pairs of lines found…
Sin título.3dm (31.6 KB)

if it’s like your example, sorting horizontal and vertical lines then the attached could work:
sort horizontal and vertical.gh (8.6 KB)

thanks for the help
Yes, part of the algorithm solves part of the problem since it identifies the vertical and horizontal lines and groups them…in lists…but how do I filter by distance between them in such a way as to group them two by two… For example, keep lines 1 and 2… based on the criteria of distance between them… For example, 1 and 3 are parallel but the distance between them is not in the range that 1 and 2 are… and After that pair that fulfills, eliminate the shortest lines…

can you give a full or more elaborate example of the problem you are trying to solve?

I want to be able to filter all the lines and generate a central line…yellow color in the drawing…
I had first thought of filtering by parallel lines… then filtering or grouping by distances between them and generating pairs of lines (according to a separation criterion)…
After these pairs, I will only keep the longest ones…and finally move it by half the distance used as criteria…in short, it is like generating an axis between the lines
walls.3dm (40.5 KB)

although another idea is the following…
having all the lines in addition to drawn axes to be able to generate a line that joins the points where the blue lines intersect (the axes)
walls2.3dm (39.7 KB)