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.

Regards,

Rathnakar.

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.

Regards,

Rathnakar.

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.

Regards.

Find which lines are parallel

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

clr.AddReference(‘ProtoGeometry’)

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()
group.append(p1)
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) )
Groups.append(group)
OUT = Groups
```

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