Aligned lines

Hi to everyone! I’m stocked trying to group aligned lines. I’ve tryed grouping by vector, but this does not work with parallel lines… Any suggestion?

If the vectors are opposing and you’re attempting to group using the dot product then keep in mind two parallel lines may have +1 or -1 scalars depending on their normal. In these cases, if you evaluate for equality, you will obviously get an undesirable result (i.e. false when really you expect true). If that is the process you are using, simply abs() the result before testing.

Also, Revit has a bit of problem with very small numbers, meaning 1.0 might not necessarily be 1.0, so also try rounding your result before testing.

1 Like

Thank you Thomas. I’m trying to group list by the dot product but I really think I did not understand how it works.

Normalise the vectors before calculating the dot. You’ll find Vector.Normalize() In the Vector library.