Python - Dividing line on point of intersection

Referring to: Python - Working with arrays

After getting help with the above problem, I’ve encountered my next one already.

My end goal is to split intersecting lines on the points of intersection, so 2 lines forming a T sections will turn into 3 lines and 2 lines forming a cross will split into 4 lines.

In the referred topic, I worked out the distance, I now want to make it so if the distance is within a set tolerance to split at that point.

I’ve looked at Curve.SplitByPoints but I don’t know how to format code to get it to do what I want.

I’ve looked at an If statement, such as

If distance > tolerance

but like mentioned before not too sure on how to turn that into code.

Thanks for the help.

like this maybe?

1 Like

You can use ScopeIf+ from Clockwork like this:

If you need it in code you can use something like this:

(You can wrap the functions inside the codeblock if you want, I was just showing the format you need to use.)

1 Like

Thanks, was trying it as a little python project to improve my skills in it. but since Its needed for work, il use this for now! thanks for the help

For experimenting with later (eg. processing more than one element set to intersect :wink: )

import clr

from Autodesk.DesignScript.Geometry import *


for c in c1:

OUT = y

1 Like