Problems with planes normals alignment

I created two planes at the bottom and top of a MESH, and used align planes to try to align the normal vectors of the two planes. Why is the result that one of the normals is opposite? Can someone understand and help me? grateful
align planes.gh (717.1 KB)

Hi,

Align Plane aligns the X axis towards a direction, not the normal.
If you want to flip the plane so its Z axis points towards a given direction, you have to test the dot product and choose the correct plane to use.

This should hopefully work but I can"t be sure since there is a missing plugin.

align planes.gh (718.8 KB)