Group closest parallel lines which are equal in length

Hello dynamobim,
I want to filter or group the parallel lines which are closer and equal in length. i’m unable to find the custom nodes to group them.

i need some help.

Thank you in advance.


Please show us what you already have

1 Like

this is what i have done…
i got the parallel lines with equal length.
But,some lines are grouped with lines which are far away & which are equal in length.
i’m unable to group the nearest and equal length.
attached the image with some lines so that u can get what i’m trying to say.

this is way i filtered them.

Thank you.


@mrathnakar Please post your .dyn and .rvt

I can image a solution with nodes like this:

Checking if they are both parallel and closer than a given margin.
Because we check each curve with each other we get duplicate groups and we need to use List.UniqueItems.
This could be avoided using a Python script for example implementing a better checking algorithm


An optimized python script to do this would look like this:
import clr
from Autodesk.DesignScript.Geometry import Geometry

pts = IN[0]
margin = IN[1]
dist1 = Geometry.DistanceTo

Groups, Queue = [], []
while pts:
	group = []
	Queue.append(pts.pop() )
	while Queue:
		p1 = Queue.pop()
		for i in xrange(len(pts)-1,-1,-1):
			if dist1(p1, pts[i]) <= margin and p1.Direction.IsParallel(pts[i].Direction):
				Queue.append(pts.pop(i) )

OUT = Groups

Kudos to @Dimitar_Venkov since this is a slightly modified version of the Python code in Springs.GroupByDistance node