Hi anyone may help me on a c# script?
I am trying to create a script which will be able to joincurves which are coplanar and intersect each other…
I have tried to use the joinCurves method but i don t understand what the IEnumerable parameter is.

here is my script :

List<Curve> myListOfNewCurves = new List<Curve>();
Plane plane = new Plane(point, vector);
for (int i = 0; i < myListOfCurves.Count ; i++)
{
for (int j = 0; j < myListOfCurves.Count ; j++)
{
if (myListOfCurves[i] != myListOfCurves[j] && Curve.PlanarCurveCollision(myListOfCurves[i], myListOfCurves[j], plane, 0.1))
{

LineCurve joinedCurve = new LineCurve(myListOfCurves[i].PointAtStart, myListOfCurves[j].PointAtEnd);
myListOfNewCurves.Add(joinedCurve);
}
}
}
A = myListOfNewCurves;

IEnumerable is a list or an array of curves. It’s the same principle as the Join Curves component.
Howeer if your curves are intersecting each other, this method won’t work. Are you trying to replicate Region Union ?

Hello
in rhinoceros it is not possible to join intersecting curves in a single curve. A curve is a “single” road with no intersection. It is opened or closed.
You could chose to begin the road and always take the right intersection … but you will end with some non linked roads.
From a closed self intersecting curve it is possible to make a single non intersecting curve but cutting the curve at the intersection. Here my component in my future plugin “Nautilus”

Thanks for your answer
Could you please show an example of how to use the joincurves method
i wrote this but it seems to be wrong (I don t know how to deal with IEnumerable type…):
Curve joinedCurve = Curve.JoinCurves(myListOfCurves[i], myListOfCurves[j]);

My aim is to to be able to join curves which are coplanar and contiguous.
so i should have a set of two curves as shown below:

Thanks for your answer
Could you please show an example of how to use the joincurves method
i wrote this but it seems to be wrong (I don t know how to deal with IEnumerable type…):
Curve joinedCurve = Curve.JoinCurves(myListOfCurves[i], myListOfCurves[j]);

My aim is to to be able to join curves which are coplanar and contiguous.
so i should have a set of two curves as shown below:

This is not a trivial work as one curve belongs to 2 planes. So my guess is you need to use each 2 times. Planes could be made using the intersections.

What you show is not coplanar curve but aligned ones.

So at the end you ll have to use join curves and then split at kinks.
You could use Ienumerable with a foreach.

If you want an exapmple post tour script with curves internalise