unroll.AddFollowingGeometry.Overloads[IEnumerable[Rhino.Geometry.Curve]] bug?

I’m having an issue with unrolled curves being indexed in reverse.
In other words:
On some breps curves would get indexed in proper order, on some in reversed.
Same breps would get indexed the same unless something is changed/modified.
How do I determine that before assigning attributes to unrolled curves?
Or how do I make them get indexed one way?

Assembling curves list:

    for j in panel:
        if typ == Rhino.Geometry.LineCurve\
            or typ == Rhino.Geometry.ArcCurve\
            or typ == Rhino.Geometry.NurbsCurve\
            or typ == Rhino.Geometry.PolyCurve\
            or typ == Rhino.Geometry.PolylineCurve:
                panelcrvs.append(j)
                crvsgeo.append(j.Geometry)

Performing unroll:

    unroll = Rhino.Geometry.Unroller(panelsrf.BrepGeometry)
    unroll.AddFollowingGeometry.Overloads[IEnumerable[Rhino.Geometry.Curve]](crvsgeo)
    unroll.AddFollowingGeometry.Overloads[IEnumerable[Rhino.Geometry.TextDot]](dotsgeo)
    unroll.ExplodeOutput = False
    pbreps, pcurves, ppoints, pdots = unroll.PerformUnroll()

Transferring attributes:

    if pcurves:
        for j in range(pcurves.Count):
            attr = panelcrvs[j].Attributes
            attr.RemoveFromAllGroups()
            curves.append(Rhino.DocObjects.ObjRef(sc.doc.Objects.AddCurve(pcurves[j], attr)).Object())

Result:

Transferring attributes in reverse order:

    if pcurves:
        rev = pcurves.Count - 1
        for j in range(pcurves.Count):
            attr = panelcrvs[rev - j].Attributes
            attr.RemoveFromAllGroups()
            curves.append(Rhino.DocObjects.ObjRef(sc.doc.Objects.AddCurve(pcurves[j], attr)).Object())

Hi,

Input and output order are not reliable for the Unroller.
You will need to use the FollowingGeometryIndex to find the input index.

https://developer.rhino3d.com/api/RhinoCommon/html/Overload_Rhino_Geometry_Unroller_FollowingGeometryIndex.htm

HTH
-Willem

Got it! Thanks!

attr = panelcrvs[unroll.FollowingGeometryIndex(pcurves[j])].Attributes