Since you already seem to be scripting, you could go through all planes starting at the second one, measure the angle between the y-axis of the previous plane and current one. If the angle is bigger than for instance PI/2, flip the plane. If I’m not mistaken, you’ll end up with somewhat homogenized planes.

However, im not sure if there were something wrong with my code, there is no error message, but doesnt seem to be rotating the planes. Mind shedding some light on this?

You need to compare each plane to the previous plane! 0 is also too tight of a tolerance. I’ rather give it some more leeway, judging by your screenshot maybe Pi / 2 or a little less.

I don’t really know C#, but I guess it would look something like this:

for (int i = 1; i < plnList.Capacity; i++) {
if (Vector3d.VectorAngle(plnList[i].YAxis, plnList[i-1].YAxis) > Math.PI / 2) // maybe Pi / 4?
plnList[i].Rotate(Math.PI, plnList[i].Normal);
}

If you have ramps and the likes in mind (meaning your rails are “reasonable”) OR some other thing where a Vector3d could explicitly define what is “up” … then I would strongy suggest to use this way (equally fast with PlanB: i.e. asking various DotProduct related questions):