# Remove the overlapping lines and if it is possible, the biggest one

Hi to everybody,

I have in a list 4 lines two of them are vertical lines (and they are overlapping each other) and the other two are horizontal lines (that are overlapping each other too).

Is it possible to delete/filter the biggest one of each group?
I have tried with IntersectAll and DoesIntersect nodes, but I´m not having good results, because the 4 lines are intersecting each other and I need only the lines that overlap another one

Thank you.

Hi alejandre!

Yes, it is possible : - you should:

• get all lines’s Lenght parameter
• find the maximum Lenght values for each horizontal/vertical type
• and filter out them with FilterByBoolMask or with If node

If there is a chance, that the horizontal and vertical lines’s maximum Lenght values can be promiscuous with each other, than you should separate them - to two lists first - by the lines’s XYZ values’s differences with the same method above.

Please, let me now if it helped

recently I had this issue I was using remove duplicates from Bimorph but later realized that it removes the line regardless of its length,the problem here is to identify the overlapping lines and filter the longest/shortest hence I did some search on this forum and changed a bit to this…

``````import clr
from Autodesk.DesignScript.Geometry import *

l1 = IN[0]
l2 = IN[1]

def co_check(a,b):
try : x = a.Intersect(b)[0]
except : x = None
return x is not None and \
'Line' in str(type(x) )

if l1==l2:
result=False
else:
result=co_check(l1,l2)

OUT=result``````

Would it be possible to use the Trim function somehow to merge all the lines together?

I had a similar problem with space/room boundaries. It is easy to generate lines at the wall centre for all the room bounding, but this gives 100s of overlapping lines of different lengths. It would be great if there was a way to merge all the coincident lines into the minimum possible number of lines.

Is there an easy way to check if lines/vectors are in exactly the same axis?