Hi,

I am tring to create a script that will generate an aligned dimension between parallel lines from within a family. What i want to do first is to find out which of these 5 lines are parallel to each other. How would you go about on this?

Hi,

I am tring to create a script that will generate an aligned dimension between parallel lines from within a family. What i want to do first is to find out which of these 5 lines are parallel to each other. How would you go about on this?

link your Element.Geometry node to the first input of GroupByFunction (ālistā) and the Line.Direction node to the second (āfuncā). Dont link nothing to the Line.Direction node input, so it works as a function.

In this image I can see that you Element.Geometry nodeās lists are at Level3, so maybe you need to use levels on GroupByFunction (click on the arrow at the ālistā input and select L2)

It might happend that due to a floating point error, two exact same vector are not grouped together.

Also, two lines can be paralled but their vectors opposite, so they will as well be grouped as different elements.

One option is to group them by the rounded sum of the absolute value of their vector X, Y and Z components.

groupingParallelLines.dyn (15.4 KB)

Would that work if you had lines in the shape of a square? Since adjacent lines should have the same value but not parallel.

I am now trying to group the vectors by dividing Vector.X / Vector.Y, and using rounded value of 2 decimals.

Only I do not know how the GroupByFunction works

I have the feeling this is the node i need but do not know how to set it up.

EDIT: also thinking about List.Map or GroupByKey, but I dont understand how these work.

`func`

input on `GroupByFunction`

only accepts OOTB nodes, but not Code Blocks.

Try using `GroupByKey`

as on my example instead, being the `keys`

input the result of you code block.

X, Y and Z components are from the line direction (vector), so they will be different from adjacent lines as long as they are not collinear.

It is true that adjacent lines will have coincident start/end point, but this doesnāt have any effect on the grouping.

Thanks for your suggestions @alvpickmans. I tried it but got stuck at line length being also taken into account. So in the end there was no group bigger than 1.

I fixed a workaround. Now I have the groups of parallel lines. Still would like to know how to do this using List.Map or GroupByKey or GroupByFunctionā¦ I just dont get these nodes.

Youāre absolutely right, my bad.

Considering this, letās change the ākeysā to be the vectorās angle with the X axis, as image below.

Again, floating point error needs to be solved by rounding the angles obtained.

Apologies for the wrong method before.

Thank you @alvpickmans! I got it.

Iāve created a new topic for the next step of my goal: creating the shortest parallel lines between these parallel lines. If your interested, please have a look here:

That can be handled by normalizing the vector using *Vector.Normalized*

Not wrong

However, you might need to also group together lines that are parallel, but with their direction reversed

See if this helps ā¦

GroupParallel.dyn (17.5 KB)

Hi @Vikram_Subbaiah, I thought about it but following the method I showed earlier (sum of vectorās components as comparison keys), using normalised vectors ends up grouping together any lines parallel to X or Y axis. I didnāt thought about creating a new vector though

Using the ā*angle with X axis*ā method, setting an if statement can do the trick to only return angles between 0-180

Using Dynamo to Identify non parallel walls

Hello @Vikram_Subbaiah,

i got your GroupParallel Dynamo Script. iām able to group the lines which are parallel.

Firstly thank you for sharing the script.

I want to group the lines which are closer and equal in length.

iām attaching the image so that you can understand what iām exactly willing to do.

I need you help

Thank you in Advance.

Regards,

Rathnakar.

hello @salvatoredragotta

go with linkā¦where i created the post and posted what i have done.

Thank you.

Regards