Collisions of intersecting lines

How to bypass the curve of another curve?

I want to ensure that if there is an intersection of one line with another, then one of them should bypass the other. And depending on the conditions (for example, if the value is “0” then the line goes around from above. If “1” - then from below). The height from the center line and the angle of inclination must also be specified.

Here is an example of what it should look like.


Where is the 0 & 1 for above and below come from? A predetermined value or a option you will have to decide based on specific conditions? Same with the height and angle.

The line will go higher or lower as an option. The height is still arbitrary, as is the angle. But the angle can be both 45 and 90 degrees

I got something like this, but this script is not optimal

You could look there

1 Like

I took as a basis the script that you showed and added it. There it is, but is there a more elegant way to do it than what I wrote?
Скрипт з обходом лінії іншою лінією.gh (11.2 KB)

and the script does not work when more than one line appears

Several lines in the layer (СПЗ) will not cross several lines from the layer (ВК) and (OB).
Скрипт з обходом лінії іншою лінією.gh (18.7 KB)

I quite understand what you want but in order to have a proper solution, it could be good you gave more information
How to choose which curve has a “bridge” ?
Are all curve on plane XY or you want a more general way to deal with ?

Can you upload your curves ? Internalise in Grasshopper or 3dm.

Bridges have lines in layers (СПЗ). All lines lie on the XY plane

I rewrote a little. But for some reason it stops working alone if the value is greater (
Скрипт з обходом лінії іншою лінією.gh (19.9 KB)

here a little script quite without any check on data so it is not robust but the logic is there.

To make a bridge on a curve, plug a curve and a list of plane (the intersection point plus a direction). The script will make a bridge. (13.5 KB)

If you want more curves, it is normally just a matter of dataTree


the script does not work if one line does not cross two two others

Please post you curves,
I am quite sure you don’t use DataTree as you have to.

put “graft” and everything worked

I encourage you to test your DataTree, using compoment like Branch or Panel … in order to check that curves, planes are well ordered. DataTree are powerful but tricky.

And if you want to change orientation of bridge, just flip the plane.

And don’t forget to put Solution on the post that solved your problem.

1 Like

Try this as well (12.3 KB)


Hello, an error appears when adding lines to a layer (ДВ or OB). (16.7 KB)
Інженерні системи.3dm (39.9 KB)

And also, it would be great if the bridge merged with the next and formed one, if the layer lines (ДВ, ОВ) are very close to each other.

With Trim with regions use the points as planes or you will get wrong result.
And use rectangles instead of circles. (16.6 KB)

I can’t find a way to calculate the distance between collision points. This is necessary in order to connect the bridges. For example, if the distance between the rectangles is less than the length of the rectangle, then the bridge connects to another

You can use region union, when two rectangles touch each other they become one rectangle.