Reverse PolyCurve(ByJoinedCurves) failed


I am sorting some elements along a reference curve. I use PolyCurve.ByJoinedCurves to join curves from Revit elements to get the reference curve. Since the direction of the curve maters, I join both origin polycurve and a reversed polycurve for following steps in my script.

So, the script I wrote used to work well, See image 1.

But sometimes the PolyCurve.ByJoinedCurves failed with different input, default tolerance 0.001 used. See image 2.

With same input as image 2, I tried a larger tolerance, 1 (my Revit project units is mm), the curves joined, but the Curve.Reverse don’t work. Error message mentioned there is more than one WIRE in PolyCurve. See image 3.

I would like to know how to fix this or is there a better way to do such things?
Thank you.

Seems the image from the post is too small to see
Image 1:

Image 2:
Image 3:

depending on the order of input lists, and proximity of the underlying “points” and “lines”, these nodes may not process inputs as expected. A possible workaround, on your last image, try to get the points from the polycurve. reverse the list of points, and create the polycurve by points.

Hi @habdirad,

PolyCurve.ByJoinedCurves with tolerance, nodes after that PolyCurve went wrong every single time.

So I used your suggestion, problem solved. Thank you!